25 lines
515 B
PHP
25 lines
515 B
PHP
<?php
|
|
// SaveDataHeader.php
|
|
// Created: 2022-02-14
|
|
// Updated: 2022-02-14
|
|
|
|
namespace Index\Http\Headers;
|
|
|
|
use Index\Http\HttpHeader;
|
|
|
|
class SaveDataHeader {
|
|
private bool $saveData;
|
|
|
|
public function __construct(bool $saveData) {
|
|
$this->saveData = $saveData;
|
|
}
|
|
|
|
public function shouldReduceData(): bool {
|
|
return $this->saveData;
|
|
}
|
|
|
|
public static function parse(HttpHeader $header): SaveDataHeader {
|
|
return new SaveDataHeader($header->getFirstLine() === 'yes');
|
|
}
|
|
}
|