1: <?php
2:
3: namespace Deimos\Cookie\Extensions;
4:
5: use Deimos\Cookie\Extension;
6:
7: trait Option
8: {
9:
10: 11: 12:
13: private $options = [
14: Extension::OPTION_EXPIRE => 0,
15: Extension::OPTION_PATH => '/',
16: Extension::OPTION_DOMAIN => null,
17: Extension::OPTION_SECURE => [],
18: Extension::OPTION_HTTP_ONLY => false,
19: ];
20:
21: 22: 23: 24: 25: 26:
27: protected function merge(array $first, array $second)
28: {
29: if (isset($second[Extension::OPTION_LIFETIME]))
30: {
31: $second[Extension::OPTION_EXPIRE] = $second[Extension::OPTION_LIFETIME] + time();
32: unset($second[Extension::OPTION_LIFETIME]);
33: }
34:
35: return array_merge($first, $second);
36: }
37:
38: }