# solid-performance/1.1.0/src/Performance/Http/Header_Factory.php

Solid Performance – Your No-Code Caching, Performance, &amp; Page Speed Solution, version 1.1.0. 58 lines.

- Page: https://pluginprobe.com/plugins/solid-performance/1.1.0/code/src/Performance/Http/Header_Factory.php
- Raw: https://pluginprobe.com/plugins/solid-performance/1.1.0/raw/src/Performance/Http/Header_Factory.php
- Modified: 2024-09-03T15:51:20+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/solid-performance/1.1.0/code/src/Performance/Http/Header_Factory.php#L10-L20`.

```php
<?php
/**
 * Creates a header instance with response headers.
 *
 * @since   1.0.0
 *
 * @package SolidWP\Performance
 */

declare( strict_types=1 );

namespace SolidWP\Performance\Http;

use SolidWP\Performance\Container;

/**
 * Creates a header instance using response headers.
 *
 * @since   1.0.0
 *
 * @package SolidWP\Performance
 */
class Header_Factory {

	/**
	 * @var Container
	 */
	private Container $container;

	/**
	 * @param  Container $container The container.
	 */
	public function __construct( Container $container ) {
		$this->container = $container;
	}

	/**
	 * Make a header instance using response headers.
	 *
	 * @note headers_list() does not work in CLI.
	 *
	 * @return Header
	 */
	public function make(): Header {
		$headers = headers_list();

		$this->container->when( Header::class )
						->needs( '$headers' )
						->give( static fn(): array => $headers );

		$header = $this->container->get( Header::class );

		$this->container->singleton( Header::class, $header );

		return $header;
	}
}

```
