/**
  * @param FunctionTemplate $function
  * @return InvalidInterfaceFunctionScopeException
  */
 protected function createInvalidInterfaceFunctionScopeException(FunctionTemplate $function)
 {
     return new InvalidInterfaceFunctionScopeException(sprintf('%s - Interface functions must be public, added function %s has scope of %s.', get_class($this), $this->_determineExceptionValueOutput($function->getName()), (string) $function->getScope()));
 }
 /**
  * @param FunctionTemplate $function
  */
 public function addFunction(FunctionTemplate $function)
 {
     if (ScopeEnum::_PUBLIC === (string) $function->getScope()) {
         $this->_functions[$function->getName()] = $function;
     } else {
         throw $this->createInvalidInterfaceFunctionScopeException($function);
     }
 }
 /**
  * @covers \DCarbone\PHPClassBuilder\Template\Structure\FunctionTemplate::compile
  * @covers \DCarbone\PHPClassBuilder\Template\Structure\FunctionTemplate::parseCompileOpts
  * @covers \DCarbone\PHPClassBuilder\Template\Structure\FunctionTemplate::_buildParameters
  * @expectedException \DCarbone\PHPClassBuilder\Exception\InvalidCompileOptionValueException
  * @depends testCanOutputFunctionWithoutBody
  */
 public function testExceptionThrownWhenUsingInvalidIncludeBodyCompileOption()
 {
     $funcName = self::generateTestFunctionName();
     $func = new FunctionTemplate($funcName);
     $func->compile(array(CompileOpt::INC_BODY => 'woot!'));
 }
Пример #4
0
 /**
  * @param FunctionTemplate $function
  */
 public function addFunction(FunctionTemplate $function)
 {
     $this->_functions[$function->getName()] = $function;
 }