class FilesystemValidator in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 8.3 src/Service/Filesystem/FilesystemValidator.php \Drupal\simple_oauth\Service\Filesystem\FilesystemValidator
- 5.x src/Service/Filesystem/FilesystemValidator.php \Drupal\simple_oauth\Service\Filesystem\FilesystemValidator
@internal
Hierarchy
- class \Drupal\simple_oauth\Service\Filesystem\FilesystemValidator
Expanded class hierarchy of FilesystemValidator
1 file declares its use of FilesystemValidator
- KeyGeneratorService.php in src/
Service/ KeyGeneratorService.php
File
- src/
Service/ Filesystem/ FilesystemValidator.php, line 11
Namespace
Drupal\simple_oauth\Service\FilesystemView source
class FilesystemValidator {
/**
* @var \Drupal\simple_oauth\Service\Filesystem\FileSystemChecker
*/
private $fileSystemChecker;
/**
* FilesystemValidator constructor.
*
* @param \Drupal\simple_oauth\Service\Filesystem\FileSystemChecker $file_system_checker
*/
public function __construct(FileSystemChecker $file_system_checker) {
$this->fileSystemChecker = $file_system_checker;
}
/**
* Validate {@var $ext_name} extension exist.
*
* @param string $ext_name
* extension name.
*
* @throws \Drupal\simple_oauth\Service\Exception\ExtensionNotLoadedException
*/
public function validateOpensslExtensionExist($ext_name) {
if (!$this->fileSystemChecker
->isExtensionEnabled($ext_name)) {
throw new ExtensionNotLoadedException(strtr('Extension "@ext" is not enabled.', [
'@ext' => $ext_name,
]));
}
}
/**
* Validate that {@var $paths} are directories.
*
* @param array $paths
* List of URIs.
*
* @throws \Drupal\simple_oauth\Service\Exception\FilesystemValidationException
*/
public function validateAreDirs($paths) {
foreach ($paths as $path) {
if (!$this->fileSystemChecker
->isDirectory($path)) {
throw new FilesystemValidationException(strtr('Directory "@path" is not a valid directory.', [
'@path' => $path,
]));
}
}
}
/**
* Validate that {@var $paths} are writable.
*
* @param array $paths
* List of URIs.
*
* @throws \Drupal\simple_oauth\Service\Exception\FilesystemValidationException
*/
public function validateAreWritable($paths) {
foreach ($paths as $path) {
if (!$this->fileSystemChecker
->isWritable($path)) {
throw new FilesystemValidationException(strtr('Path "@path" is not writable.', [
'@path' => $path,
]));
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FilesystemValidator:: |
private | property | ||
FilesystemValidator:: |
public | function | Validate that { | |
FilesystemValidator:: |
public | function | Validate that { | |
FilesystemValidator:: |
public | function | Validate { | |
FilesystemValidator:: |
public | function | FilesystemValidator constructor. |