static function PhpStorageFactory::get in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/PhpStorage/PhpStorageFactory.php \Drupal\Core\PhpStorage\PhpStorageFactory::get()
Instantiates a storage for generated PHP code.
By default, this returns an instance of the \Drupal\Component\PhpStorage\MTimeProtectedFileStorage class.
Classes implementing \Drupal\Component\PhpStorage\PhpStorageInterface can be registered for a specific bin or as a default implementation.
Parameters
string $name: The name for which the storage should be returned. Defaults to 'default' The name is also used as the storage bin if one is not specified in the configuration.
Return value
\Drupal\Component\PhpStorage\PhpStorageInterface An instantiated storage for the specified name.
5 calls to PhpStorageFactory::get()
- PhpBackend::storage in core/
lib/ Drupal/ Core/ Cache/ PhpBackend.php - Gets the PHP code storage object to use.
- PhpStorageFactoryTest::testGetDefault in core/
modules/ system/ tests/ src/ Kernel/ PhpStorage/ PhpStorageFactoryTest.php - Tests the get() method using the 'default' settings.
- PhpStorageFactoryTest::testGetNoSettings in core/
modules/ system/ tests/ src/ Kernel/ PhpStorage/ PhpStorageFactoryTest.php - Tests the get() method with no settings.
- PhpStorageFactoryTest::testGetOverride in core/
modules/ system/ tests/ src/ Kernel/ PhpStorage/ PhpStorageFactoryTest.php - Tests the get() method with overridden settings.
- TwigPhpStorageCache::storage in core/
lib/ Drupal/ Core/ Template/ TwigPhpStorageCache.php - Gets the PHP code storage object to use for the compiled Twig files.
File
- core/
lib/ Drupal/ Core/ PhpStorage/ PhpStorageFactory.php, line 36 - Contains \Drupal\Core\PhpStorage\PhpStorageFactory.
Class
- PhpStorageFactory
- Creates a php storage object
Namespace
Drupal\Core\PhpStorageCode
static function get($name) {
$overrides = Settings::get('php_storage');
if (isset($overrides[$name])) {
$configuration = $overrides[$name];
}
elseif (isset($overrides['default'])) {
$configuration = $overrides['default'];
}
else {
$configuration = array(
'class' => 'Drupal\\Component\\PhpStorage\\MTimeProtectedFileStorage',
'secret' => Settings::getHashSalt(),
);
}
$class = isset($configuration['class']) ? $configuration['class'] : 'Drupal\\Component\\PhpStorage\\MTimeProtectedFileStorage';
if (!isset($configuration['bin'])) {
$configuration['bin'] = $name;
}
if (!isset($configuration['directory'])) {
$configuration['directory'] = PublicStream::basePath() . '/php';
}
return new $class($configuration);
}