You are here

public function FileProfilerStorage::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\FileProfilerStorage::__construct()

Constructs the file storage using a "dsn-like" path.

Example : "file:/path/to/the/storage/folder"

Parameters

string $dsn The DSN:

Throws

\RuntimeException

File

vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php, line 37

Class

FileProfilerStorage
Storage for profiler using files.

Namespace

Symfony\Component\HttpKernel\Profiler

Code

public function __construct($dsn) {
  if (0 !== strpos($dsn, 'file:')) {
    throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn));
  }
  $this->folder = substr($dsn, 5);
  if (!is_dir($this->folder)) {
    mkdir($this->folder, 0777, true);
  }
}