comparison vendor/jcalderonzumba/mink-phantomjs-driver/src/SessionTrait.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3
4 namespace Zumba\Mink\Driver;
5
6 /**
7 * Trait SessionTrait
8 * @package Zumba\Mink\Driver
9 */
10 trait SessionTrait {
11
12 /** @var bool */
13 protected $started;
14
15 /**
16 * Starts a session to be used by the driver client
17 */
18 public function start() {
19 $this->started = true;
20 }
21
22 /**
23 * Tells if the session is started or not
24 * @return bool
25 */
26 public function isStarted() {
27 return $this->started;
28 }
29
30 /**
31 * Stops the session completely, clean slate for the browser
32 * @return bool
33 */
34 public function stop() {
35 //Since we are using a remote browser "API", stopping is just like resetting, say good bye to cookies
36 //TODO: In the future we may want to control a start / stop of the remove browser
37 return $this->reset();
38 }
39
40 /**
41 * Clears the cookies in the browser, all of them
42 * @return bool
43 */
44 public function reset() {
45 $this->getBrowser()->clearCookies();
46 $this->getBrowser()->reset();
47 $this->started = false;
48 return true;
49 }
50 }