annotate vendor/jcalderonzumba/mink-phantomjs-driver/src/SessionTrait.php @ 19:fa3358dc1485 tip

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