1: <?php
2:
3: namespace Deimos\DI;
4:
5: class Argument
6: {
7:
8: /**
9: * @var DI
10: */
11: protected $di;
12:
13: /**
14: * @var array
15: */
16: protected $rows;
17:
18: /**
19: * Argument constructor.
20: *
21: * @param DI $container
22: * @param array $rows
23: */
24: public function __construct(DI $container, array $rows)
25: {
26: $this->di = $container;
27: $this->rows = $rows;
28: }
29:
30: /**
31: * @return array
32: */
33: public function get()
34: {
35: $arguments = [];
36:
37: foreach ($this->rows as $key => $argument)
38: {
39: $arguments[$key] = $argument;
40:
41: if (is_string($argument) && $argument{0} === '@')
42: {
43: $argument = substr($argument, 1);
44:
45: $arguments[$key] = $this->di->call($argument);
46: }
47: }
48:
49: return $arguments;
50: }
51:
52: }