@@ -44,11 +44,11 @@ |
||
44 | 44 | $this->properties = $properties; |
45 | 45 | } |
46 | 46 | |
47 | - public function setProperties($properties){ |
|
47 | + public function setProperties($properties) { |
|
48 | 48 | $this->properties = $properties; |
49 | 49 | } |
50 | 50 | |
51 | - public function addProperty(ODataProperty $property){ |
|
51 | + public function addProperty(ODataProperty $property) { |
|
52 | 52 | $this->properties[] = $property; |
53 | 53 | } |
54 | 54 | } |
@@ -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 | } |
@@ -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,8 @@ 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 | + switch (strtolower($tagName)) { |
|
58 | 58 | case strtolower(ODataConstants::ATOM_ID_ELEMENT_NAME): |
59 | 59 | break; |
60 | 60 | case strtolower(ODataConstants::ATOM_TITLE_ELELMET_NAME): |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | case strtolower(ODataConstants::ATOM_UPDATED_ELEMENT_NAME): |
68 | 68 | break; |
69 | 69 | case strtolower(ODataConstants::ATOM_LINK_ELEMENT_NAME): |
70 | - $rel = $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, ''); |
|
70 | + $rel = $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, ''); |
|
71 | 71 | $prop = $rel === ODataConstants::ATOM_SELF_RELATION_ATTRIBUTE_VALUE ? 'selfLink' : 'nextPageLink'; |
72 | 72 | $this->oDataFeed->{$prop} = new ODataLink( |
73 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, ''), |
|
74 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_TITLE_ELELMET_NAME, ''), |
|
75 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, ''), |
|
76 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_HREF_ATTRIBUTE_NAME, '') |
|
73 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, ''), |
|
74 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_TITLE_ELELMET_NAME, ''), |
|
75 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, ''), |
|
76 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_HREF_ATTRIBUTE_NAME, '') |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | break; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - public function handleAtomEnd($tagName){ |
|
86 | - switch(strtolower($tagName)){ |
|
85 | + public function handleAtomEnd($tagName) { |
|
86 | + switch (strtolower($tagName)) { |
|
87 | 87 | case strtolower(ODataConstants::ATOM_ID_ELEMENT_NAME): |
88 | 88 | $this->oDataFeed->id = $this->popCharData(); |
89 | 89 | break; |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - public function handleMetadataStart($tagName, $attributes){ |
|
105 | - switch(strtolower($tagName)){ |
|
104 | + public function handleMetadataStart($tagName, $attributes) { |
|
105 | + switch (strtolower($tagName)) { |
|
106 | 106 | case strtolower(ODataConstants::ROWCOUNT_ELEMENT): |
107 | 107 | break; |
108 | 108 | default: |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | - public function handleMetadataEnd($tagName){ |
|
114 | - switch(strtolower($tagName)){ |
|
113 | + public function handleMetadataEnd($tagName) { |
|
114 | + switch (strtolower($tagName)) { |
|
115 | 115 | case strtolower(ODataConstants::ROWCOUNT_ELEMENT): |
116 | 116 | $this->oDataFeed->rowCount = $this->charData; |
117 | 117 | $this->charData = ''; |
@@ -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 = ''; |
@@ -102,7 +102,7 @@ |
||
102 | 102 | break; |
103 | 103 | case strtolower(ODataConstants::ATOM_LINK_ELEMENT_NAME): |
104 | 104 | $this->handleLink($this->subProcessor->getObjetModelObject()); |
105 | - $this->subProcessor = null; |
|
105 | + $this->subProcessor = null; |
|
106 | 106 | break; |
107 | 107 | case strtolower(ODataConstants::ATOM_CATEGORY_ELEMENT_NAME): |
108 | 108 | $this->oDataEntry->type = $this->objectModelSubNode; |
@@ -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,17 +73,17 @@ 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 | - $this->subProcessor->handleStartNode($tagNamespace,$tagName,$attributes); |
|
79 | + $this->subProcessor->handleStartNode($tagNamespace, $tagName, $attributes); |
|
80 | 80 | break; |
81 | 81 | } |
82 | 82 | } |
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 = ''; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | case strtolower(ODataConstants::ATOM_AUTHOR_ELEMENT_NAME): |
119 | 119 | break; |
120 | 120 | default: |
121 | - $this->subProcessor->handleEndNode($tagNamespace,$tagName); |
|
121 | + $this->subProcessor->handleEndNode($tagNamespace, $tagName); |
|
122 | 122 | break; |
123 | 123 | |
124 | 124 | } |
@@ -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; |
@@ -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; |
@@ -33,31 +33,31 @@ discard block |
||
33 | 33 | $object = ODataLink::class; |
34 | 34 | } |
35 | 35 | $this->link = new $object( |
36 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, ''), |
|
37 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_TITLE_ELELMET_NAME, ''), |
|
38 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, ''), |
|
39 | - $this->arrayKeyOrDefault($attributes,ODataConstants::ATOM_HREF_ATTRIBUTE_NAME, '') |
|
36 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_LINK_RELATION_ATTRIBUTE_NAME, ''), |
|
37 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_TITLE_ELELMET_NAME, ''), |
|
38 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, ''), |
|
39 | + $this->arrayKeyOrDefault($attributes, ODataConstants::ATOM_HREF_ATTRIBUTE_NAME, '') |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function handleStartNode($tagNamespace, $tagName, $attributes) |
44 | 44 | { |
45 | 45 | //The only sub notes that will exist will be the inline ones before we process the feed or entity. |
46 | - assert($tagNamespace === strtolower(ODataConstants::ODATA_METADATA_NAMESPACE)); |
|
46 | + assert($tagNamespace === strtolower(ODataConstants::ODATA_METADATA_NAMESPACE)); |
|
47 | 47 | assert($tagName === strtolower(ODataConstants::ATOM_INLINE_ELEMENT_NAME)); |
48 | 48 | } |
49 | 49 | |
50 | 50 | public function handleEndNode($tagNamespace, $tagName) |
51 | 51 | { |
52 | 52 | //The only sub notes that will exist will be the inline ones before we process the feed or entity. |
53 | - assert($tagNamespace === strtolower(ODataConstants::ODATA_METADATA_NAMESPACE)); |
|
54 | - assert($tagName === strtolower(ODataConstants::ATOM_INLINE_ELEMENT_NAME)); } |
|
53 | + assert($tagNamespace === strtolower(ODataConstants::ODATA_METADATA_NAMESPACE)); |
|
54 | + assert($tagName === strtolower(ODataConstants::ATOM_INLINE_ELEMENT_NAME)); } |
|
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 |
@@ -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 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | assert($tagNamespace === ODataConstants::ODATA_NAMESPACE); |
33 | 33 | $this->latestProperty = new ODataProperty(); |
34 | 34 | $this->latestProperty->name = $tagName; |
35 | - $this->latestProperty->typeName = $this->arrayKeyOrDefault($attributes, ODataConstants::ODATA_METADATA_NAMESPACE . '|' . ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, null ); |
|
35 | + $this->latestProperty->typeName = $this->arrayKeyOrDefault($attributes, ODataConstants::ODATA_METADATA_NAMESPACE . '|' . ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, null); |
|
36 | 36 | $this->properties[$this->latestProperty->name] = $this->latestProperty; |
37 | 37 | } |
38 | 38 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->charData .= $characters; |
20 | 20 | } |
21 | 21 | |
22 | - public final function popCharData(){ |
|
22 | + public final function popCharData() { |
|
23 | 23 | $data = $this->charData; |
24 | 24 | $this->charData = ''; |
25 | 25 | return $data; |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | |
30 | 30 | public abstract function getObjetModelObject(); |
31 | 31 | |
32 | - protected final function arrayKeyOrDefault($array, $key, $default){ |
|
33 | - if(array_key_exists($key, $array)){ |
|
32 | + protected final function arrayKeyOrDefault($array, $key, $default) { |
|
33 | + if (array_key_exists($key, $array)) { |
|
34 | 34 | return $array[$key]; |
35 | 35 | } |
36 | - foreach($array as $objKey => $value){ |
|
37 | - if(strtolower($key) === strtolower($objKey)){ |
|
36 | + foreach ($array as $objKey => $value) { |
|
37 | + if (strtolower($key) === strtolower($objKey)) { |
|
38 | 38 | return $value; |
39 | 39 | } |
40 | 40 | } |
@@ -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 | } |
@@ -100,6 +100,6 @@ |
||
100 | 100 | |
101 | 101 | public function canHandle(\POData\Common\Version $responseVersion, $contentType) |
102 | 102 | { |
103 | - return MimeTypes::MIME_APPLICATION_ATOM == $contentType || MimeTypes::MIME_APPLICATION_XML === $contentType; |
|
103 | + return MimeTypes::MIME_APPLICATION_ATOM == $contentType || MimeTypes::MIME_APPLICATION_XML === $contentType; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | \ No newline at end of file |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $this->parser = xml_parser_create_ns('UTF-8', '|'); |
37 | 37 | xml_set_object($this->parser, $this); |
38 | - xml_set_element_handler($this->parser,[$this, 'tagOpen'],[$this, 'tagClose']); |
|
38 | + xml_set_element_handler($this->parser, [$this, 'tagOpen'], [$this, 'tagClose']); |
|
39 | 39 | xml_set_character_data_handler($this->parser, [$this, 'characterData']); |
40 | 40 | xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); |
41 | 41 | $this->stack = new SplStack(); |
@@ -53,15 +53,15 @@ 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 | + if ($this->stack->isEmpty()) { |
|
58 | 58 | throw new \ParseError('enchanted character data outside of xml tag'); |
59 | 59 | } |
60 | 60 | $this->stack->top()->handleCharacterData($data); |
61 | 61 | } |
62 | 62 | public function tagOpen($parser, $tag, $attributes) |
63 | 63 | { |
64 | - switch(strtolower($tag)){ |
|
64 | + switch (strtolower($tag)) { |
|
65 | 65 | case strtolower(ODataConstants::ATOM_NAMESPACE . '|' . ODataConstants::ATOM_FEED_ELEMENT_NAME); |
66 | 66 | $this->stack->push(new FeedProcessor($attributes)); |
67 | 67 | break; |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | $this->stack->push(new EntryProcessor($attributes)); |
70 | 70 | break; |
71 | 71 | default: |
72 | - if($this->stack->isEmpty()){ |
|
73 | - throw new \ParseError( sprintf('encountered node %s while not in a feed or a stack', $tag)); |
|
72 | + if ($this->stack->isEmpty()) { |
|
73 | + throw new \ParseError(sprintf('encountered node %s while not in a feed or a stack', $tag)); |
|
74 | 74 | } |
75 | 75 | list($namespsace, $name) = explode('|', $tag); |
76 | 76 | $this->stack->top()->handleStartNode($namespsace, $name, $attributes); |
@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | |
80 | 80 | function tagClose($parser, $tag) |
81 | 81 | { |
82 | - switch(strtolower($tag)){ |
|
82 | + switch (strtolower($tag)) { |
|
83 | 83 | case strtolower(ODataConstants::ATOM_NAMESPACE . '|' . ODataConstants::ATOM_FEED_ELEMENT_NAME): |
84 | 84 | case strtolower(ODataConstants::ATOM_NAMESPACE . '|' . ODataConstants::ATOM_ENTRY_ELEMENT_NAME): |
85 | 85 | $process = $this->stack->pop(); |
86 | - if($this->stack->isEmpty()){ |
|
86 | + if ($this->stack->isEmpty()) { |
|
87 | 87 | $this->objectModel = $process->getObjetModelObject(); |
88 | - }else { |
|
88 | + } else { |
|
89 | 89 | $this->stack->top()->handleChildComplete($process->getObjetModelObject()); |
90 | 90 | } |
91 | 91 | break; |
92 | 92 | default: |
93 | - if($this->stack->isEmpty()){ |
|
93 | + if ($this->stack->isEmpty()) { |
|
94 | 94 | throw new \ParseError('encountered node %s while not in a feed or a stack'); |
95 | 95 | } |
96 | 96 | list($namespsace, $name) = explode('|', $tag); |
@@ -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); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | public function reset() |
24 | 24 | { |
25 | - $this->readers = []; |
|
25 | + $this->readers = []; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -78,7 +78,6 @@ |
||
78 | 78 | $this->eTag = $eTag; |
79 | 79 | $this->name = $name; |
80 | 80 | $this->srcLink = $srcLink; |
81 | - $this->rel = (null !== $rel) ? $rel : |
|
82 | - ODataConstants::ATOM_MEDIA_RESOURCE_RELATION_ATTRIBUTE_VALUE . $name; |
|
81 | + $this->rel = (null !== $rel) ? $rel : ODataConstants::ATOM_MEDIA_RESOURCE_RELATION_ATTRIBUTE_VALUE . $name; |
|
83 | 82 | } |
84 | 83 | } |