src/Articus/DataTransfer/Metadata/Reader/Annotation.php
protected static function isValidSetter(\ReflectionClass &$reflection, $name)
	{
		if (!$reflection->hasMethod($name))
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: no setter %s.', $reflection->getName(), $name)
			);
		}
		$setter = $reflection->getMethod($name);
		if (!$setter->isPublic())
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: setter %s is not public.', $reflection->getName(), $name)
			);
		}
		if ($setter->getNumberOfParameters() < 1)
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: setter %s should accept at least one parameter.', $reflection->getName(), $name)
			);
		}
		if ($setter->getNumberOfRequiredParameters() > 1)
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: setter %s requires too many parameters.', $reflection->getName(), $name)
			);
		}
		return true;
	}
protected static function isValidSetter(\ReflectionClass &$reflection, $name)
	{
		if (!$reflection->hasMethod($name))
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: no setter %s.', $reflection->getName(), $name)
			);
		}
		$setter = $reflection->getMethod($name);
		if (!$setter->isPublic())
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: setter %s is not public.', $reflection->getName(), $name)
			);
		}
		if ($setter->getNumberOfParameters() < 1)
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: setter %s should accept at least one parameter.', $reflection->getName(), $name)
			);
		}
		if ($setter->getNumberOfRequiredParameters() > 1)
		{
			throw new \LogicException(
				sprintf('Invalid metadata for %s: setter %s requires too many parameters.', $reflection->getName(), $name)
			);
		}
		return true;
	}
protected static function isValidSetter ( \ ReflectionClass & $ reflection , $ name ) { if ( ! $ reflection -> hasMethod ( $ name ) ) { throw new \ LogicException ( sprintf ( 'Invalid metadata for %s: no setter %s.' , $ reflection -> getName ( ) , $ name ) ) ; } $ setter = $ reflection -> getMethod ( $ name ) ; if ( ! $ setter -> isPublic ( ) ) { throw new \ LogicException ( sprintf ( 'Invalid metadata for %s: setter %s is not public.' , $ reflection -> getName ( ) , $ name ) ) ; } if ( $ setter -> getNumberOfParameters ( ) < 1 ) { throw new \ LogicException ( sprintf ( 'Invalid metadata for %s: setter %s should accept at least one parameter.' , $ reflection -> getName ( ) , $ name ) ) ; } if ( $ setter -> getNumberOfRequiredParameters ( ) > 1 ) { throw new \ LogicException ( sprintf ( 'Invalid metadata for %s: setter %s requires too many parameters.' , $ reflection -> getName ( ) , $ name ) ) ; } return true ; }
Validates if class has valid setter method with specified name
@param \ReflectionClass $reflection
@param string $name
@return bool
Validates if class has valid setter method with specified name