You are here

protected function BasePhantomJSDriver::templateCacheSetup in Zircon Profile 8.0

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

Sets up the cache template location for the scripts we are going to create with the driver

Parameters

$templateCache:

Return value

string

Throws

DriverException

1 call to BasePhantomJSDriver::templateCacheSetup()
BasePhantomJSDriver::__construct in vendor/jcalderonzumba/mink-phantomjs-driver/src/BasePhantomJSDriver.php
Instantiates the driver

File

vendor/jcalderonzumba/mink-phantomjs-driver/src/BasePhantomJSDriver.php, line 45

Class

BasePhantomJSDriver
Class BasePhantomJSDriver @package Zumba\Mink\Driver

Namespace

Zumba\Mink\Driver

Code

protected function templateCacheSetup($templateCache) {
  $cacheDir = $templateCache;
  if ($templateCache === null) {
    $cacheDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . "jcalderonzumba" . DIRECTORY_SEPARATOR . "phantomjs";
    if (!file_exists($cacheDir)) {
      mkdir($cacheDir, 0777, true);
    }
  }
  if (!file_exists($cacheDir)) {
    throw new DriverException("Template cache {$cacheDir} directory does not exist");
  }
  return $cacheDir;
}