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