id = $id; $this->title = $title; $this->url = $url; $this->description = $description; $this->slug = $slug; } /** * Gets the ID of the content type entry. * * @return int The ID of the content type entry. */ public function get_id(): int { return $this->id; } /** * Gets the title of the content type entry. * * @return string The title of the content type entry. */ public function get_title(): string { return $this->title; } /** * Gets the URL of the content type entry. * * @return string The URL of the content type entry. */ public function get_url(): string { return $this->url; } /** * Gets the description of the content type entry. * * @return string The description of the content type entry. */ public function get_description(): string { return $this->description; } /** * Gets the slug of the content type entry. * * @return string The slug of the content type entry. */ public function get_slug(): string { return $this->slug; } /** * Creates a new instance of the class from the provided Meta object. * * @param Meta $meta The Meta object containing the necessary data to construct the instance. * * @return self A new instance of the class. */ public static function from_meta( Meta $meta ): self { return new self( $meta->post->ID, $meta->post->post_title, $meta->canonical, $meta->post->post_excerpt, $meta->post->post_name, ); } /** * Creates an instance of the class from a WordPress post object. * * @param WP_Post $post The WordPress post object. * @param string $permalink The permalink of the post. * * @return self An instance of the class. */ public static function from_post( WP_Post $post, string $permalink ): self { return new self( $post->ID, $post->post_title, $permalink, $post->post_excerpt, $post->post_name, ); } }