You are here

class Manager in Drupal 7

Hierarchy

  • class \TYPO3\PharStreamWrapper\Manager

Expanded class hierarchy of Manager

4 files declare their use of Manager
file.phar.inc in includes/file.phar.inc
PharExtensionInterceptor.php in misc/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php
PharInvocationResolver.php in misc/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php
PharMetaDataInterceptor.php in misc/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php

File

misc/typo3/phar-stream-wrapper/src/Manager.php, line 18

Namespace

TYPO3\PharStreamWrapper
View source
class Manager {

  /**
   * @var self
   */
  private static $instance;

  /**
   * @var Behavior
   */
  private $behavior;

  /**
   * @var Resolvable
   */
  private $resolver;

  /**
   * @var Collectable
   */
  private $collection;

  /**
   * @param Behavior $behaviour
   * @param Resolvable $resolver
   * @param Collectable $collection
   * @return self
   */
  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);
  }

  /**
   * @return self
   */
  public static function instance() {
    if (self::$instance !== null) {
      return self::$instance;
    }
    throw new \LogicException('Manager needs to be initialized first', 1535189872);
  }

  /**
   * @return bool
   */
  public static function destroy() {
    if (self::$instance === null) {
      return false;
    }
    self::$instance = null;
    return true;
  }

  /**
   * @param Behavior $behaviour
   * @param Resolvable $resolver
   * @param Collectable $collection
   */
  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;
  }

  /**
   * @param string $path
   * @param string $command
   * @return bool
   */
  public function assert($path, $command) {
    return $this->behavior
      ->assert($path, $command);
  }

  /**
   * @param string $path
   * @param null|int $flags
   * @return null|PharInvocation
   */
  public function resolve($path, $flags = null) {
    return $this->resolver
      ->resolve($path, $flags);
  }

  /**
   * @return Collectable
   */
  public function getCollection() {
    return $this->collection;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Manager::$behavior private property
Manager::$collection private property
Manager::$instance private static property
Manager::$resolver private property
Manager::assert public function
Manager::destroy public static function
Manager::getCollection public function
Manager::initialize public static function
Manager::instance public static function
Manager::resolve public function
Manager::__construct private function