@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | class ServiceContainer |
| 28 | 28 | extends \PEIP\ABS\Base\Connectable |
| 29 | 29 | implements |
| 30 | - \PEIP\INF\Service\ServiceContainer{ |
|
| 30 | + \PEIP\INF\Service\ServiceContainer { |
|
| 31 | 31 | |
| 32 | 32 | protected $services = array(); |
| 33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param $service |
| 46 | 46 | * @return |
| 47 | 47 | */ |
| 48 | - public function setService($key, $service){ |
|
| 48 | + public function setService($key, $service) { |
|
| 49 | 49 | $this->services[$key] = $service; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param $key |
| 56 | 56 | * @return |
| 57 | 57 | */ |
| 58 | - public function getService($key){ |
|
| 58 | + public function getService($key) { |
|
| 59 | 59 | return $this->services[$key]; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param $key |
| 66 | 66 | * @return |
| 67 | 67 | */ |
| 68 | - public function hasService($key){ |
|
| 68 | + public function hasService($key) { |
|
| 69 | 69 | return array_key_exists($key, $this->services); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param $key |
| 76 | 76 | * @return |
| 77 | 77 | */ |
| 78 | - public function deleteService($key){ |
|
| 78 | + public function deleteService($key) { |
|
| 79 | 79 | unset($this->services[$key]); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @author timo |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class HeaderServiceActivator extends \PEIP\Service\ServiceActivator{ |
|
| 15 | +class HeaderServiceActivator extends \PEIP\Service\ServiceActivator { |
|
| 16 | 16 | |
| 17 | 17 | protected $headerName; |
| 18 | 18 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param $outputChannel |
| 25 | 25 | * @return |
| 26 | 26 | */ |
| 27 | - public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){ |
|
| 27 | + public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) { |
|
| 28 | 28 | $this->headerName = $headerName; |
| 29 | 29 | parent::__construct($serviceCallable, $inputChannel, $outputChannel); |
| 30 | 30 | } |
@@ -38,12 +38,12 @@ discard block |
||
| 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 | } |
@@ -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 | |
@@ -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 | |
@@ -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 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param string $name the name of the event |
| 52 | 52 | * @param array|ArrayAccess $headers the headers for the event |
| 53 | 53 | */ |
| 54 | - public function __construct($subject, $name, $parameters = array(), $type = false){ |
|
| 54 | + public function __construct($subject, $name, $parameters = array(), $type = false) { |
|
| 55 | 55 | parent::__construct($subject, Test::ensureArrayAccess($parameters)); |
| 56 | 56 | $this->name = $name; |
| 57 | 57 | $this->type = $type ? $type : get_class($this); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @access public |
| 64 | 64 | * @return string the name of the event |
| 65 | 65 | */ |
| 66 | - public function getName(){ |
|
| 66 | + public function getName() { |
|
| 67 | 67 | return $this->name; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @access public |
| 75 | 75 | * @return string the type of the event |
| 76 | 76 | */ |
| 77 | - public function getType(){ |
|
| 77 | + public function getType() { |
|
| 78 | 78 | return $this->name; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @access public |
| 85 | 85 | * @param mixed $value the return-value to set |
| 86 | 86 | */ |
| 87 | - public function setReturnValue($value){ |
|
| 87 | + public function setReturnValue($value) { |
|
| 88 | 88 | $this->value = $value; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @access public |
| 95 | 95 | * @return mixed the return-value to set |
| 96 | 96 | */ |
| 97 | - public function getReturnValue(){ |
|
| 97 | + public function getReturnValue() { |
|
| 98 | 98 | return $this->value; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * @access public |
| 105 | 105 | * @param boolean $processed |
| 106 | 106 | */ |
| 107 | - public function setProcessed($processed){ |
|
| 108 | - $this->processed = (boolean) $processed; |
|
| 107 | + public function setProcessed($processed) { |
|
| 108 | + $this->processed = (boolean)$processed; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @access public |
| 115 | 115 | * @return boolean wether the event is processed |
| 116 | 116 | */ |
| 117 | - public function isProcessed(){ |
|
| 117 | + public function isProcessed() { |
|
| 118 | 118 | return $this->processed; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @access public |
| 125 | 125 | * @return mixed the subject/content |
| 126 | 126 | */ |
| 127 | - public function getSubject(){ |
|
| 127 | + public function getSubject() { |
|
| 128 | 128 | return $this->getContent(); |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | * @param \PEIP\INF\Event\Event $object an event object |
| 26 | 26 | * @return boolean |
| 27 | 27 | */ |
| 28 | - public function notify($name, $object){ |
|
| 29 | - if($object instanceof \PEIP\INF\Event\Event){ |
|
| 30 | - if(is_object($object->getContent())){ |
|
| 28 | + public function notify($name, $object) { |
|
| 29 | + if ($object instanceof \PEIP\INF\Event\Event) { |
|
| 30 | + if (is_object($object->getContent())) { |
|
| 31 | 31 | return self::doNotify( |
| 32 | 32 | $this->getListeners( |
| 33 | 33 | $name, |
@@ -35,10 +35,10 @@ discard block |
||
| 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 |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * @return |
| 56 | 56 | * @see EventBuilder |
| 57 | 57 | */ |
| 58 | - public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){ |
|
| 59 | - if(!$this->hasListeners($name, ($object))){ |
|
| 58 | + public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) { |
|
| 59 | + if (!$this->hasListeners($name, ($object))) { |
|
| 60 | 60 | return false; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param object $object object to check for listeners |
| 80 | 80 | * @return boolean |
| 81 | 81 | */ |
| 82 | - public function hasListeners($name, $object){ |
|
| 82 | + public function hasListeners($name, $object) { |
|
| 83 | 83 | return parent::hasListeners( |
| 84 | 84 | $name, |
| 85 | 85 | ReflectionPool::getInstance($object) |