@@ -35,10 +35,10 @@ |
||
| 35 | 35 | ), |
| 36 | 36 | $object->getContent() |
| 37 | 37 | ); |
| 38 | - }else{ |
|
| 38 | + }else { |
|
| 39 | 39 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
| 40 | 40 | } |
| 41 | - }else{ |
|
| 41 | + }else { |
|
| 42 | 42 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
| 43 | 43 | } |
| 44 | 44 | } //put your code here |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * @param Callable|PEIP\INF\Handler\Handler $listener event-handler |
| 27 | 27 | * @return boolean |
| 28 | 28 | */ |
| 29 | - public function connect($name, $object, $listener){
|
|
| 29 | + public function connect($name, $object, $listener) {
|
|
| 30 | 30 | $class = is_object($object) ? get_class($object) : (string)$object; |
| 31 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){
|
|
| 31 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) {
|
|
| 32 | 32 | $reflection = \PEIP\Util\ReflectionPool::getInstance($class); |
| 33 | 33 | parent::connect($name, $reflection, $listener); |
| 34 | 34 | } |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | return true; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function disconnect($name, $object, $listener){
|
|
| 39 | + public function disconnect($name, $object, $listener) {
|
|
| 40 | 40 | $class = is_object($object) ? get_class($object) : (string)$object; |
| 41 | 41 | $res = true; |
| 42 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){
|
|
| 42 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) {
|
|
| 43 | 43 | $reflection = \PEIP\Util\ReflectionPool::getInstance($class); |
| 44 | 44 | $r = parent::disconnect($name, $reflection, $listener); |
| 45 | - if(!$r){
|
|
| 45 | + if (!$r) {
|
|
| 46 | 46 | $res = false; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | ), |
| 70 | 70 | $object |
| 71 | 71 | ); |
| 72 | - }else{
|
|
| 72 | + }else {
|
|
| 73 | 73 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
|
| 74 | 74 | } |
| 75 | - }else{
|
|
| 75 | + }else {
|
|
| 76 | 76 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event');
|
| 77 | 77 | } |
| 78 | 78 | } //put your code here |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | * @return |
| 90 | 90 | * @see EventBuilder |
| 91 | 91 | */ |
| 92 | - public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
|
|
| 93 | - if(!$this->hasListeners($name, ($object))){
|
|
| 92 | + public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) {
|
|
| 93 | + if (!$this->hasListeners($name, ($object))) {
|
|
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -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 | |
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function disconnect($name, \PEIP\INF\Message\MessageHandler $handler); |
| 28 | 28 | |
| 29 | - public function notify( $event); |
|
| 29 | + public function notify($event); |
|
| 30 | 30 | |
| 31 | - public function notifyUntil( $event); |
|
| 31 | + public function notifyUntil($event); |
|
| 32 | 32 | |
| 33 | - public function filter( $event, $value); |
|
| 33 | + public function filter($event, $value); |
|
| 34 | 34 | |
| 35 | 35 | public function hasListeners($name); |
| 36 | 36 | |
@@ -81,8 +81,8 @@ |
||
| 81 | 81 | * @access public |
| 82 | 82 | * @return ArrayAccess ArrayAccess object of headers |
| 83 | 83 | */ |
| 84 | - public function getHeaders(){ |
|
| 85 | - return (array) $this->headers; |
|
| 84 | + public function getHeaders() { |
|
| 85 | + return (array)$this->headers; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $nodeName the name of the node |
| 70 | 70 | * @param callable $callable a callable which creates instances for node-name |
| 71 | 71 | */ |
| 72 | - public function registerNodeBuilder($nodeName, $callable){ |
|
| 72 | + public function registerNodeBuilder($nodeName, $callable) { |
|
| 73 | 73 | $this->nodeBuilders[$nodeName] = $callable; |
| 74 | 74 | } |
| 75 | 75 | /** |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | * @see XMLContext::includeContext |
| 83 | 83 | * @access protected |
| 84 | 84 | */ |
| 85 | - protected function initNodeBuilders(){ |
|
| 85 | + protected function initNodeBuilders() { |
|
| 86 | 86 | $builders = array( |
| 87 | 87 | 'service' => 'initService' |
| 88 | 88 | ); |
| 89 | - foreach($builders as $nodeName => $method){ |
|
| 89 | + foreach ($builders as $nodeName => $method) { |
|
| 90 | 90 | $this->registerNodeBuilder($nodeName, array($this, $method)); |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function addConfig($config){ |
|
| 94 | + public function addConfig($config) { |
|
| 95 | 95 | $this->doFireEvent( |
| 96 | 96 | self::EVENT_BEFORE_ADD_CONFIG, |
| 97 | 97 | array( |
@@ -38,12 +38,12 @@ |
||
| 38 | 38 | * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
| 39 | 39 | * @return mixed result of calling the registered service callable with message content/payload |
| 40 | 40 | */ |
| 41 | - protected function callService(\PEIP\INF\Message\Message $message){ |
|
| 41 | + protected function callService(\PEIP\INF\Message\Message $message) { |
|
| 42 | 42 | $res = NULL; |
| 43 | - if(is_callable($this->serviceCallable)){ |
|
| 43 | + if (is_callable($this->serviceCallable)) { |
|
| 44 | 44 | $res = call_user_func($this->serviceCallable, $message->getHeader($this->headerName)); |
| 45 | - }else{ |
|
| 46 | - if(is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')){ |
|
| 45 | + }else { |
|
| 46 | + if (is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')) { |
|
| 47 | 47 | $res = $this->serviceCallable->handle($message->getHeader($this->headerName)); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -58,9 +58,9 @@ |
||
| 58 | 58 | * @param mixed $subject subject to notify the listeners of |
| 59 | 59 | * @return \PEIP\INF\Handler\Handler listener that returned a boolean true value |
| 60 | 60 | */ |
| 61 | - protected static function doNotifyUntil(array $listeners, $subject){ |
|
| 62 | - foreach ($listeners as $listener){ |
|
| 63 | - if (self::doNotifyOne($listener, $subject)){ |
|
| 61 | + protected static function doNotifyUntil(array $listeners, $subject) { |
|
| 62 | + foreach ($listeners as $listener) { |
|
| 63 | + if (self::doNotifyOne($listener, $subject)) { |
|
| 64 | 64 | return $listener; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect |
| 45 | 45 | * @return |
| 46 | 46 | */ |
| 47 | - public function connect($name, $listener){ |
|
| 47 | + public function connect($name, $listener) { |
|
| 48 | 48 | Test::ensureHandler($listener); |
| 49 | - if (!$this->hasListeners($name)){ |
|
| 49 | + if (!$this->hasListeners($name)) { |
|
| 50 | 50 | $this->listeners[$name] = array(); |
| 51 | 51 | } |
| 52 | 52 | $this->listeners[$name][] = $listener; |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | * @param Callable|PEIP\INF\Handler\Handler $listener listener to connect |
| 62 | 62 | * @return |
| 63 | 63 | */ |
| 64 | - public function disconnect($name, $listener){ |
|
| 65 | - if (!$this->hasListeners($name)){ |
|
| 64 | + public function disconnect($name, $listener) { |
|
| 65 | + if (!$this->hasListeners($name)) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | $res = false; |
| 69 | - foreach ($this->listeners[$name] as $i => $callable){ |
|
| 70 | - if ($listener === $callable){ |
|
| 69 | + foreach ($this->listeners[$name] as $i => $callable) { |
|
| 70 | + if ($listener === $callable) { |
|
| 71 | 71 | unset($this->listeners[$name][$i]); |
| 72 | 72 | $res = true; |
| 73 | 73 | } |