= 0, '$pageId', 'must not be negative' ); Assert::parameter( $namespace >= 0, '$namespace', 'must not be negative' ); // Not full validation, intended to help detect lack of validation in the caller. Assert::parameter( !preg_match( '/[#|]/', $dbKey ), '$dbKey', 'must not contain pipes or hashes: ' . $dbKey ); parent::__construct( $namespace, $dbKey, $wikiId ); $this->pageId = $pageId; } /** * Create PageIdentity for a local page. * * @param int $pageId * @param int $namespace * @param string $dbKey * @return PageIdentityValue */ public static function localIdentity( int $pageId, int $namespace, string $dbKey ): self { return new self( $pageId, $namespace, $dbKey, self::LOCAL ); } /** * The numerical page ID provided to the constructor. * * @param string|false $wikiId The wiki ID expected by the caller. * Omit if expecting the local wiki. * * @return int */ public function getId( $wikiId = self::LOCAL ): int { $this->assertWiki( $wikiId ); return $this->pageId; } /** * Returns whether the page currently exists. * Returns true if getId() returns a value greater than zero. * @return bool */ public function exists(): bool { return $this->getId( $this->getWikiId() ) > 0; } /** * @return bool always true */ public function canExist(): bool { return true; } }