class BoostCacheRoute in Boost 8
BoostCacheRoute class.
@todo, allow admin to set uri scheme location.
Hierarchy
- class \Drupal\boost\BoostCacheRoute
Expanded class hierarchy of BoostCacheRoute
1 file declares its use of BoostCacheRoute
- BoostCache.php in src/
BoostCache.php - Contains Drupal\boost\BoostCache
1 string reference to 'BoostCacheRoute'
1 service uses BoostCacheRoute
File
- src/
BoostCacheRoute.php, line 18 - Contains Drupal\boost\BoostCacheRoute
Namespace
Drupal\boostView source
class BoostCacheRoute {
/**
* File system schema.
*/
protected $schema;
/**
* File extension.
*/
protected $extension;
/**
* The normalized current path.
*/
protected $filePath;
/**
* The current path.
* @var \Drupal\Core\Path\CurrentPathStack
*/
protected $currentPath;
/**
* The alias manager.
* @var \Drupal\Core\Path\AliasManager
*/
protected $aliasManager;
/**
* @param \Drupal\Core\Path\CurrentPathStack $current_path
* The current path.
* @param \Drupal\Core\Path\AliasManager $aliasManager
* The alias manager.
*/
public function __construct(CurrentPathStack $current_path, AliasManager $alias_manager) {
$this->currentPath = $current_path;
$this->aliasManager = $alias_manager;
$this->schema = file_default_scheme() . '://boost';
$this->extension = '.html';
}
/**
* Return the current file uri.
*/
public function getUri() {
return $this->schema . $this
->getPath() . $this->extension;
}
/**
* Return the current path.
*/
public function getPath() {
return $this->aliasManager
->getAliasByPath($this->currentPath
->getPath());
}
/**
* Return the converted file path.
*/
public function getFilePath() {
if (!$this->filePath) {
$this->filePath = array_filter($this
->convertPath());
}
return $this->filePath;
}
/**
* Convert the path into a file path.
*/
private function convertPath() {
return explode('/', $this
->getPath());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BoostCacheRoute:: |
protected | property | The alias manager. | |
BoostCacheRoute:: |
protected | property | The current path. | |
BoostCacheRoute:: |
protected | property | File extension. | |
BoostCacheRoute:: |
protected | property | The normalized current path. | |
BoostCacheRoute:: |
protected | property | File system schema. | |
BoostCacheRoute:: |
private | function | Convert the path into a file path. | |
BoostCacheRoute:: |
public | function | Return the converted file path. | |
BoostCacheRoute:: |
public | function | Return the current path. | |
BoostCacheRoute:: |
public | function | Return the current file uri. | |
BoostCacheRoute:: |
public | function |