1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\DI;
9:
10: use Nette;
11:
12:
13: /**
14: * Assignment or calling statement.
15: */
16: class Statement extends Nette\Object
17: {
18: /** @var string|array|ServiceDefinition|NULL class|method|$property */
19: private $entity;
20:
21: /** @var array */
22: public $arguments;
23:
24:
25: /**
26: * @param string|array|ServiceDefinition|NULL
27: */
28: public function __construct($entity, array $arguments = array())
29: {
30: $this->setEntity($entity);
31: $this->arguments = $arguments;
32: }
33:
34:
35: /**
36: * @param string|array|ServiceDefinition|NULL
37: * @return static
38: */
39: public function setEntity($entity)
40: {
41: if (!is_string($entity) && !(is_array($entity) && isset($entity[0], $entity[1]))
42: && !$entity instanceof ServiceDefinition && $entity !== NULL
43: ) {
44: throw new Nette\InvalidArgumentException('Argument is not valid Statement entity.');
45: }
46: $this->entity = $entity;
47: return $this;
48: }
49:
50:
51: public function getEntity()
52: {
53: return $this->entity;
54: }
55:
56: }
57: