| Conditions | 4 |
| Paths | 6 |
| Total Lines | 24 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function init(array $sessions, $executable = null) |
||
| 15 | { |
||
| 16 | if ($executable) { |
||
| 17 | $this->executable = $executable; |
||
| 18 | } |
||
| 19 | |||
| 20 | $this->sessionContainer = new SessionContainer(); |
||
| 21 | |||
| 22 | foreach ($sessions as $sessionName => $session) { |
||
| 23 | $command = $this->executable . " '" . json_encode($session) . "'"; |
||
| 24 | |||
| 25 | exec($command, $output, $return); |
||
| 26 | |||
| 27 | $cookies = json_decode($output[0]); |
||
| 28 | |||
| 29 | $session = new Session(); |
||
| 30 | |||
| 31 | foreach ($cookies as $key => $value) { |
||
| 32 | $session->addCookie($key, $value); |
||
| 33 | } |
||
| 34 | |||
| 35 | $this->sessionContainer->addSession($sessionName, $session); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 47 |