| Conditions | 5 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 44 | public function init_cookie ($cookie = []) { |
|
| 23 | 44 | $this->cookie = $cookie; |
|
| 24 | 44 | if (!$cookie) { |
|
| 25 | 44 | return; |
|
| 26 | } |
||
| 27 | /** |
||
| 28 | * Fill un-prefixed keys according to system configuration |
||
| 29 | */ |
||
| 30 | 16 | $prefix = Config::instance()->core['cookie_prefix']; |
|
| 31 | 16 | $prefix_length = strlen($prefix); |
|
| 32 | 16 | if ($prefix_length) { |
|
| 33 | 2 | foreach ($cookie as $key => $value) { |
|
| 34 | 2 | if (strpos($key, $prefix) === 0) { |
|
| 35 | 2 | $this->cookie[substr($key, $prefix_length)] = $value; |
|
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 | 16 | } |
|
| 40 | /** |
||
| 51 |