/**
  * Creates a new discovery.
  *
  * @param KeyValueStore        $store        The key-value store used to
  *                                           store the bindings and the
  *                                           binding types.
  * @param BindingInitializer[] $initializers The binding initializers to
  *                                           apply to newly created or
  *                                           unserialized bindings.
  */
 public function __construct(KeyValueStore $store, array $initializers = array())
 {
     parent::__construct($initializers);
     $this->store = $store;
     $this->keysByTypeName = $store->get('::keysByTypeName', array());
     $this->nextKey = $store->get('::nextKey', 0);
 }
Пример #2
0
 /**
  * Creates a new resource discovery.
  *
  * @param ResourceRepository $repo  The repository to fetch resources from.
  * @param KeyValueStore      $store The key-value store used to store the
  *                                  bindings and the binding types.
  */
 public function __construct(ResourceRepository $repo, KeyValueStore $store)
 {
     parent::__construct($repo);
     $this->store = $store;
     $this->queryIndex = $store->get('//queryIndex', array());
     $this->typeIndex = $store->get('//typeIndex', array());
 }
Пример #3
0
 /**
  * Creates a new resource discovery.
  *
  * @param string               $path         The path to the JSON file.
  * @param BindingInitializer[] $initializers The binding initializers to
  *                                           apply to newly created or
  *                                           unserialized bindings.
  */
 public function __construct($path, array $initializers = array())
 {
     Assert::stringNotEmpty($path, 'The path to the JSON file must be a non-empty string. Got: %s');
     parent::__construct($initializers);
     $this->path = $path;
     $this->encoder = new JsonEncoder();
     $this->encoder->setPrettyPrinting(true);
     $this->encoder->setEscapeSlash(false);
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 public function __construct(ResourceRepository $repo)
 {
     parent::__construct($repo);
     $this->clear();
 }