You are here

trait SessionTrait in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/jcalderonzumba/mink-phantomjs-driver/src/SessionTrait.php \Zumba\Mink\Driver\SessionTrait

Trait SessionTrait @package Zumba\Mink\Driver

Hierarchy

File

vendor/jcalderonzumba/mink-phantomjs-driver/src/SessionTrait.php, line 10

Namespace

Zumba\Mink\Driver
View source
trait SessionTrait {

  /** @var  bool */
  protected $started;

  /**
   * Starts a session to be used by the driver client
   */
  public function start() {
    $this->started = true;
  }

  /**
   * Tells if the session is started or not
   * @return bool
   */
  public function isStarted() {
    return $this->started;
  }

  /**
   * Stops the session completely, clean slate for the browser
   * @return bool
   */
  public function stop() {

    //Since we are using a remote browser "API", stopping is just like resetting, say good bye to cookies

    //TODO: In the future we may want to control a start / stop of the remove browser
    return $this
      ->reset();
  }

  /**
   * Clears the cookies in the browser, all of them
   * @return bool
   */
  public function reset() {
    $this
      ->getBrowser()
      ->clearCookies();
    $this
      ->getBrowser()
      ->reset();
    $this->started = false;
    return true;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SessionTrait::$started protected property @var bool
SessionTrait::isStarted public function Tells if the session is started or not
SessionTrait::reset public function Clears the cookies in the browser, all of them
SessionTrait::start public function Starts a session to be used by the driver client
SessionTrait::stop public function Stops the session completely, clean slate for the browser