Completed
Push — v1.ns ( a6bb16...dc5273 )
by Timo
03:36
created
src/Message/CallableMessageHandler.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param $callable 
36 36
      * @return 
37 37
      */
38
-    public function __construct($callable){
38
+    public function __construct($callable) {
39 39
         $this->callable = $callable;    
40 40
         $this->examineCallabe();
41 41
     }
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
      * @access protected
46 46
      * @return 
47 47
      */
48
-    protected function examineCallabe(){
49
-        if(is_callable($this->callable)){        
50
-            if(is_array($this->callable)){
51
-                list($class, $method) =  $this->callable;
48
+    protected function examineCallabe() {
49
+        if (is_callable($this->callable)) {        
50
+            if (is_array($this->callable)) {
51
+                list($class, $method) = $this->callable;
52 52
                 $static = !is_object($class);
53 53
                 $class = is_object($class) ? get_class($class) : (string)$class;
54 54
                 $reflectionClass = new \ReflectionClass($class);
55 55
                 $reflectionFunc = $reflectionClass->getMethod($method);
56
-                if($static && !$reflectionFunc->isStatic()){
56
+                if ($static && !$reflectionFunc->isStatic()) {
57 57
                     throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not an Callable: Method "'.$method.'" of class '.$class.' is not static.');                  
58 58
                 }
59
-            }else{
59
+            }else {
60 60
                 $reflectionFunc = new \ReflectionFunction($this->callable);  
61 61
             }
62 62
             $this->requiredParameters = $reflectionFunc->getNumberOfRequiredParameters();
63
-        }else{
63
+        }else {
64 64
             throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not a Callable');
65 65
         }   
66 66
     }   
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
      * @param $sent 
74 74
      * @return 
75 75
      */
76
-    public function handle($message, $channel = false, $sent = false){
77
-        if(!is_object($message)){
76
+    public function handle($message, $channel = false, $sent = false) {
77
+        if (!is_object($message)) {
78 78
             throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::handle is not a Object');       
79 79
         }   
80 80
         try {
81 81
             return call_user_func_array($this->callable, array($message, $channel, $sent));
82 82
         }
83
-        catch(\Exception $e){
83
+        catch (\Exception $e) {
84 84
             throw new \RuntimeException('Unable to call Callable: '.$e->getMessage());
85 85
         }   
86 86
     }   
Please login to merge, or discard this patch.
Braces   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
                 if($static && !$reflectionFunc->isStatic()){
57 57
                     throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not an Callable: Method "'.$method.'" of class '.$class.' is not static.');                  
58 58
                 }
59
-            }else{
59
+            } else{
60 60
                 $reflectionFunc = new \ReflectionFunction($this->callable);  
61 61
             }
62 62
             $this->requiredParameters = $reflectionFunc->getNumberOfRequiredParameters();
63
-        }else{
63
+        } else{
64 64
             throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not a Callable');
65 65
         }   
66 66
     }   
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
         }   
80 80
         try {
81 81
             return call_user_func_array($this->callable, array($message, $channel, $sent));
82
-        }
83
-        catch(\Exception $e){
82
+        } catch(\Exception $e){
84 83
             throw new \RuntimeException('Unable to call Callable: '.$e->getMessage());
85 84
         }   
86 85
     }   
Please login to merge, or discard this patch.
src/Message/StringMessage.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 
28 28
     const CONTENT_CAST_TYPE = 'string';
29 29
 
30
-    public function __toString(){
30
+    public function __toString() {
31 31
         return (string)$this->getContent();
32 32
     }
33 33
 
34
-    public function getContent(){
34
+    public function getContent() {
35 35
         return (string)parent::getContent();
36 36
     }
37 37
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param string $name the name of the header
46 46
      * @return boolean wether the header is set
47 47
      */     
48
-    public static function build(array $arguments = array()){
48
+    public static function build(array $arguments = array()) {
49 49
         return GenericBuilder::getInstance(__CLASS__)->build($arguments);
50 50
     }
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,6 @@
 block discarded – undo
64 64
      * @static
65 65
      * @access public
66 66
      * @implements \PEIP\INF\Base\Buildable
67
-     * @param string $name the name of the header
68 67
      * @return boolean wether the header is set
69 68
      */
70 69
     public static function build(array $arguments = array()){
Please login to merge, or discard this patch.
src/Message/ErrorMessage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
      * @param $headers 
37 37
      * @return 
38 38
      */
39
-    public function __construct(\Exception $payload, array $headers = array()){
39
+    public function __construct(\Exception $payload, array $headers = array()) {
40 40
         $this->payload = $payload;
41 41
         $this->headers = $headers;
42 42
     }
Please login to merge, or discard this patch.
src/Channel/QueueChannel.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param $capacity 
38 38
      * @return 
39 39
      */
40
-    public function __construct($capacity = -1){
40
+    public function __construct($capacity = -1) {
41 41
         $this->setCapacity((int)$capacity);
42 42
         $this->queue = new SplQueue();  
43 43
     }   
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @access public
48 48
      * @return 
49 49
      */
50
-    public function getMessageCount(){
50
+    public function getMessageCount() {
51 51
         return count($this->messages);
52 52
     }   
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @access public
57 57
      * @return 
58 58
      */
59
-    public function getCapacity(){
59
+    public function getCapacity() {
60 60
         return $this->capacity;
61 61
     }       
62 62
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param $capacity 
67 67
      * @return 
68 68
      */
69
-    public function setCapacity($capacity){
69
+    public function setCapacity($capacity) {
70 70
         $this->capacity = $capacity;
71 71
     }   
72 72
 
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
      * @param $message 
77 77
      * @return 
78 78
      */
79
-    protected function doSend(\PEIP\INF\Message\Message $message){
80
-        if($this->capacity < 1 || $this->getMessageCount() <= $this->getCapacity()){
79
+    protected function doSend(\PEIP\INF\Message\Message $message) {
80
+        if ($this->capacity < 1 || $this->getMessageCount() <= $this->getCapacity()) {
81 81
             $this->queue->enqueque($message);
82
-        }else{
82
+        }else {
83 83
             throw new \Exception('Not implemented yet.');
84 84
         }            
85 85
     }       
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     protected function getMessage($object){
18 18
         if($this->channel instanceof \PEIP\INF\Channel\SubscribableChannel){
19 19
             return $object; 
20
-        }else{
20
+        } else{
21 21
             return $object->getContent()->receive();
22 22
         }
23 23
     }
Please login to merge, or discard this patch.
src/Channel/PriorityChannel.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
      * @param $priorityHeader 
38 38
      * @return 
39 39
      */
40
-    public function __construct($capacity = -1, $priorityHeader = NULL){
40
+    public function __construct($capacity = -1, $priorityHeader = NULL) {
41 41
         $this->setCapacity((int)$capacity);
42 42
         $this->queue = new SplPriorityQueue(); 
43
-        if($priorityHeader){
43
+        if ($priorityHeader) {
44 44
             $this->priorityHeader = $priorityHeader;
45 45
         }
46 46
     }   
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
      * @param $message 
52 52
      * @return 
53 53
      */
54
-    protected function doSend(\PEIP\INF\Message\Message $message){
55
-        if($this->capacity < 1 || $this->getMessageCount() <= $this->getCapacity()){
54
+    protected function doSend(\PEIP\INF\Message\Message $message) {
55
+        if ($this->capacity < 1 || $this->getMessageCount() <= $this->getCapacity()) {
56 56
             $this->queue->insert($message, $message->getHeader($this->priorityHeader));
57
-        }else{
57
+        }else {
58 58
             throw new \Exception('Not implemented yet.');
59 59
         }            
60 60
     }       
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     protected function getMessage($object){
18 18
         if($this->channel instanceof \PEIP\INF\Channel\SubscribableChannel){
19 19
             return $object; 
20
-        }else{
20
+        } else{
21 21
             return $object->getContent()->receive();
22 22
         }
23 23
     }
Please login to merge, or discard this patch.
src/Channel/ChannelRegistry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param $name 
34 34
      * @return 
35 35
      */
36
-    public static function getInstance(){
36
+    public static function getInstance() {
37 37
         return self::$instance ? self::$instance : self::$instance = new ChannelRegistry;
38 38
     }
39 39
     
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @param $channel 
44 44
      * @return 
45 45
      */
46
-    public function register($channel){
46
+    public function register($channel) {
47 47
         $this->channels[$channel->getName()] = $channel;
48 48
     }
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param $name 
56 56
      * @return 
57 57
      */
58
-    public function get($name){
58
+    public function get($name) {
59 59
         return $this->channels[$name];
60 60
     }
61 61
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param $channelName 
66 66
      * @return 
67 67
      */
68
-    public function resolveChannelName($channelName){
68
+    public function resolveChannelName($channelName) {
69 69
         return $this->get($channelName);
70 70
     }   
71 71
     
Please login to merge, or discard this patch.
src/Channel/PollableChannel.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param \PEIP\INF\Message\Message $message the message to send
42 42
      * @return 
43 43
      */
44
-    protected function doSend(\PEIP\INF\Message\Message $message){
44
+    protected function doSend(\PEIP\INF\Message\Message $message) {
45 45
         $this->messages[] = $message;
46 46
         return true;
47 47
     }
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
      * @param integer $timeout timout for receiving a message 
56 56
      * @return 
57 57
      */
58
-    public function receive($timeout = 0){
58
+    public function receive($timeout = 0) {
59 59
         $this->doFireEvent(self::EVENT_PRE_RECEIVE);
60 60
         $message = NULL;
61
-        if($timeout == 0){
61
+        if ($timeout == 0) {
62 62
             $message = $this->getMessage(); 
63
-        }elseif($timeout < 0){
64
-            while(!$message = $this->getMessage()){
63
+        }elseif ($timeout < 0) {
64
+            while (!$message = $this->getMessage()) {
65 65
                                 
66 66
             }
67
-        }else{
67
+        }else {
68 68
             $time = time() + $timeout;
69
-            while(($time > time()) && !$message = $this->getMessage()){
69
+            while (($time > time()) && !$message = $this->getMessage()) {
70 70
                 
71 71
             }       
72 72
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @access protected
85 85
      * @return \PEIP\INF\Message\Message message from top of the message stack
86 86
      */
87
-    protected function getMessage(){
87
+    protected function getMessage() {
88 88
         return array_shift($this->messages);
89 89
     }
90 90
        
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @access public
95 95
      * @return 
96 96
      */
97
-    public function clear(){
97
+    public function clear() {
98 98
         $this->messages = array();
99 99
     }
100 100
         
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
      * @param \PEIP\INF\Message\Message_Selector $selector the selector to accept messages 
106 106
      * @return array accepted messages
107 107
      */
108
-    public function purge(\PEIP\INF\Selector\MessageSelector $selector){
109
-        foreach($this->messages as $key=>$message){
110
-            if(!$selector->acceptMessage($message)){
108
+    public function purge(\PEIP\INF\Selector\MessageSelector $selector) {
109
+        foreach ($this->messages as $key=>$message) {
110
+            if (!$selector->acceptMessage($message)) {
111 111
                 unset($this->messages[$key]);   
112 112
             }
113 113
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@
 block discarded – undo
60 60
         $message = NULL;
61 61
         if($timeout == 0){
62 62
             $message = $this->getMessage(); 
63
-        }elseif($timeout < 0){
63
+        } elseif($timeout < 0){
64 64
             while(!$message = $this->getMessage()){
65 65
                                 
66 66
             }
67
-        }else{
67
+        } else{
68 68
             $time = time() + $timeout;
69 69
             while(($time > time()) && !$message = $this->getMessage()){
70 70
                 
Please login to merge, or discard this patch.
src/Channel/MessageChannel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * @access public
29 29
      * @return 
30 30
      */
31
-    public function getName(){
31
+    public function getName() {
32 32
     
33 33
     }
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param $timeout 
41 41
      * @return 
42 42
      */
43
-    public function send(\PEIP\INF\Message\Message $message, $timeout = -1){
43
+    public function send(\PEIP\INF\Message\Message $message, $timeout = -1) {
44 44
         
45 45
     }
46 46
 
Please login to merge, or discard this patch.
src/Channel/DirectChannel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param $timeout 
37 37
      * @return 
38 38
      */
39
-    public function send(\PEIP\INF\Message\Message $message, $timeout = -1){
39
+    public function send(\PEIP\INF\Message\Message $message, $timeout = -1) {
40 40
 
41 41
         $sent = $this->doSend($message);
42 42
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param $message 
50 50
      * @return 
51 51
      */
52
-    protected function doSend(\PEIP\INF\Message\Message $message){
52
+    protected function doSend(\PEIP\INF\Message\Message $message) {
53 53
         $this->getMessageDispatcher()->notify($message);
54 54
         return true;
55 55
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @access public
60 60
      * @return 
61 61
      */
62
-    public function getMessageDispatcher(){
62
+    public function getMessageDispatcher() {
63 63
         return isset($this->dispatcher) ? $this->dispatcher : $this->dispatcher = new IteratingDispatcher;
64 64
     }   
65 65
     
Please login to merge, or discard this patch.