object_type = $object_type; $this->id = $id; } /** * Creates a post reference. * * @param int $id Post ID. * @return self */ public static function post( int $id ): self { return new self( self::POST, $id ); } /** * Creates a term reference. * * @param int $id Term ID. * @return self */ public static function term( int $id ): self { return new self( self::TERM, $id ); } /** * Returns the object type. * * @return string */ public function get_object_type(): string { return $this->object_type; } /** * Returns the object ID. * * @return int */ public function get_id(): int { return $this->id; } /** * Returns a unique key, e.g. "post:12". * * @return string */ public function get_key(): string { return $this->object_type . ':' . $this->id; } }