1: <?php
2:
3: namespace TokenReflection\Invalid;
4:
5: use TokenReflection\Exception\BaseException;
6:
7: /**
8: * Invalid element reflection.
9: *
10: * The reflected element is not unique (by its fully qualified name).
11: */
12: abstract class ReflectionElement
13: {
14: /**
15: * Reasons why this element's reflection is invalid.
16: *
17: * @var array
18: */
19: private $reasons = array();
20:
21: /**
22: * Adds a reason why this element's reflection is invalid.
23: *
24: * @param \TokenReflection\Exception\BaseException $reason Reason
25: * @return \TokenReflection\Invalid\ReflectionElement
26: */
27: public function addReason(BaseException $reason)
28: {
29: $this->reasons[] = $reason;
30:
31: return $this;
32: }
33:
34: /**
35: * Returns a list of reasons why this element's reflection is invalid.
36: *
37: * @return array
38: */
39: public function getReasons()
40: {
41: return $this->reasons;
42: }
43:
44: /**
45: * Returns if there are any known reasons why this element's reflection is invalid.
46: *
47: * @return boolean
48: */
49: public function hasReasons()
50: {
51: return !empty($this->reasons);
52: }
53: }
54: