$field ), '$row->' . $field, 'is required' ); } Assert::parameter( $row->page_id > 0, '$pageId', 'must be greater than zero (page must exist)' ); parent::__construct( $row->page_id, $row->page_namespace, $row->page_title, $wikiId ); $this->row = $row; } /** * False if the page has had more than one edit. * * @return bool */ public function isNew(): bool { return (bool)$this->row->page_is_new; } /** * True if the page is a redirect. * * @return bool */ public function isRedirect(): bool { return (bool)$this->row->page_is_redirect; } /** * The ID of the page'S latest revision. * * @param bool $wikiId * * @return int */ public function getLatest( $wikiId = self::LOCAL ): int { $this->assertWiki( $wikiId ); return (int)$this->row->page_latest; } /** * Timestamp at which the page was last rerendered. * * @return string */ public function getTouched(): string { return MWTimestamp::convert( TS_MW, $this->row->page_touched ); } /** * Language in which the page is written. * * @return ?string */ public function getLanguage(): ?string { return $this->getField( 'page_lang' ); } /** * Return the raw value for the given field as returned by the database query. * * Numeric values may be encoded as strings. * Boolean values may be represented as integers (or numeric strings). * Timestamps will use the database's native format. * * @internal * * @param string $field * * @return string|int|bool|null */ public function getField( string $field ) { // Field may be missing entirely. return $this->row->$field ?? null; } }