/**
  * @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::setName
  * @covers \DCarbone\PHPClassBuilder\Template\Structure\FunctionTemplate::getName
  * @covers \DCarbone\PHPClassBuilder\Utilities\NameUtils::isValidFunctionName
  * @depends testCanConstructWithoutArguments
  */
 public function testCanSetNamePostConstruct()
 {
     $func = new FunctionTemplate();
     $func->setName('test');
     $this->assertEquals('test', $func->getName());
 }
Exemplo n.º 4
0
 /**
  * @param FunctionTemplate $function
  */
 public function addFunction(FunctionTemplate $function)
 {
     $this->_functions[$function->getName()] = $function;
 }