Manager.php in Drupal 7
File
misc/typo3/phar-stream-wrapper/src/Manager.php
View source
<?php
namespace TYPO3\PharStreamWrapper;
use TYPO3\PharStreamWrapper\Resolver\PharInvocation;
use TYPO3\PharStreamWrapper\Resolver\PharInvocationCollection;
use TYPO3\PharStreamWrapper\Resolver\PharInvocationResolver;
class Manager {
private static $instance;
private $behavior;
private $resolver;
private $collection;
public static function initialize(Behavior $behaviour, Resolvable $resolver = null, Collectable $collection = null) {
if (self::$instance === null) {
self::$instance = new self($behaviour, $resolver, $collection);
return self::$instance;
}
throw new \LogicException('Manager can only be initialized once', 1535189871);
}
public static function instance() {
if (self::$instance !== null) {
return self::$instance;
}
throw new \LogicException('Manager needs to be initialized first', 1535189872);
}
public static function destroy() {
if (self::$instance === null) {
return false;
}
self::$instance = null;
return true;
}
private function __construct(Behavior $behaviour, Resolvable $resolver = null, Collectable $collection = null) {
if ($collection === null) {
$collection = new PharInvocationCollection();
}
if ($resolver === null) {
$resolver = new PharInvocationResolver();
}
$this->collection = $collection;
$this->resolver = $resolver;
$this->behavior = $behaviour;
}
public function assert($path, $command) {
return $this->behavior
->assert($path, $command);
}
public function resolve($path, $flags = null) {
return $this->resolver
->resolve($path, $flags);
}
public function getCollection() {
return $this->collection;
}
}