class ConjunctionInterceptor in Drupal 7
Hierarchy
- class \TYPO3\PharStreamWrapper\Interceptor\ConjunctionInterceptor implements Assertable
Expanded class hierarchy of ConjunctionInterceptor
File
- misc/
typo3/ phar-stream-wrapper/ src/ Interceptor/ ConjunctionInterceptor.php, line 17
Namespace
TYPO3\PharStreamWrapper\InterceptorView source
class ConjunctionInterceptor implements Assertable {
/**
* @var Assertable[]
*/
private $assertions;
public function __construct(array $assertions) {
$this
->assertAssertions($assertions);
$this->assertions = $assertions;
}
/**
* Executes assertions based on all contained assertions.
*
* @param string $path
* @param string $command
* @return bool
* @throws Exception
*/
public function assert($path, $command) {
if ($this
->invokeAssertions($path, $command)) {
return true;
}
throw new Exception(sprintf('Assertion failed in "%s"', $path), 1539625084);
}
/**
* @param Assertable[] $assertions
*/
private function assertAssertions(array $assertions) {
foreach ($assertions as $assertion) {
if (!$assertion instanceof Assertable) {
throw new \InvalidArgumentException(sprintf('Instance %s must implement Assertable', get_class($assertion)), 1539624719);
}
}
}
/**
* @param string $path
* @param string $command
* @return bool
*/
private function invokeAssertions($path, $command) {
try {
foreach ($this->assertions as $assertion) {
if (!$assertion
->assert($path, $command)) {
return false;
}
}
} catch (Exception $exception) {
return false;
}
return true;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConjunctionInterceptor:: |
private | property | ||
ConjunctionInterceptor:: |
public | function |
Executes assertions based on all contained assertions. Overrides Assertable:: |
|
ConjunctionInterceptor:: |
private | function | ||
ConjunctionInterceptor:: |
private | function | ||
ConjunctionInterceptor:: |
public | function |