/*! @var ReflectionMethod The method of the actual interface that this is implementing. */
private $method = NULL;
+ /*! @var bool Whether or not this is required. */
+ private $required = FALSE;
+
public function __construct(\hoplite\base\WeakInterface $interface,
\ReflectionMethod $method)
{
$this->interface = $interface;
$this->method = $method;
+ $this->required = strpos($this->method->GetDocComment(), '@required') !== FALSE;
}
/*! Forwards a method call. */
try {
$impl = $reflector->GetMethod($this->method->name);
} catch (\ReflectionException $e) {
- if ($this->IsRequired())
+ if ($this->required)
throw $e;
return;
}
/*! Checks if a method is marked as required. */
public function IsRequired()
{
- return strpos($this->method->GetDocComment(), '@required') !== FALSE;
+ return $this->required;
}
}