1 | <?php |
||
40 | class Cookie |
||
41 | { |
||
42 | /** |
||
43 | * @var string The name of this cookie |
||
44 | */ |
||
45 | protected $name = null; |
||
46 | |||
47 | /** |
||
48 | * @var string The value of this cookie |
||
49 | */ |
||
50 | protected $value = null; |
||
51 | |||
52 | /** |
||
53 | * @var array Cookie class configuration defaults |
||
54 | */ |
||
55 | protected $config = array( |
||
56 | 'expiration' => 0, // int, Cookie expiration |
||
57 | 'path' => '/', // string, Cookie path |
||
58 | 'domain' => null, // string, Cookie domain |
||
59 | 'secure' => false, // bool, Send only over HTTPS |
||
60 | 'http_only' => false, // only accessible via HTTP client-side |
||
61 | ); |
||
62 | |||
63 | /** |
||
64 | * @var bool Is this a new cookie, or one that was send to the server? |
||
65 | */ |
||
66 | protected $isNew = true; |
||
67 | |||
68 | /** |
||
69 | * @var bool Wether or not we want to delete this cookie |
||
70 | */ |
||
71 | protected $isDeleted = false; |
||
72 | |||
73 | /** |
||
74 | * @var bool Wether or not this cookie was already sent to the browser |
||
75 | */ |
||
76 | protected $isSent = false; |
||
77 | |||
78 | /** |
||
79 | * @var CookieWrapper wrapper around the setcookie() function for testability |
||
80 | */ |
||
81 | protected $wrapper; |
||
82 | |||
83 | /** |
||
84 | * Create a new cookie object, optionally load an existing cookie value |
||
85 | * |
||
86 | * @param string $name Name of this cookie |
||
87 | * @param array $config Configuration for this cookie |
||
88 | * @param string $value Initial value to be set for this cookie |
||
89 | * @pararm SetcookieWrapper $wrapper So we can inject a custom wrapper for unit testing |
||
90 | */ |
||
91 | public function __construct($name, Array $config = array(), $value = null, $wrapper = null) |
||
113 | |||
114 | /** |
||
115 | * Magic getter/setter methods |
||
116 | * |
||
117 | * @throws InvalidArgumentException if a setter is called without a value |
||
118 | */ |
||
119 | public function __call($method, $arguments) |
||
165 | |||
166 | /** |
||
167 | * Delete this Cookie |
||
168 | * |
||
169 | * @return bool |
||
170 | */ |
||
171 | public function delete() |
||
176 | |||
177 | /** |
||
178 | * Send this cookie to the client |
||
179 | * |
||
180 | * @return bool |
||
181 | * |
||
182 | * @since 2.0.0 |
||
183 | */ |
||
184 | public function send() |
||
216 | |||
217 | /** |
||
218 | * Return the state of this Cookie object |
||
219 | */ |
||
220 | public function isNew() |
||
224 | |||
225 | /** |
||
226 | * Return the state of this Cookie object |
||
227 | */ |
||
228 | public function isSent() |
||
232 | |||
233 | /** |
||
234 | * Return the state of this Cookie object |
||
235 | */ |
||
236 | public function isDeleted() |
||
240 | |||
241 | } |
||
242 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..