class PharExtensionInterceptor in Drupal 7
Same name in this branch
- 7 misc/typo3/drupal-security/PharExtensionInterceptor.php \Drupal\Core\Security\PharExtensionInterceptor
- 7 misc/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php \TYPO3\PharStreamWrapper\Interceptor\PharExtensionInterceptor
Hierarchy
- class \TYPO3\PharStreamWrapper\Interceptor\PharExtensionInterceptor implements Assertable
Expanded class hierarchy of PharExtensionInterceptor
File
- misc/
typo3/ phar-stream-wrapper/ src/ Interceptor/ PharExtensionInterceptor.php, line 18
Namespace
TYPO3\PharStreamWrapper\InterceptorView source
class PharExtensionInterceptor implements Assertable {
/**
* Determines whether the base file name has a ".phar" suffix.
*
* @param string $path
* @param string $command
* @return bool
* @throws Exception
*/
public function assert($path, $command) {
if ($this
->baseFileContainsPharExtension($path)) {
return true;
}
throw new Exception(sprintf('Unexpected file extension in "%s"', $path), 1535198703);
}
/**
* @param string $path
* @return bool
*/
private function baseFileContainsPharExtension($path) {
$invocation = Manager::instance()
->resolve($path);
if ($invocation === null) {
return false;
}
$fileExtension = pathinfo($invocation
->getBaseName(), PATHINFO_EXTENSION);
return strtolower($fileExtension) === 'phar';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PharExtensionInterceptor:: |
public | function |
Determines whether the base file name has a ".phar" suffix. Overrides Assertable:: |
|
PharExtensionInterceptor:: |
private | function |