You are here

public function CookieTrait::getCookie in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/jcalderonzumba/mink-phantomjs-driver/src/CookieTrait.php \Zumba\Mink\Driver\CookieTrait::getCookie()

Gets a cookie by its name if exists, else it will return null

Parameters

string $name:

Return value

string

File

vendor/jcalderonzumba/mink-phantomjs-driver/src/CookieTrait.php, line 35

Class

CookieTrait
Trait CookieTrait @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

public function getCookie($name) {
  $cookies = $this->browser
    ->cookies();
  foreach ($cookies as $cookie) {
    if ($cookie instanceof Cookie && strcmp($cookie
      ->getName(), $name) === 0) {
      return $cookie
        ->getValue();
    }
  }
  return null;
}