/** * @covers \DCarbone\PHPClassBuilder\Template\Structure\FunctionTemplate::setScope * @covers \DCarbone\PHPClassBuilder\Template\Structure\FunctionTemplate::getScope * @depends testCanConstructWithoutArguments */ public function testCanSetScopePostConstruct() { $func = new FunctionTemplate(); $func->setScope(new ScopeEnum(ScopeEnum::_PRIVATE)); $this->assertEquals(ScopeEnum::_PRIVATE, $func->getScope()); }
/** * @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); } }