ff47813fee0ea2392fdf0c1134cf9ba5f9e2a6bb
[yaffs-website] / vendor / league / container / src / Definition / AbstractDefinition.php
1 <?php
2
3 namespace League\Container\Definition;
4
5 use League\Container\Argument\ArgumentResolverInterface;
6 use League\Container\Argument\ArgumentResolverTrait;
7 use League\Container\ImmutableContainerAwareTrait;
8
9 abstract class AbstractDefinition implements ArgumentResolverInterface, DefinitionInterface
10 {
11     use ArgumentResolverTrait;
12     use ImmutableContainerAwareTrait;
13
14     /**
15      * @var string
16      */
17     protected $alias;
18
19     /**
20      * @var mixed
21      */
22     protected $concrete;
23
24     /**
25      * @var array
26      */
27     protected $arguments = [];
28
29     /**
30      * Constructor.
31      *
32      * @param string $alias
33      * @param mixed  $concrete
34      */
35     public function __construct($alias, $concrete)
36     {
37         $this->alias     = $alias;
38         $this->concrete  = $concrete;
39     }
40
41     /**
42      * {@inheritdoc}
43      */
44     public function withArgument($arg)
45     {
46         $this->arguments[] = $arg;
47
48         return $this;
49     }
50
51     /**
52      * {@inheritdoc}
53      */
54     public function withArguments(array $args)
55     {
56         foreach ($args as $arg) {
57             $this->withArgument($arg);
58         }
59
60         return $this;
61     }
62 }