addFunction() public method

Adds a function to the function definitions
public addFunction ( zephir\FunctionDefinition $func, array $statement = null )
$func zephir\FunctionDefinition
$statement array
Example #1
0
 /**
  * Adds a function to the function definitions
  *
  * @param Compiler $compiler
  * @param FunctionDefinition $func
  * @param array $statement
  *
  * @throws CompilerException
  */
 public function addFunction(Compiler $compiler, FunctionDefinition $func, $statement = null)
 {
     $compiler->addFunction($func, $statement);
     $funcName = strtolower($func->getInternalName());
     if (isset($this->_functionDefinitions[$funcName])) {
         throw new CompilerException("Function '" . $func->getName() . "' was defined more than one time (in the same file)", $statement);
     }
     $this->_functionDefinitions[$funcName] = $func;
 }