public function __construct(Identifier $page) { if (!$page->of(WebPage::getIdentifier())) { throw new \InvalidArgumentException(sprintf('RestartRequestOnPageException expects a web page identifier, %s given.', $page->getFullyQualifiedName())); } $this->page = $page; parent::__construct('RestartRequestOnPageException'); }
/** * Throw an exception if the object identifier is not a subclass or implementer of expected * @param Identifier $object * @param Identifier $expected * @param type $argName */ public static function identifierOf(Identifier $object, Identifier $expected, $argName) { if (!$object->of($expected)) { throw new \InvalidArgumentException(sprintf("%s expected argument %s to be an identifier of %s, actual %s", self::getCallingMethod(), $argName, $expected->getFullyQualifiedName(), $object->getFullyQualifiedName())); } }
public function mount($path, Identifier $page) { if (!$page->of(WebPage::getIdentifier())) { throw new \InvalidArgumentException('Expected an identifier of a web page'); } if ($this->isMounted($path)) { throw new \InvalidArgumentException(sprintf('The path %s is already mounted', $path)); } $this->addToPath($path, $page->getFullyQualifiedName()); $this->mountedPages[] = $path; }