@@ -23,14 +23,14 @@ |
||
23 | 23 | |
24 | 24 | interface Event extends \PEIP\INF\Message\Message { |
25 | 25 | |
26 | - public function getName(); |
|
26 | + public function getName(); |
|
27 | 27 | |
28 | - public function setReturnValue($value); |
|
28 | + public function setReturnValue($value); |
|
29 | 29 | |
30 | - public function getReturnValue(); |
|
30 | + public function getReturnValue(); |
|
31 | 31 | |
32 | - public function setProcessed($processed); |
|
32 | + public function setProcessed($processed); |
|
33 | 33 | |
34 | - public function isProcessed(); |
|
34 | + public function isProcessed(); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -25,11 +25,11 @@ |
||
25 | 25 | interface EventDispatcher |
26 | 26 | extends \PEIP\INF\Event\Connectable { |
27 | 27 | |
28 | - public function notify($subject); |
|
28 | + public function notify($subject); |
|
29 | 29 | |
30 | - public function notifyUntil($subject); |
|
30 | + public function notifyUntil($subject); |
|
31 | 31 | |
32 | - public function filter($subject); |
|
32 | + public function filter($subject); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -25,13 +25,13 @@ |
||
25 | 25 | extends \PEIP\INF\Event\Connectable { |
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * Notifies all listeners of a given event. |
|
30 | - * |
|
31 | - * @param $event A instance |
|
32 | - * |
|
33 | - * @return The instance |
|
34 | - */ |
|
28 | + /** |
|
29 | + * Notifies all listeners of a given event. |
|
30 | + * |
|
31 | + * @param $event A instance |
|
32 | + * |
|
33 | + * @return The instance |
|
34 | + */ |
|
35 | 35 | public function notify($name, $subject); |
36 | 36 | |
37 | 37 |
@@ -24,12 +24,12 @@ |
||
24 | 24 | |
25 | 25 | interface ListDispatcher extends \PEIP\INF\Dispatcher\Dispatcher { |
26 | 26 | |
27 | - public function connect( $handler); |
|
27 | + public function connect( $handler); |
|
28 | 28 | |
29 | - public function disconnect( $handler); |
|
29 | + public function disconnect( $handler); |
|
30 | 30 | |
31 | - public function hasListeners(); |
|
31 | + public function hasListeners(); |
|
32 | 32 | |
33 | - public function getListeners(); |
|
33 | + public function getListeners(); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -24,9 +24,9 @@ |
||
24 | 24 | |
25 | 25 | interface ListDispatcher extends \PEIP\INF\Dispatcher\Dispatcher { |
26 | 26 | |
27 | - public function connect( $handler); |
|
27 | + public function connect($handler); |
|
28 | 28 | |
29 | - public function disconnect( $handler); |
|
29 | + public function disconnect($handler); |
|
30 | 30 | |
31 | 31 | public function hasListeners(); |
32 | 32 |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | * @param $outputChannel |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL){ |
|
36 | + public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL) { |
|
37 | 37 | $this->setEventName('preSend'); |
38 | 38 | $this->setInputChannel($inputChannel); |
39 | - if(is_object($outputChannel)){ |
|
39 | + if (is_object($outputChannel)) { |
|
40 | 40 | $this->setOutputChannel($outputChannel); |
41 | 41 | } |
42 | 42 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param $message |
48 | 48 | * @return |
49 | 49 | */ |
50 | - protected function doReply(\PEIP\INF\Message\Message $message){ |
|
50 | + protected function doReply(\PEIP\INF\Message\Message $message) { |
|
51 | 51 | $this->replyMessage($message->getHeader('MESSAGE')); |
52 | 52 | } |
53 | 53 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param callable $callable the callable to wrap with the handler |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function __construct($callable){ |
|
36 | + public function __construct($callable) { |
|
37 | 37 | $this->callable = $callable; |
38 | 38 | } |
39 | 39 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param mixed $subject the subject to handle |
46 | 46 | * @return mixed result of calling the registered callable with given subject |
47 | 47 | */ |
48 | - public function handle($subject){ |
|
48 | + public function handle($subject) { |
|
49 | 49 | return call_user_func($this->callable, $subject); |
50 | 50 | } |
51 | 51 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return mixed result of calling the registered callable with given subject |
59 | 59 | * @see CallableHandler::handle |
60 | 60 | */ |
61 | - public function __invoke($subject){ |
|
61 | + public function __invoke($subject) { |
|
62 | 62 | return $this->handle($subject); |
63 | 63 | } |
64 | 64 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @access public |
69 | 69 | * @return callable callable wrapped by the handler |
70 | 70 | */ |
71 | - public function getCallable(){ |
|
71 | + public function getCallable() { |
|
72 | 72 | return $this->callable; |
73 | 73 | } |
74 | 74 |
@@ -49,10 +49,10 @@ |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * @access public |
|
53 | - * @param $observer |
|
54 | - * @return |
|
55 | - */ |
|
52 | + * @access public |
|
53 | + * @param $observer |
|
54 | + * @return |
|
55 | + */ |
|
56 | 56 | public function addObserver(\PEIP\INF\Event\Observer $observer){ |
57 | 57 | $this->observers[] = $observer; |
58 | 58 | } |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @param $observedObject |
37 | 37 | * @return |
38 | 38 | */ |
39 | - public function __construct($observedObject){ |
|
39 | + public function __construct($observedObject) { |
|
40 | 40 | $this->setObserved($observedObject); |
41 | 41 | } |
42 | 42 | |
43 | - protected function setObserved($observedObject){ |
|
44 | - if(!is_object($observedObject)){ |
|
43 | + protected function setObserved($observedObject) { |
|
44 | + if (!is_object($observedObject)) { |
|
45 | 45 | throw new \InvalidArgumentException("$observedObject must be an object. ".gettype($var)." given."); |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param $observer |
54 | 54 | * @return |
55 | 55 | */ |
56 | - public function addObserver(\PEIP\INF\Event\Observer $observer){ |
|
56 | + public function addObserver(\PEIP\INF\Event\Observer $observer) { |
|
57 | 57 | $this->observers[] = $observer; |
58 | 58 | } |
59 | 59 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param $observer |
64 | 64 | * @return |
65 | 65 | */ |
66 | - public function deleteObserver(\PEIP\INF\Event\Observer $observer){ |
|
67 | - foreach($this->observers as $key=>$obs){ |
|
68 | - if($obs == $observer){ |
|
66 | + public function deleteObserver(\PEIP\INF\Event\Observer $observer) { |
|
67 | + foreach ($this->observers as $key=>$obs) { |
|
68 | + if ($obs == $observer) { |
|
69 | 69 | unset($this->observers[$key]); |
70 | 70 | return true; |
71 | 71 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @param $arguments |
79 | 79 | * @return |
80 | 80 | */ |
81 | - public function notifyObservers(array $arguments = array()){ |
|
82 | - if($this->hasChanged()){ |
|
83 | - foreach($this->observers as $observer){ |
|
81 | + public function notifyObservers(array $arguments = array()) { |
|
82 | + if ($this->hasChanged()) { |
|
83 | + foreach ($this->observers as $observer) { |
|
84 | 84 | $observer->update($this->observedObject); |
85 | 85 | } |
86 | 86 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @access public |
92 | 92 | * @return |
93 | 93 | */ |
94 | - public function countObservers(){ |
|
94 | + public function countObservers() { |
|
95 | 95 | return count($this->obeservers); |
96 | 96 | } |
97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @access public |
101 | 101 | * @return |
102 | 102 | */ |
103 | - public function hasChanged(){ |
|
103 | + public function hasChanged() { |
|
104 | 104 | return $this->hasChanged(); |
105 | 105 | } |
106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @access public |
110 | 110 | * @return |
111 | 111 | */ |
112 | - public function setChanged(){ |
|
112 | + public function setChanged() { |
|
113 | 113 | $this->hasChanged = true; |
114 | 114 | } |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @access public |
119 | 119 | * @return |
120 | 120 | */ |
121 | - public function clearChanged(){ |
|
121 | + public function clearChanged() { |
|
122 | 122 | $this->hasChanged = true; |
123 | 123 | } |
124 | 124 |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * @param mixed array|ArrayAccess array with values to iterate over |
42 | 42 | * @return |
43 | 43 | */ |
44 | - public function __construct($array = array()){ |
|
44 | + public function __construct($array = array()) { |
|
45 | 45 | $this->init($array); |
46 | 46 | } |
47 | 47 | |
48 | - protected function init($array = array()){ |
|
48 | + protected function init($array = array()) { |
|
49 | 49 | $array = Test::assertArrayAccess($array) |
50 | 50 | ? $array |
51 | 51 | : array(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param mixed $listener the listener to register |
60 | 60 | * @return |
61 | 61 | */ |
62 | - public function connect($listener){ |
|
62 | + public function connect($listener) { |
|
63 | 63 | $this->listeners[] = $listener; |
64 | 64 | } |
65 | 65 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @param mixed $listener the listener to unregister |
71 | 71 | * @return |
72 | 72 | */ |
73 | - public function disconnect($listener){ |
|
74 | - foreach ($this->listeners as $i => $callable){ |
|
75 | - if ($listener === $callable){ |
|
73 | + public function disconnect($listener) { |
|
74 | + foreach ($this->listeners as $i => $callable) { |
|
75 | + if ($listener === $callable) { |
|
76 | 76 | unset($this->listeners[$i]); |
77 | 77 | } |
78 | 78 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @access public |
86 | 86 | * @return |
87 | 87 | */ |
88 | - public function disconnectAll(){ |
|
88 | + public function disconnectAll() { |
|
89 | 89 | $this->init(); |
90 | 90 | } |
91 | 91 | |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | * @access public |
96 | 96 | * @return boolean wether any listener is registered |
97 | 97 | */ |
98 | - public function hasListeners(){ |
|
99 | - return (boolean) $this->listeners->count(); |
|
98 | + public function hasListeners() { |
|
99 | + return (boolean)$this->listeners->count(); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * @param mixed $subject the subject to notify about |
109 | 109 | * @return |
110 | 110 | */ |
111 | - public function notify($subject){ |
|
111 | + public function notify($subject) { |
|
112 | 112 | $res = NULL; |
113 | - if($this->hasListeners()){ |
|
114 | - if(!$this->listeners->valid()){ |
|
113 | + if ($this->hasListeners()) { |
|
114 | + if (!$this->listeners->valid()) { |
|
115 | 115 | $this->listeners->rewind(); |
116 | 116 | } |
117 | 117 | $res = self::doNotifyOne($this->listeners->current(), $subject); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @access public |
127 | 127 | * @return array registered listeners |
128 | 128 | */ |
129 | - public function getListeners(){ |
|
129 | + public function getListeners() { |
|
130 | 130 | return $this->listeners->getArrayCopy(); |
131 | 131 | } |
132 | 132 |
@@ -22,11 +22,11 @@ |
||
22 | 22 | * @param $argument |
23 | 23 | * @return ReflectionClass |
24 | 24 | */ |
25 | - public static function getInstance($argument){ |
|
25 | + public static function getInstance($argument) { |
|
26 | 26 | |
27 | 27 | $className = is_object($argument) |
28 | 28 | ? get_class($argument) |
29 | - : (string) $argument; |
|
29 | + : (string)$argument; |
|
30 | 30 | return isset(self::$instances[$className]) |
31 | 31 | ? self::$instances[$className] |
32 | 32 | : self::$instances[$className] = new \ReflectionClass($className); |