PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.8.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.8.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Page_Cache / Meta / Meta_Factory.php

Meta_Factory.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.8.0, at src/Performance/Page_Cache/Meta/Meta_Factory.php

54 lines 973 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * A factory to create a Meta Value Object.
4 *
5 * @package SolidWP\Performance
6 */
7
8 declare( strict_types=1 );
9
10 namespace SolidWP\Performance\Page_Cache\Meta;
11
12 use InvalidArgumentException;
13 use SolidWP\Performance\Http\Header_Factory;
14
15 /**
16 * A factory to create a Meta Value Object.
17 *
18 * @see Meta
19 *
20 * @package SolidWP\Performance
21 */
22 class Meta_Factory {
23
24 /**
25 * @var Header_Factory
26 */
27 private Header_Factory $header_factory;
28
29 /**
30 * @param Header_Factory $header_factory The header factory.
31 */
32 public function __construct( Header_Factory $header_factory ) {
33 $this->header_factory = $header_factory;
34 }
35
36 /**
37 * Make a Meta Value Object.
38 *
39 * @param string $url The URL associated with the meta.
40 *
41 * @throws InvalidArgumentException If the $url is empty.
42 *
43 * @return Meta
44 */
45 public function make( string $url ): Meta {
46 return Meta::from(
47 [
48 'url' => $url,
49 'headers' => $this->header_factory->make(),
50 ]
51 );
52 }
53 }
54