@@ -33,12 +33,12 @@ |
||
33 | 33 | * @param $outputChannel |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){ |
|
36 | + public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) { |
|
37 | 37 | $this->serviceCallable = $serviceCallable; |
38 | - if(is_object($inputChannel)){ |
|
38 | + if (is_object($inputChannel)) { |
|
39 | 39 | $this->setInputChannel($inputChannel); |
40 | 40 | } |
41 | - if(is_object($outputChannel)){ |
|
41 | + if (is_object($outputChannel)) { |
|
42 | 42 | $this->setOutputChannel($outputChannel); |
43 | 43 | } |
44 | 44 | } |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | |
23 | 23 | class XMLArrayTranslator { |
24 | 24 | |
25 | - public static function translate($content){ |
|
25 | + public static function translate($content) { |
|
26 | 26 | $array = array(); |
27 | 27 | try { |
28 | 28 | $node = simplexml_load_string($content); |
29 | 29 | } |
30 | - catch(\Exception $e){ |
|
30 | + catch (\Exception $e) { |
|
31 | 31 | return false; |
32 | 32 | } |
33 | 33 | |
34 | 34 | return self::doTranslate($node); |
35 | 35 | } |
36 | 36 | |
37 | - protected static function doTranslate(\SimpleXMLElement $node){ |
|
37 | + protected static function doTranslate(\SimpleXMLElement $node) { |
|
38 | 38 | |
39 | 39 | $array = array(); |
40 | 40 | $array['type'] = $node['type'] |
41 | 41 | ? (string)$node['type'] |
42 | 42 | : (string)$node->getName(); |
43 | 43 | $value = (string)$node; |
44 | - if($value != ''){ |
|
44 | + if ($value != '') { |
|
45 | 45 | $array['value'] = $value; |
46 | 46 | } |
47 | 47 | |
48 | - foreach($node->attributes() as $name=>$value){ |
|
48 | + foreach ($node->attributes() as $name=>$value) { |
|
49 | 49 | $array[$name] = (string)$value; |
50 | 50 | } |
51 | - foreach($node->children() as $nr=>$child){ |
|
51 | + foreach ($node->children() as $nr=>$child) { |
|
52 | 52 | $name = $child->getName(); |
53 | 53 | $res = self::doTranslate($child); |
54 | 54 | |
55 | - if(isset($array[$name])){ |
|
56 | - if(is_string($array[$name])){ |
|
55 | + if (isset($array[$name])) { |
|
56 | + if (is_string($array[$name])) { |
|
57 | 57 | $array[$name] = array( |
58 | 58 | array( |
59 | 59 | 'type'=>$name, |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | } |
64 | - }else{ |
|
64 | + }else { |
|
65 | 65 | $array[$name] = array(); |
66 | 66 | } |
67 | 67 | $array[$name][] = $res; |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | $array = array(); |
27 | 27 | try { |
28 | 28 | $node = simplexml_load_string($content); |
29 | - } |
|
30 | - catch(\Exception $e){ |
|
29 | + } catch(\Exception $e){ |
|
31 | 30 | return false; |
32 | 31 | } |
33 | 32 | |
@@ -61,7 +60,7 @@ discard block |
||
61 | 60 | ) |
62 | 61 | ); |
63 | 62 | } |
64 | - }else{ |
|
63 | + } else{ |
|
65 | 64 | $array[$name] = array(); |
66 | 65 | } |
67 | 66 | $array[$name][] = $res; |
@@ -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 |
@@ -20,4 +20,4 @@ |
||
20 | 20 | |
21 | 21 | |
22 | 22 | class ObjectStorage |
23 | - extends \SplObjectStorage{} |
|
23 | + extends \SplObjectStorage {} |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param $subject |
37 | 37 | * @return |
38 | 38 | */ |
39 | - public function __construct(\ArrayAccess $methodMap, $subject){ |
|
39 | + public function __construct(\ArrayAccess $methodMap, $subject) { |
|
40 | 40 | $this->methodMap = $methodMap; |
41 | 41 | $this->subject = $subject; |
42 | 42 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param $arguments |
49 | 49 | * @return |
50 | 50 | */ |
51 | - public function __call($method, array $arguments){ |
|
52 | - if(array_key_exists($method, $this->methodMap)){ |
|
51 | + public function __call($method, array $arguments) { |
|
52 | + if (array_key_exists($method, $this->methodMap)) { |
|
53 | 53 | return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments); |
54 | 54 | } |
55 | 55 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | class VisitableArray |
26 | 26 | extends \RecursiveArrayIterator |
27 | - implements \PEIP\INF\Base\Visitable{ |
|
27 | + implements \PEIP\INF\Base\Visitable { |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @param $visitor |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function acceptVisitor(\PEIP\INF\Base\Visitor $visitor){ |
|
37 | - if($this->hasChildren()){ |
|
38 | - foreach($this->getChildren as $child){ |
|
36 | + public function acceptVisitor(\PEIP\INF\Base\Visitor $visitor) { |
|
37 | + if ($this->hasChildren()) { |
|
38 | + foreach ($this->getChildren as $child) { |
|
39 | 39 | $child->acceptVisitor($visitor); |
40 | 40 | } |
41 | 41 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param string $className name of the class to return ReflectionClass for |
33 | 33 | * @return ReflectionClass the ReflectionClass instance for given class |
34 | 34 | */ |
35 | - protected static function getReflectionClass($className){ |
|
35 | + protected static function getReflectionClass($className) { |
|
36 | 36 | return array_key_exists($className, self::$reflectionClasses) |
37 | 37 | ? self::$reflectionClasses[$className] |
38 | 38 | : (self::$reflectionClasses[$className] = new \ReflectionClass($className)); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param string $className name of the class to return ReflectionClass for |
48 | 48 | * @return ReflectionClass the ReflectionClass instance for given class |
49 | 49 | */ |
50 | - public static function getInstance($className){ |
|
50 | + public static function getInstance($className) { |
|
51 | 51 | return self::getReflectionClass($className); |
52 | 52 | } |
53 | 53 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param $methodMap |
31 | 31 | * @return |
32 | 32 | */ |
33 | - public function __construct(ArrayAccess $methodMap){ |
|
33 | + public function __construct(ArrayAccess $methodMap) { |
|
34 | 34 | $this->methodMap = $methodMap; |
35 | 35 | } |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param $subject |
41 | 41 | * @return |
42 | 42 | */ |
43 | - public function setSubject($subject){ |
|
43 | + public function setSubject($subject) { |
|
44 | 44 | $this->subject = $subject; |
45 | 45 | return $this; |
46 | 46 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param $arguments |
53 | 53 | * @return |
54 | 54 | */ |
55 | - public function __call($method, $arguments){ |
|
56 | - if(array_key_exists($method, $this->methodMap)){ |
|
55 | + public function __call($method, $arguments) { |
|
56 | + if (array_key_exists($method, $this->methodMap)) { |
|
57 | 57 | return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments); |
58 | 58 | } |
59 | 59 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param ObjectStorage $store an instane of ObjectStorage to act as the internal object-store |
39 | 39 | * @return |
40 | 40 | */ |
41 | - public function __construct(\SplObjectStorage $store = NULL){ |
|
41 | + public function __construct(\SplObjectStorage $store = NULL) { |
|
42 | 42 | $this->store = (bool)$store ? $store : new ObjectStorage; |
43 | 43 | } |
44 | 44 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param object $box an object to act as the 'box' |
54 | 54 | * @return object the 'box' for the sealed value |
55 | 55 | */ |
56 | - public function seal($value, $box = false){ |
|
56 | + public function seal($value, $box = false) { |
|
57 | 57 | $box = (bool)$box ? $box : new \stdClass; |
58 | 58 | $this->store[$box] = $value; |
59 | 59 | return $box; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param object $box the box-object to return the value for. |
67 | 67 | * @return |
68 | 68 | */ |
69 | - public function unseal($box){ |
|
69 | + public function unseal($box) { |
|
70 | 70 | return $this->store[$box]; |
71 | 71 | } |
72 | 72 | } |