@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param $discardChannel |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function setDiscardChannel(\PEIP\INF\Channel\Channel $discardChannel){ |
|
36 | + public function setDiscardChannel(\PEIP\INF\Channel\Channel $discardChannel) { |
|
37 | 37 | $this->discardChannel = $discardChannel; |
38 | 38 | } |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @access public |
43 | 43 | * @return |
44 | 44 | */ |
45 | - public function getDiscardChannel(){ |
|
45 | + public function getDiscardChannel() { |
|
46 | 46 | return $this->discardChannel; |
47 | 47 | } |
48 | 48 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param $message |
53 | 53 | * @return |
54 | 54 | */ |
55 | - protected function discardMessage(\PEIP\INF\Message\Message $message){ |
|
56 | - if(isset($this->discardChannel)){ |
|
55 | + protected function discardMessage(\PEIP\INF\Message\Message $message) { |
|
56 | + if (isset($this->discardChannel)) { |
|
57 | 57 | $this->discardChannel->send($message); |
58 | 58 | } |
59 | 59 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * @param \PEIP\INF\Message\Message $message message to handle/reply for |
39 | 39 | * @return |
40 | 40 | */ |
41 | - public function doReply(\PEIP\INF\Message\Message $message){ |
|
41 | + public function doReply(\PEIP\INF\Message\Message $message) { |
|
42 | 42 | $res = $this->callService($message); |
43 | 43 | $out = (bool)$message->hasHeader('REPLY_CHANNEL') |
44 | 44 | ? $message->getHeader('REPLY_CHANNEL') |
45 | 45 | : $this->outputChannel; |
46 | - if($out){ |
|
46 | + if ($out) { |
|
47 | 47 | $this->replyMessage($res, $res); |
48 | 48 | } |
49 | 49 | } |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
57 | 57 | * @return mixed result of calling the registered service callable with message content/payload |
58 | 58 | */ |
59 | - protected function callService(\PEIP\INF\Message\Message $message){ |
|
59 | + protected function callService(\PEIP\INF\Message\Message $message) { |
|
60 | 60 | $res = NULL; |
61 | - if(is_callable($this->serviceCallable)){ |
|
61 | + if (is_callable($this->serviceCallable)) { |
|
62 | 62 | $res = call_user_func($this->serviceCallable, $message->getContent()); |
63 | - }else{ |
|
64 | - if(is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')){ |
|
63 | + }else { |
|
64 | + if (is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')) { |
|
65 | 65 | $res = $this->serviceCallable->handle($message->getContent()); |
66 | 66 | } |
67 | 67 | } |
@@ -22,43 +22,43 @@ 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 | // fix for hhvm |
30 | - if(!($node instanceof \SimpleXMLElement)){ |
|
30 | + if (!($node instanceof \SimpleXMLElement)) { |
|
31 | 31 | throw new \Exception('loading XML failed'); |
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
35 | - catch(\Exception $e){ |
|
35 | + catch (\Exception $e) { |
|
36 | 36 | return false; |
37 | 37 | } |
38 | 38 | |
39 | 39 | return self::doTranslate($node); |
40 | 40 | } |
41 | 41 | |
42 | - protected static function doTranslate(\SimpleXMLElement $node){ |
|
42 | + protected static function doTranslate(\SimpleXMLElement $node) { |
|
43 | 43 | |
44 | 44 | $array = array(); |
45 | 45 | $array['type'] = $node['type'] |
46 | 46 | ? (string)$node['type'] |
47 | 47 | : (string)$node->getName(); |
48 | 48 | $value = (string)$node; |
49 | - if($value != ''){ |
|
49 | + if ($value != '') { |
|
50 | 50 | $array['value'] = $value; |
51 | 51 | } |
52 | 52 | |
53 | - foreach($node->attributes() as $name=>$value){ |
|
53 | + foreach ($node->attributes() as $name=>$value) { |
|
54 | 54 | $array[$name] = (string)$value; |
55 | 55 | } |
56 | - foreach($node->children() as $nr=>$child){ |
|
56 | + foreach ($node->children() as $nr=>$child) { |
|
57 | 57 | $name = $child->getName(); |
58 | 58 | $res = self::doTranslate($child); |
59 | 59 | |
60 | - if(isset($array[$name])){ |
|
61 | - if(is_string($array[$name])){ |
|
60 | + if (isset($array[$name])) { |
|
61 | + if (is_string($array[$name])) { |
|
62 | 62 | $array[$name] = array( |
63 | 63 | array( |
64 | 64 | 'type'=>$name, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ) |
67 | 67 | ); |
68 | 68 | } |
69 | - }else{ |
|
69 | + }else { |
|
70 | 70 | $array[$name] = array(); |
71 | 71 | } |
72 | 72 | $array[$name][] = $res; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param $name |
65 | 65 | * @return |
66 | 66 | */ |
67 | - public function setName($name){ |
|
67 | + public function setName($name) { |
|
68 | 68 | $this->name = $name; |
69 | 69 | } |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @access public |
74 | 74 | * @return |
75 | 75 | */ |
76 | - public function getName(){ |
|
76 | + public function getName() { |
|
77 | 77 | return $this->name; |
78 | 78 | } |
79 | 79 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param $timeout |
85 | 85 | * @return |
86 | 86 | */ |
87 | - public function send(\PEIP\INF\Message\Message $message, $timeout = -1){ |
|
87 | + public function send(\PEIP\INF\Message\Message $message, $timeout = -1) { |
|
88 | 88 | return $this->handle($message); |
89 | 89 | } |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param $message |
95 | 95 | * @return |
96 | 96 | */ |
97 | - protected function doSend(\PEIP\INF\Message\Message $message){ |
|
97 | + protected function doSend(\PEIP\INF\Message\Message $message) { |
|
98 | 98 | $this->doFireEvent(self::EVENT_PRE_PUBLISH, array(self::HEADER_MESSAGE=>$message)); |
99 | 99 | $this->getMessageDispatcher()->notify($message); |
100 | 100 | $this->doFireEvent(self::EVENT_POST_PUBLISH, array(self::HEADER_MESSAGE=>$message)); |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | * @param $content |
108 | 108 | * @return |
109 | 109 | */ |
110 | - protected function replyMessage($message){ |
|
110 | + protected function replyMessage($message) { |
|
111 | 111 | $message = $this->ensureMessage($message); |
112 | 112 | //if(\PEIP\Util\Test::assertMessage($message)){ |
113 | - if($this->getOutputChannel()){ |
|
113 | + if ($this->getOutputChannel()) { |
|
114 | 114 | $this->getOutputChannel()->send($message); |
115 | - }else{ |
|
115 | + }else { |
|
116 | 116 | $this->doSend($message); |
117 | 117 | } |
118 | 118 | //} |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param $message |
125 | 125 | * @return |
126 | 126 | */ |
127 | - protected function doReply(\PEIP\INF\Message\Message $message){ |
|
127 | + protected function doReply(\PEIP\INF\Message\Message $message) { |
|
128 | 128 | $this->replyMessage($message); |
129 | 129 | } |
130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param $handler |
135 | 135 | * @return |
136 | 136 | */ |
137 | - public function subscribe($handler){ |
|
137 | + public function subscribe($handler) { |
|
138 | 138 | Test::ensureHandler($handler); |
139 | 139 | $this->getMessageDispatcher()->connect($handler); |
140 | 140 | $this->doFireEvent(self::EVENT_SUBSCRIBE, array(self::HEADER_SUBSCRIBER=>$handler)); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param $handler e |
147 | 147 | * @return |
148 | 148 | */ |
149 | - public function unsubscribe($handler){ |
|
149 | + public function unsubscribe($handler) { |
|
150 | 150 | Test::ensureHandler($handler); |
151 | 151 | $this->getMessageDispatcher()->disconnect($handler); |
152 | 152 | $this->doFireEvent( |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @param $transferListeners |
165 | 165 | * @return |
166 | 166 | */ |
167 | - public function setMessageDispatcher(\PEIP\INF\Dispatcher\Dispatcher $dispatcher, $transferListeners = true){ |
|
168 | - if(isset($this->dispatcher) && $transferListeners){ |
|
169 | - foreach($this->dispatcher->getListeners() as $listener){ |
|
167 | + public function setMessageDispatcher(\PEIP\INF\Dispatcher\Dispatcher $dispatcher, $transferListeners = true) { |
|
168 | + if (isset($this->dispatcher) && $transferListeners) { |
|
169 | + foreach ($this->dispatcher->getListeners() as $listener) { |
|
170 | 170 | $dispatcher->connect($listener); |
171 | 171 | $this->dispatcher->disconnect($listener); |
172 | 172 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @access public |
181 | 181 | * @return |
182 | 182 | */ |
183 | - public function getMessageDispatcher(){ |
|
183 | + public function getMessageDispatcher() { |
|
184 | 184 | $defaultDispatcher = self::DEFAULT_CLASS_MESSAGE_DISPATCHER; |
185 | 185 | return isset($this->dispatcher) ? $this->dispatcher : $this->dispatcher = new $defaultDispatcher; |
186 | 186 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param $callable |
193 | 193 | * @return |
194 | 194 | */ |
195 | - protected function registerCommand($commandName, $callable){ |
|
195 | + protected function registerCommand($commandName, $callable) { |
|
196 | 196 | $this->commands[$commandName] = $callable; |
197 | 197 | } |
198 | 198 | |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * @param $cmdMessage |
203 | 203 | * @return |
204 | 204 | */ |
205 | - public function command(\PEIP\INF\Message\Message $cmdMessage){ |
|
205 | + public function command(\PEIP\INF\Message\Message $cmdMessage) { |
|
206 | 206 | $this->doFireEvent(self::EVENT_PRE_COMMAND, array(self::HEADER_MESSAGE=>$cmdMessage)); |
207 | 207 | $commandName = trim((string)$cmdMessage->getHeader('COMMAND')); |
208 | - if($commandName != '' && array_key_exists($commandName, $this->commands)){ |
|
208 | + if ($commandName != '' && array_key_exists($commandName, $this->commands)) { |
|
209 | 209 | call_user_func($this->commands[$commandName], $cmdMessage->getContent()); |
210 | 210 | } |
211 | 211 | $this->doFireEvent(self::EVENT_POST_COMMAND, array(self::HEADER_MESSAGE=>$cmdMessage)); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param string $eventClass the event-class the builder shall create instances for |
38 | 38 | * @param array $defaultHeaders default headers for the created events |
39 | 39 | */ |
40 | - public function __construct($eventClass = '\PEIP\Event\Event', array $defaultHeaders = array()){ |
|
40 | + public function __construct($eventClass = '\PEIP\Event\Event', array $defaultHeaders = array()) { |
|
41 | 41 | $this->eventClass = $eventClass; |
42 | 42 | $this->defaultParameters = $defaultHeaders; |
43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string $eventClass the event-class the builder shall create instances for |
50 | 50 | * @return EventBuilder the instance of EventBuilder for the given event-class |
51 | 51 | */ |
52 | - public static function getInstance($eventClass = '\PEIP\Event\Event'){ |
|
52 | + public static function getInstance($eventClass = '\PEIP\Event\Event') { |
|
53 | 53 | |
54 | 54 | return isset(self::$instances[$eventClass]) |
55 | 55 | ? self::$instances[$eventClass] |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param array $headers the headers for the event |
68 | 68 | * @return object event instance |
69 | 69 | */ |
70 | - public function build($subject, $name, array $headers = array()){ |
|
70 | + public function build($subject, $name, array $headers = array()) { |
|
71 | 71 | |
72 | 72 | return new $this->eventClass( |
73 | 73 | $subject, |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $parameters the headers for the event |
87 | 87 | * @return |
88 | 88 | */ |
89 | - public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()){ |
|
89 | + public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()) { |
|
90 | 90 | |
91 | 91 | return $dispatcher->notify( |
92 | 92 | $name, |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | class Test { |
16 | 16 | |
17 | 17 | |
18 | - public static function assertClassHasConstructor($className){ |
|
19 | - return (boolean) ReflectionPool::getInstance($className)->getConstructor(); |
|
18 | + public static function assertClassHasConstructor($className) { |
|
19 | + return (boolean)ReflectionPool::getInstance($className)->getConstructor(); |
|
20 | 20 | } |
21 | 21 | |
22 | - public static function assertRequiredConstructorParameters($className, $parameters){ |
|
22 | + public static function assertRequiredConstructorParameters($className, $parameters) { |
|
23 | 23 | return (boolean) |
24 | 24 | !self::assertClassHasConstructor($className) || |
25 | 25 | count($parameters) >= ReflectionPool::getInstance($className) |
@@ -27,55 +27,55 @@ discard block |
||
27 | 27 | ->getNumberOfRequiredParameters(); |
28 | 28 | } |
29 | 29 | |
30 | - public static function assertInstanceOf($className, $object){ |
|
31 | - return (boolean) ReflectionPool::getInstance($className) |
|
30 | + public static function assertInstanceOf($className, $object) { |
|
31 | + return (boolean)ReflectionPool::getInstance($className) |
|
32 | 32 | ->isInstance($object); |
33 | 33 | } |
34 | 34 | |
35 | - public static function assertClassOrInterfaceExists($className){ |
|
36 | - return (boolean) class_exists($className) || interface_exists($className); |
|
35 | + public static function assertClassOrInterfaceExists($className) { |
|
36 | + return (boolean)class_exists($className) || interface_exists($className); |
|
37 | 37 | } |
38 | 38 | |
39 | - public static function assertImplements($className, $interfaceName){ |
|
39 | + public static function assertImplements($className, $interfaceName) { |
|
40 | 40 | $className = is_object($className) ? get_class($className) : $className; |
41 | - $res = false;//throw new \Exception(); |
|
41 | + $res = false; //throw new \Exception(); |
|
42 | 42 | try { |
43 | 43 | class_exists($className); |
44 | - $res = ReflectionPool::getInstance($className) |
|
44 | + $res = ReflectionPool::getInstance($className) |
|
45 | 45 | ->implementsInterface($interfaceName); |
46 | - } catch (\Exception $e){ |
|
46 | + } catch (\Exception $e) { |
|
47 | 47 | $res = false; |
48 | 48 | } |
49 | - return $res;; |
|
49 | + return $res; ; |
|
50 | 50 | } |
51 | 51 | |
52 | - public static function assertMessage($message){ |
|
52 | + public static function assertMessage($message) { |
|
53 | 53 | return self::assertImplements($message, '\PEIP\INF\Message\Message'); |
54 | 54 | } |
55 | 55 | |
56 | - public static function assertEvent($event){ |
|
56 | + public static function assertEvent($event) { |
|
57 | 57 | return self::assertImplements($event, '\PEIP\INF\Event\Event'); |
58 | 58 | } |
59 | 59 | |
60 | - public static function assertEventSubject($event){ |
|
60 | + public static function assertEventSubject($event) { |
|
61 | 61 | return self::assertImplements($event, '\PEIP\INF\Event\Event') |
62 | 62 | && $event->getSubject(); |
63 | 63 | } |
64 | 64 | |
65 | - public static function assertEventObjectSubject($event){ |
|
65 | + public static function assertEventObjectSubject($event) { |
|
66 | 66 | return self::assertEventSubject($event) |
67 | 67 | && is_object($event->getSubject()); |
68 | 68 | } |
69 | - public static function assertArrayAccess($var){ |
|
70 | - return (boolean) is_array($var) || $var instanceof \ArrayAccess; |
|
69 | + public static function assertArrayAccess($var) { |
|
70 | + return (boolean)is_array($var) || $var instanceof \ArrayAccess; |
|
71 | 71 | } |
72 | 72 | |
73 | - public static function assertHandler($var){ |
|
74 | - return (boolean) is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler; |
|
73 | + public static function assertHandler($var) { |
|
74 | + return (boolean)is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler; |
|
75 | 75 | } |
76 | 76 | |
77 | - public static function castType($var, $type){ |
|
78 | - switch($type){ |
|
77 | + public static function castType($var, $type) { |
|
78 | + switch ($type) { |
|
79 | 79 | case 'string': |
80 | 80 | $var = (string)$var; |
81 | 81 | break; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | return $var; |
100 | 100 | } |
101 | 101 | |
102 | - public static function ensureArrayAccess($var){ |
|
103 | - if(!Test::assertArrayAccess($var)){ |
|
102 | + public static function ensureArrayAccess($var) { |
|
103 | + if (!Test::assertArrayAccess($var)) { |
|
104 | 104 | throw new \InvalidArgumentException( |
105 | 105 | 'Value is not an array nor an instance of ArrayAccess' |
106 | 106 | ); |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | - public static function ensureHandler($var){ |
|
113 | - if(!Test::assertHandler($var)){ |
|
112 | + public static function ensureHandler($var) { |
|
113 | + if (!Test::assertHandler($var)) { |
|
114 | 114 | throw new \InvalidArgumentException( |
115 | 115 | 'Value is not an callable nor an instance of \PEIP\INF\Handler\Handler' |
116 | 116 | ); |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | return $var; |
119 | 119 | } |
120 | 120 | |
121 | - public static function ensureImplements($className, $interfaceName){ |
|
122 | - if(!Test::assertImplements($className, $interfaceName)){ |
|
121 | + public static function ensureImplements($className, $interfaceName) { |
|
122 | + if (!Test::assertImplements($className, $interfaceName)) { |
|
123 | 123 | throw new \InvalidArgumentException( |
124 | 124 | 'Class "'.$className.'" is not an instanceof "'.$interfaceName.'"' |
125 | 125 | ); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return $className; |
128 | 128 | } |
129 | 129 | |
130 | - public static function assertMethod($className, $methodname){ |
|
130 | + public static function assertMethod($className, $methodname) { |
|
131 | 131 | return ReflectionPool::getInstance($className)->hasMethod($methodname); |
132 | 132 | } |
133 | 133 |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @param boolean $storeRef wether to store a reference for new instance. default: true |
44 | 44 | * @return |
45 | 45 | */ |
46 | - public function __construct($className, \ReflectionClass $reflectionClass = NULL, $storeRef = true){ |
|
47 | - if($reflectionClass ){ |
|
46 | + public function __construct($className, \ReflectionClass $reflectionClass = NULL, $storeRef = true) { |
|
47 | + if ($reflectionClass) { |
|
48 | 48 | |
49 | - if($reflectionClass->getName() != $className){ |
|
49 | + if ($reflectionClass->getName() != $className) { |
|
50 | 50 | throw new \Exception( |
51 | 51 | 'Constructing GenericBuilder with wrong ReflectionClass' |
52 | 52 | ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->reflectionClass = $reflectionClass; |
57 | 57 | } |
58 | 58 | $this->className = $className; |
59 | - if($storeRef){ |
|
59 | + if ($storeRef) { |
|
60 | 60 | self::$instances[$this->className] = $this; |
61 | 61 | } |
62 | 62 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @param string $className class-name to return builder instance for |
69 | 69 | * @return GenericBuilder builder instance for class |
70 | 70 | */ |
71 | - public static function getInstance($className){ |
|
72 | - if(!array_key_exists((string)$className, self::$instances)) { |
|
71 | + public static function getInstance($className) { |
|
72 | + if (!array_key_exists((string)$className, self::$instances)) { |
|
73 | 73 | new GenericBuilder($className); |
74 | 74 | } |
75 | 75 | return self::$instances[$className]; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param array $arguments array of constructore arguments |
83 | 83 | * @return object the created object instance |
84 | 84 | */ |
85 | - public function build(array $arguments = array()){ |
|
86 | - if(Test::assertClassHasConstructor($this->className)){ |
|
87 | - if(!Test::assertRequiredConstructorParameters($this->className, $arguments)){ |
|
85 | + public function build(array $arguments = array()) { |
|
86 | + if (Test::assertClassHasConstructor($this->className)) { |
|
87 | + if (!Test::assertRequiredConstructorParameters($this->className, $arguments)) { |
|
88 | 88 | throw new \Exception('Missing Argument '.(count($arguments) + 1).' for '.$this->className.'::__construct'); |
89 | 89 | } |
90 | 90 | return $this->getReflectionClass()->newInstanceArgs($arguments); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @access public |
99 | 99 | * @return ReflectionClass |
100 | 100 | */ |
101 | - public function getReflectionClass(){ |
|
101 | + public function getReflectionClass() { |
|
102 | 102 | return ReflectionPool::getInstance($this->className); |
103 | 103 | } |
104 | 104 |
@@ -22,6 +22,6 @@ |
||
22 | 22 | |
23 | 23 | interface Singleton { |
24 | 24 | |
25 | - public static function getInstance (); |
|
25 | + public static function getInstance(); |
|
26 | 26 | |
27 | 27 | } |
@@ -19,40 +19,40 @@ |
||
19 | 19 | protected $config; |
20 | 20 | |
21 | 21 | |
22 | - public function __construct($config){ //print_r((array)simplexml_load_string($config)); |
|
22 | + public function __construct($config) { //print_r((array)simplexml_load_string($config)); |
|
23 | 23 | $this->config = ($config); |
24 | 24 | } |
25 | 25 | |
26 | - public function read(){ |
|
26 | + public function read() { |
|
27 | 27 | $iterator = new \SimpleXMLIterator($this->config); |
28 | 28 | $iterator->rewind(); |
29 | - while($iterator->valid()){ |
|
29 | + while ($iterator->valid()) { |
|
30 | 30 | |
31 | 31 | $arrayNode = XMLArrayTranslator::translate($iterator->current()->asXML()); |
32 | 32 | $this->doFireEvent('read_node', array('NODE'=>$arrayNode)); |
33 | 33 | $iterator->next(); |
34 | 34 | } |
35 | 35 | |
36 | - foreach($iterator as $xmlNode){ |
|
36 | + foreach ($iterator as $xmlNode) { |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | $this->config = array(); |
40 | 40 | } |
41 | 41 | |
42 | - public static function convertXmlToArray(\SimpleXMLElement $node, array $array = array()){ |
|
42 | + public static function convertXmlToArray(\SimpleXMLElement $node, array $array = array()) { |
|
43 | 43 | $node->type = $node->type ? $node->type : $node->getName(); |
44 | 44 | |
45 | - foreach($node->attributes() as $name=>$value){ |
|
45 | + foreach ($node->attributes() as $name=>$value) { |
|
46 | 46 | $array[$name] = (string)$value; |
47 | 47 | } |
48 | - foreach($node->children() as $child){ |
|
48 | + foreach ($node->children() as $child) { |
|
49 | 49 | $a = $b->getName(); |
50 | - if(!$b->children()){ |
|
50 | + if (!$b->children()) { |
|
51 | 51 | $arr[$a] = trim($b[0]); |
52 | 52 | } |
53 | - else{ |
|
53 | + else { |
|
54 | 54 | $arr[$a][$iter] = array(); |
55 | - $arr[$a][$iter] = xml2phpArray($b,$arr[$a][$iter]); |
|
55 | + $arr[$a][$iter] = xml2phpArray($b, $arr[$a][$iter]); |
|
56 | 56 | } |
57 | 57 | $iter++; |
58 | 58 | } |