Esempio n. 1
0
 /**
  * Creates a new binding.
  *
  * @param string                      $query      The resource query.
  * @param Resource|ResourceCollection $resources  The resources to bind.
  * @param BindingType                 $type       The type to bind against.
  * @param array                       $parameters Additional parameters.
  * @param string                      $language   The language of the resource query.
  *
  * @throws NoSuchParameterException  If an invalid parameter was passed.
  * @throws MissingParameterException If a required parameter was not passed.
  * @throws InvalidArgumentException  If the resources are invalid.
  */
 public function __construct($query, $resources, BindingType $type, array $parameters = array(), $language = 'glob')
 {
     if ($resources instanceof Resource) {
         $resources = new ArrayResourceCollection(array($resources));
     }
     if (!$resources instanceof ResourceCollection) {
         throw new InvalidArgumentException(sprintf('Expected resources of type ResourceInterface or ' . 'ResourceCollectionInterface. Got: %s', is_object($resources) ? get_class($resources) : gettype($resources)));
     }
     Assert::greaterThan(count($resources), 0, 'You should pass at least one resource to EagerBinding.');
     parent::__construct($query, $type, $parameters, $language);
     $this->resources = $resources;
 }
Esempio n. 2
0
 /**
  * Creates a new class binding.
  *
  * @param string    $className       The fully-qualified name of the bound
  *                                   class.
  * @param string    $typeName        The name of the type to bind against.
  * @param array     $parameterValues The values of the parameters defined
  *                                   for the type.
  * @param Uuid|null $uuid            The UUID of the binding. A new one is
  *                                   generated if none is passed.
  *
  * @throws NoSuchParameterException  If an invalid parameter was passed.
  * @throws MissingParameterException If a required parameter was not passed.
  */
 public function __construct($className, $typeName, array $parameterValues = array(), Uuid $uuid = null)
 {
     parent::__construct($typeName, $parameterValues, $uuid);
     $this->className = $className;
 }
Esempio n. 3
0
 public function __construct($string, $typeName, array $parameterValues = array())
 {
     parent::__construct($typeName, $parameterValues);
     $this->string = $string;
 }
Esempio n. 4
0
 /**
  * Creates a new class binding.
  *
  * @param string $className       The fully-qualified name of the bound
  *                                class.
  * @param string $typeName        The name of the type to bind against.
  * @param array  $parameterValues The values of the parameters defined
  *                                for the type.
  *
  * @throws NoSuchParameterException  If an invalid parameter was passed.
  * @throws MissingParameterException If a required parameter was not passed.
  */
 public function __construct($className, $typeName, array $parameterValues = array())
 {
     parent::__construct($typeName, $parameterValues);
     $this->className = $className;
 }
Esempio n. 5
0
 /**
  * Creates a new resource binding.
  *
  * A resource binding has a query that is used to retrieve the resources
  * matched by the binding.
  *
  * You can pass parameters that have been defined for the type. If you pass
  * unknown parameters, or if a required parameter is missing, an exception
  * is thrown.
  *
  * All parameters that you do not set here will receive the default values
  * set for the parameter.
  *
  * @param string $query           The resource query.
  * @param string $typeName        The type to bind against.
  * @param array  $parameterValues The values of the parameters defined
  *                                for the type.
  * @param string $language        The language of the resource query.
  *
  * @throws NoSuchParameterException  If an invalid parameter was passed.
  * @throws MissingParameterException If a required parameter was not passed.
  */
 public function __construct($query, $typeName, array $parameterValues = array(), $language = 'glob')
 {
     parent::__construct($typeName, $parameterValues);
     $this->query = $query;
     $this->language = $language;
 }
Esempio n. 6
0
 /**
  * Creates a new binding.
  *
  * @param string             $query      The resource query.
  * @param ResourceRepository $repo       The repository to load the
  *                                       resources from.
  * @param BindingType        $type       The type to bind against.
  * @param array              $parameters Additional parameters.
  * @param string             $language   The language of the resource query.
  *
  * @throws NoSuchParameterException  If an invalid parameter was passed.
  * @throws MissingParameterException If a required parameter was not passed.
  */
 public function __construct($query, ResourceRepository $repo, BindingType $type, array $parameters = array(), $language = 'glob')
 {
     parent::__construct($query, $type, $parameters, $language);
     $this->repo = $repo;
 }