# wp-parsely/3.16.4/src/Metadata/class-category-builder.php

Parse.ly, version 3.16.4. 49 lines.

- Page: https://pluginprobe.com/plugins/wp-parsely/3.16.4/code/src/Metadata/class-category-builder.php
- Raw: https://pluginprobe.com/plugins/wp-parsely/3.16.4/raw/src/Metadata/class-category-builder.php
- Modified: 2023-02-27T12:36:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-parsely/3.16.4/code/src/Metadata/class-category-builder.php#L10-L20`.

```php
<?php
/**
 * Category Page Metadata Builder class
 *
 * @package Parsely
 * @since 3.4.0
 */

declare(strict_types=1);

namespace Parsely\Metadata;

/**
 * Implements abstract Metadata Builder class to generate the metadata array
 * for a category page.
 *
 * @since 3.4.0
 */
class Category_Builder extends Metadata_Builder {
	/**
	 * Generates the metadata object by calling the build_* methods and
	 * returns the value.
	 *
	 * @since 3.4.0
	 *
	 * @return array<string, mixed>
	 */
	public function get_metadata(): array {
		$this->build_basic();
		$this->build_headline();
		$this->build_url();

		return $this->metadata;
	}

	/**
	 * Populates the `headline` field in the metadata object.
	 *
	 * @since 3.4.0
	 */
	private function build_headline(): void {
		$category = get_queried_object();

		if ( isset( $category->name ) ) {
			$this->metadata['headline'] = $this->clean_value( $category->name );
		}
	}
}

```
