public function findFirstVariableAssignment(array $statements, $name, $notFoundError = null)
    {
        foreach ($this->filterAssignments($statements) as $assign) {
            if ($assign->var instanceof Variable && $assign->var->name === $name) {
                return $assign;
            }
        }

        throw new \RuntimeException($notFoundError ?: sprintf('Variable assignment $%s not found', $name));
    }
public function findFirstVariableAssignment(array $statements, $name, $notFoundError = null)
    {
        foreach ($this->filterAssignments($statements) as $assign) {
            if ($assign->var instanceof Variable && $assign->var->name === $name) {
                return $assign;
            }
        }

        throw new \RuntimeException($notFoundError ?: sprintf('Variable assignment $%s not found', $name));
    }
public function findFirstVariableAssignment ( array $ statements , $ name , $ notFoundError = null ) { foreach ( $ this -> filterAssignments ( $ statements ) as $ assign ) { if ( $ assign -> var instanceof Variable && $ assign -> var -> name === $ name ) { return $ assign ; } } throw new \ RuntimeException ( $ notFoundError ? : sprintf ( 'Variable assignment $%s not found' , $ name ) ) ; }
Find first variable assignment with a given name.

@param array       $statements
@param string      $name
@param string|null $notFoundError

@return Assign
Find first variable assignment with a given name .