@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | } |
42 | 42 | public function base64EncodedToXml(XmlSerializationVisitor $visitor, $data, array $type, Context $context) |
43 | 43 | { |
44 | - return $visitor->visitSimpleString(base64_encode($data), $type, $context); |
|
44 | + return $visitor->visitSimpleString (base64_encode ($data), $type, $context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function base64EncodedFromXml(XmlDeserializationVisitor $visitor, $data, array $type) |
48 | 48 | { |
49 | - $attributes = $data->attributes('xsi', true); |
|
50 | - if (isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true') { |
|
49 | + $attributes = $data->attributes ('xsi', true); |
|
50 | + if (isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true') { |
|
51 | 51 | return null; |
52 | 52 | } |
53 | 53 | |
54 | - return base64_decode((string)$data); |
|
54 | + return base64_decode ((string) $data); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function simpleListOfToXml(XmlSerializationVisitor $visitor, $object, array $type, Context $context) |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | 'params' => array() |
63 | 63 | ); |
64 | 64 | |
65 | - $navigator = $context->getNavigator(); |
|
65 | + $navigator = $context->getNavigator (); |
|
66 | 66 | $ret = array(); |
67 | 67 | foreach ($object as $v) { |
68 | - $ret[] = $navigator->accept($v, $newType, $context)->data; |
|
68 | + $ret[] = $navigator->accept ($v, $newType, $context)->data; |
|
69 | 69 | } |
70 | 70 | |
71 | - return $visitor->getDocument()->createTextNode(implode(" ", $ret)); |
|
71 | + return $visitor->getDocument ()->createTextNode (implode (" ", $ret)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function simpleListOfFromXml(XmlDeserializationVisitor $visitor, $node, array $type, Context $context) |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | 'params' => array() |
79 | 79 | ); |
80 | 80 | $ret = array(); |
81 | - $navigator = $context->getNavigator(); |
|
82 | - foreach (explode(" ", (string)$node) as $v) { |
|
83 | - $ret[] = $navigator->accept($v, $newType, $context); |
|
81 | + $navigator = $context->getNavigator (); |
|
82 | + foreach (explode (" ", (string) $node) as $v) { |
|
83 | + $ret[] = $navigator->accept ($v, $newType, $context); |
|
84 | 84 | } |
85 | 85 | return $ret; |
86 | 86 | } |
@@ -70,71 +70,71 @@ discard block |
||
70 | 70 | |
71 | 71 | } |
72 | 72 | |
73 | - public function deserializeDateIntervalXml(XmlDeserializationVisitor $visitor, $data, array $type){ |
|
74 | - $attributes = $data->attributes('xsi', true); |
|
73 | + public function deserializeDateIntervalXml(XmlDeserializationVisitor $visitor, $data, array $type) { |
|
74 | + $attributes = $data->attributes ('xsi', true); |
|
75 | 75 | if (isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true') { |
76 | 76 | return null; |
77 | 77 | } |
78 | - return $this->createDateInterval((string)$data); |
|
78 | + return $this->createDateInterval ((string) $data); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function serializeDate(XmlSerializationVisitor $visitor, \DateTime $date, array $type, Context $context) |
82 | 82 | { |
83 | 83 | |
84 | - $v = $date->format('Y-m-d'); |
|
84 | + $v = $date->format ('Y-m-d'); |
|
85 | 85 | |
86 | - return $visitor->visitSimpleString($v, $type, $context); |
|
86 | + return $visitor->visitSimpleString ($v, $type, $context); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function deserializeDate(XmlDeserializationVisitor $visitor, $data, array $type) |
90 | 90 | { |
91 | - $attributes = $data->attributes('xsi', true); |
|
92 | - if (isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true') { |
|
91 | + $attributes = $data->attributes ('xsi', true); |
|
92 | + if (isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true') { |
|
93 | 93 | return null; |
94 | 94 | } |
95 | - if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})(Z|([+-]\d{2}:\d{2}))?$/', $data)) { |
|
96 | - throw new RuntimeException(sprintf('Invalid date "%s", expected valid XML Schema date string.', $data)); |
|
95 | + if (!preg_match ('/^(\d{4})-(\d{2})-(\d{2})(Z|([+-]\d{2}:\d{2}))?$/', $data)) { |
|
96 | + throw new RuntimeException (sprintf ('Invalid date "%s", expected valid XML Schema date string.', $data)); |
|
97 | 97 | } |
98 | 98 | |
99 | - return $this->parseDateTime($data, $type); |
|
99 | + return $this->parseDateTime ($data, $type); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | public function serializeDateTime(XmlSerializationVisitor $visitor, \DateTime $date, array $type, Context $context) |
103 | 103 | { |
104 | 104 | |
105 | - $v = $date->format(\DateTime::W3C); |
|
105 | + $v = $date->format (\DateTime::W3C); |
|
106 | 106 | |
107 | - return $visitor->visitSimpleString($v, $type, $context); |
|
107 | + return $visitor->visitSimpleString ($v, $type, $context); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public function deserializeDateTime(XmlDeserializationVisitor $visitor, $data, array $type) |
111 | 111 | { |
112 | - $attributes = $data->attributes('xsi', true); |
|
113 | - if (isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true') { |
|
112 | + $attributes = $data->attributes ('xsi', true); |
|
113 | + if (isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true') { |
|
114 | 114 | return null; |
115 | 115 | } |
116 | 116 | |
117 | - return $this->parseDateTime($data, $type); |
|
117 | + return $this->parseDateTime ($data, $type); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | 121 | public function serializeTime(XmlSerializationVisitor $visitor, \DateTime $date, array $type, Context $context) |
122 | 122 | { |
123 | - $v = $date->format('H:i:s'); |
|
124 | - if ($date->getTimezone()->getOffset($date) !== $this->defaultTimezone->getOffset($date)) { |
|
125 | - $v .= $date->format('P'); |
|
123 | + $v = $date->format ('H:i:s'); |
|
124 | + if ($date->getTimezone ()->getOffset ($date) !== $this->defaultTimezone->getOffset ($date)) { |
|
125 | + $v .= $date->format ('P'); |
|
126 | 126 | } |
127 | - return $visitor->visitSimpleString($v, $type, $context); |
|
127 | + return $visitor->visitSimpleString ($v, $type, $context); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public function deserializeTime(XmlDeserializationVisitor $visitor, $data, array $type) |
131 | 131 | { |
132 | - $attributes = $data->attributes('xsi', true); |
|
133 | - if (isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true') { |
|
132 | + $attributes = $data->attributes ('xsi', true); |
|
133 | + if (isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true') { |
|
134 | 134 | return null; |
135 | 135 | } |
136 | 136 | |
137 | - $data = (string)$data; |
|
137 | + $data = (string) $data; |
|
138 | 138 | |
139 | 139 | return new \DateTime($data, $this->defaultTimezone); |
140 | 140 | } |
@@ -142,24 +142,24 @@ discard block |
||
142 | 142 | private function parseDateTime($data, array $type) |
143 | 143 | { |
144 | 144 | $timezone = isset($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
145 | - $datetime = new \DateTime((string)$data, $timezone); |
|
145 | + $datetime = new \DateTime((string) $data, $timezone); |
|
146 | 146 | if (false === $datetime) { |
147 | - throw new RuntimeException(sprintf('Invalid datetime "%s", expected valid XML Schema dateTime string.', $data)); |
|
147 | + throw new RuntimeException (sprintf ('Invalid datetime "%s", expected valid XML Schema dateTime string.', $data)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $datetime; |
151 | 151 | } |
152 | 152 | |
153 | - private function createDateInterval($interval){ |
|
153 | + private function createDateInterval($interval) { |
|
154 | 154 | $f = 0.0; |
155 | - if (preg_match('~\.\d+~',$interval,$match)) { |
|
156 | - $interval = str_replace($match[0], "", $interval); |
|
157 | - $f = (float)$match[0]; |
|
155 | + if (preg_match ('~\.\d+~', $interval, $match)) { |
|
156 | + $interval = str_replace ($match[0], "", $interval); |
|
157 | + $f = (float) $match[0]; |
|
158 | 158 | } |
159 | 159 | $di = new \DateInterval($interval); |
160 | 160 | // milliseconds are only available from >=7.1 |
161 | - if(isset($di->f)){ |
|
162 | - $di->f= $f; |
|
161 | + if (isset($di->f)) { |
|
162 | + $di->f = $f; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $di; |