1 | <?php |
||
13 | class ECTBuilder |
||
14 | { |
||
15 | private $policies; |
||
16 | private $needsCompile = true; |
||
17 | private $compiled = ''; |
||
18 | |||
19 | /** |
||
20 | * @param array $policy |
||
21 | */ |
||
22 | public function __construct(array $policy = []) |
||
26 | |||
27 | /** |
||
28 | * Compile the current policies into an Expect-CT header |
||
29 | * |
||
30 | * @return string |
||
31 | * @throws InvalidArgumentException |
||
32 | */ |
||
33 | public function compile() |
||
62 | |||
63 | /** |
||
64 | * @param int $maxAge |
||
65 | * @return int |
||
66 | * @throws InvalidArgumentException |
||
67 | */ |
||
68 | private function parseMaxAge($maxAge) |
||
80 | |||
81 | /** |
||
82 | * Get the formatted Expect-CT header |
||
83 | * |
||
84 | * @return string |
||
85 | * @throws InvalidArgumentException::class |
||
86 | */ |
||
87 | public function getCompiledHeader() |
||
95 | |||
96 | /** |
||
97 | * PSR-7 header injection |
||
98 | * |
||
99 | * @param MessageInterface $message |
||
100 | * @return MessageInterface |
||
101 | * @throws InvalidArgumentException |
||
102 | */ |
||
103 | public function injectECTHeader(MessageInterface $message) |
||
111 | |||
112 | /** |
||
113 | * Send the compiled Expect-CT as a header() |
||
114 | * |
||
115 | * @return boolean |
||
116 | * @throws Exception |
||
117 | */ |
||
118 | public function sendECTHeader() |
||
131 | } |
||
132 |