@@ -44,11 +44,13 @@ |
||
44 | 44 | $this->properties = $properties; |
45 | 45 | } |
46 | 46 | |
47 | - public function setProperties($properties){ |
|
47 | + public function setProperties($properties) |
|
48 | + { |
|
48 | 49 | $this->properties = $properties; |
49 | 50 | } |
50 | 51 | |
51 | - public function addProperty(ODataProperty $property){ |
|
52 | + public function addProperty(ODataProperty $property) |
|
53 | + { |
|
52 | 54 | $this->properties[] = $property; |
53 | 55 | } |
54 | 56 | } |
@@ -322,7 +322,7 @@ |
||
322 | 322 | return; |
323 | 323 | } |
324 | 324 | $reader = $this->readerRegistery->getReader($dataType); |
325 | - if($reader !== null){ |
|
325 | + if($reader !== null) { |
|
326 | 326 | $this->data = $reader->read($string); |
327 | 327 | } |
328 | 328 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function handleStartNode($tagNamespace, $tagName, $attributes) |
34 | 34 | { |
35 | - switch(strtolower($tagNamespace)){ |
|
35 | + switch(strtolower($tagNamespace)) { |
|
36 | 36 | case strtolower(ODataConstants::ATOM_NAMESPACE): |
37 | 37 | $this->handleAtomStart($tagName, $attributes); |
38 | 38 | break; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | public function handleEndNode($tagNamespace, $tagName) |
45 | 45 | { |
46 | - switch(strtolower($tagNamespace)){ |
|
46 | + switch(strtolower($tagNamespace)) { |
|
47 | 47 | case strtolower(ODataConstants::ATOM_NAMESPACE): |
48 | 48 | $this->handleAtomEnd($tagName); |
49 | 49 | break; |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
56 | - public function handleAtomStart($tagName, $attributes){ |
|
57 | - switch(strtolower($tagName)){ |
|
56 | + public function handleAtomStart($tagName, $attributes) |
|
57 | + { |
|
58 | + switch(strtolower($tagName)) { |
|
58 | 59 | case strtolower(ODataConstants::ATOM_ID_ELEMENT_NAME): |
59 | 60 | break; |
60 | 61 | case strtolower(ODataConstants::ATOM_TITLE_ELELMET_NAME): |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | } |
83 | 84 | } |
84 | 85 | |
85 | - public function handleAtomEnd($tagName){ |
|
86 | - switch(strtolower($tagName)){ |
|
86 | + public function handleAtomEnd($tagName) |
|
87 | + { |
|
88 | + switch(strtolower($tagName)) { |
|
87 | 89 | case strtolower(ODataConstants::ATOM_ID_ELEMENT_NAME): |
88 | 90 | $this->oDataFeed->id = $this->popCharData(); |
89 | 91 | break; |
@@ -101,8 +103,9 @@ discard block |
||
101 | 103 | } |
102 | 104 | } |
103 | 105 | |
104 | - public function handleMetadataStart($tagName, $attributes){ |
|
105 | - switch(strtolower($tagName)){ |
|
106 | + public function handleMetadataStart($tagName, $attributes) |
|
107 | + { |
|
108 | + switch(strtolower($tagName)) { |
|
106 | 109 | case strtolower(ODataConstants::ROWCOUNT_ELEMENT): |
107 | 110 | break; |
108 | 111 | default: |
@@ -110,8 +113,9 @@ discard block |
||
110 | 113 | } |
111 | 114 | } |
112 | 115 | |
113 | - public function handleMetadataEnd($tagName){ |
|
114 | - switch(strtolower($tagName)){ |
|
116 | + public function handleMetadataEnd($tagName) |
|
117 | + { |
|
118 | + switch(strtolower($tagName)) { |
|
115 | 119 | case strtolower(ODataConstants::ROWCOUNT_ELEMENT): |
116 | 120 | $this->oDataFeed->rowCount = $this->charData; |
117 | 121 | $this->charData = ''; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function handleStartNode($tagNamespace, $tagName, $attributes) |
38 | 38 | { |
39 | - switch(strtolower($tagName)){ |
|
39 | + switch(strtolower($tagName)) { |
|
40 | 40 | case strtolower(ODataConstants::ATOM_ID_ELEMENT_NAME): |
41 | 41 | break; |
42 | 42 | case strtolower(ODataConstants::ATOM_TITLE_ELELMET_NAME): |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | case strtolower(ODataConstants::ATOM_AUTHOR_ELEMENT_NAME): |
74 | 74 | break; |
75 | 75 | default: |
76 | - if(null === $this->subProcessor){ |
|
76 | + if(null === $this->subProcessor) { |
|
77 | 77 | dd($tagName); |
78 | 78 | } |
79 | 79 | $this->subProcessor->handleStartNode($tagNamespace,$tagName,$attributes); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | public function handleEndNode($tagNamespace, $tagName) |
85 | 85 | { |
86 | - switch(strtolower($tagName)){ |
|
86 | + switch(strtolower($tagName)) { |
|
87 | 87 | case strtolower(ODataConstants::ATOM_ID_ELEMENT_NAME): |
88 | 88 | $this->oDataEntry->id = $this->popCharData(); |
89 | 89 | $this->charData = ''; |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | } |
136 | 136 | public function handleCharacterData($characters) |
137 | 137 | { |
138 | - if(null === $this->subProcessor){ |
|
138 | + if(null === $this->subProcessor) { |
|
139 | 139 | parent::handleCharacterData($characters); |
140 | - }else{ |
|
140 | + } else { |
|
141 | 141 | $this->subProcessor->handleCharacterData($characters); |
142 | 142 | } |
143 | 143 | } |
144 | 144 | private function handleLink(ODataLink $link) |
145 | 145 | { |
146 | - switch($link->name){ |
|
146 | + switch($link->name) { |
|
147 | 147 | case ODataConstants::ATOM_EDIT_RELATION_ATTRIBUTE_VALUE: |
148 | 148 | $this->oDataEntry->editLink = $link; |
149 | 149 | break; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function __construct($attributes) |
23 | 23 | { |
24 | - switch($this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, null)){ |
|
24 | + switch($this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, null)) { |
|
25 | 25 | case ODataConstants::ATOM_EDIT_RELATION_ATTRIBUTE_VALUE: |
26 | 26 | case ODataConstants::ODATA_RELATED_NAMESPACE . $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_TITLE_ELELMET_NAME, ''): |
27 | 27 | $object = ODataLink::class; |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | |
56 | 56 | public function handleChildComplete($objectModel) |
57 | 57 | { |
58 | - if($objectModel instanceof ODataFeed){ |
|
58 | + if($objectModel instanceof ODataFeed) { |
|
59 | 59 | $expandResult = new ODataExpandedResult(null, $objectModel); |
60 | - }else{ |
|
60 | + } else { |
|
61 | 61 | assert($objectModel instanceof ODataEntry); // its an assumption but lets check it |
62 | 62 | $expandResult = new ODataExpandedResult($objectModel, null); |
63 | 63 |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | $this->charData .= $characters; |
20 | 20 | } |
21 | 21 | |
22 | - public final function popCharData(){ |
|
22 | + public final function popCharData() |
|
23 | + { |
|
23 | 24 | $data = $this->charData; |
24 | 25 | $this->charData = ''; |
25 | 26 | return $data; |
@@ -29,12 +30,13 @@ discard block |
||
29 | 30 | |
30 | 31 | public abstract function getObjetModelObject(); |
31 | 32 | |
32 | - protected final function arrayKeyOrDefault($array, $key, $default){ |
|
33 | - if(array_key_exists($key, $array)){ |
|
33 | + protected final function arrayKeyOrDefault($array, $key, $default) |
|
34 | + { |
|
35 | + if(array_key_exists($key, $array)) { |
|
34 | 36 | return $array[$key]; |
35 | 37 | } |
36 | - foreach($array as $objKey => $value){ |
|
37 | - if(strtolower($key) === strtolower($objKey)){ |
|
38 | + foreach($array as $objKey => $value) { |
|
39 | + if(strtolower($key) === strtolower($objKey)) { |
|
38 | 40 | return $value; |
39 | 41 | } |
40 | 42 | } |
@@ -53,15 +53,16 @@ discard block |
||
53 | 53 | xml_parse($this->parser, $data, true); |
54 | 54 | return $this->objectModel; |
55 | 55 | } |
56 | - public function characterData ($parser, $data){ |
|
57 | - if($this->stack->isEmpty()){ |
|
56 | + public function characterData ($parser, $data) |
|
57 | + { |
|
58 | + if($this->stack->isEmpty()) { |
|
58 | 59 | throw new \ParseError('enchanted character data outside of xml tag'); |
59 | 60 | } |
60 | 61 | $this->stack->top()->handleCharacterData($data); |
61 | 62 | } |
62 | 63 | public function tagOpen($parser, $tag, $attributes) |
63 | 64 | { |
64 | - switch(strtolower($tag)){ |
|
65 | + switch(strtolower($tag)) { |
|
65 | 66 | case strtolower(ODataConstants::ATOM_NAMESPACE . '|' . ODataConstants::ATOM_FEED_ELEMENT_NAME); |
66 | 67 | $this->stack->push(new FeedProcessor($attributes)); |
67 | 68 | break; |
@@ -69,7 +70,7 @@ discard block |
||
69 | 70 | $this->stack->push(new EntryProcessor($attributes)); |
70 | 71 | break; |
71 | 72 | default: |
72 | - if($this->stack->isEmpty()){ |
|
73 | + if($this->stack->isEmpty()) { |
|
73 | 74 | throw new \ParseError( sprintf('encountered node %s while not in a feed or a stack', $tag)); |
74 | 75 | } |
75 | 76 | list($namespsace, $name) = explode('|', $tag); |
@@ -79,18 +80,18 @@ discard block |
||
79 | 80 | |
80 | 81 | function tagClose($parser, $tag) |
81 | 82 | { |
82 | - switch(strtolower($tag)){ |
|
83 | + switch(strtolower($tag)) { |
|
83 | 84 | case strtolower(ODataConstants::ATOM_NAMESPACE . '|' . ODataConstants::ATOM_FEED_ELEMENT_NAME): |
84 | 85 | case strtolower(ODataConstants::ATOM_NAMESPACE . '|' . ODataConstants::ATOM_ENTRY_ELEMENT_NAME): |
85 | 86 | $process = $this->stack->pop(); |
86 | - if($this->stack->isEmpty()){ |
|
87 | + if($this->stack->isEmpty()) { |
|
87 | 88 | $this->objectModel = $process->getObjetModelObject(); |
88 | - }else { |
|
89 | + } else { |
|
89 | 90 | $this->stack->top()->handleChildComplete($process->getObjetModelObject()); |
90 | 91 | } |
91 | 92 | break; |
92 | 93 | default: |
93 | - if($this->stack->isEmpty()){ |
|
94 | + if($this->stack->isEmpty()) { |
|
94 | 95 | throw new \ParseError('encountered node %s while not in a feed or a stack'); |
95 | 96 | } |
96 | 97 | list($namespsace, $name) = explode('|', $tag); |