@@ -88,19 +88,24 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | - public function getEdmNamespace(){ |
|
91 | + public function getEdmNamespace() |
|
92 | + { |
|
92 | 93 | return $this->edmNamespace; |
93 | 94 | } |
94 | - public function getEdmxNamespace(){ |
|
95 | + public function getEdmxNamespace() |
|
96 | + { |
|
95 | 97 | return $this->edmxNamespace; |
96 | 98 | } |
97 | - public function getMetadataNamespace(){ |
|
99 | + public function getMetadataNamespace() |
|
100 | + { |
|
98 | 101 | return $this->metadataNamespace; |
99 | 102 | } |
100 | - public function getDataServiceNamespace(){ |
|
103 | + public function getDataServiceNamespace() |
|
104 | + { |
|
101 | 105 | return $this->dataServiceNamespace; |
102 | 106 | } |
103 | - public function getAnnotationsNamespace(){ |
|
107 | + public function getAnnotationsNamespace() |
|
108 | + { |
|
104 | 109 | return $this->annotationsNamespace; |
105 | 110 | } |
106 | 111 | } |
107 | 112 | \ No newline at end of file |
@@ -97,8 +97,7 @@ discard block |
||
97 | 97 | bool $nullCheck = false, |
98 | 98 | OdataVersions $forVersion = null, |
99 | 99 | array $prohibitedVersions = [] |
100 | - ) |
|
101 | - { |
|
100 | + ) { |
|
102 | 101 | $this |
103 | 102 | ->setAttributeName($name) |
104 | 103 | ->setAttributeForVersion($forVersion) |
@@ -109,7 +108,7 @@ discard block |
||
109 | 108 | |
110 | 109 | private function strval($value):string |
111 | 110 | { |
112 | - if(is_bool($value)){ |
|
111 | + if(is_bool($value)) { |
|
113 | 112 | return $value ? "true" : "false"; |
114 | 113 | } |
115 | 114 | return strval($value); |
@@ -125,7 +125,7 @@ |
||
125 | 125 | */ |
126 | 126 | public function setRole(?string $role): self |
127 | 127 | { |
128 | - if($role !== null && !isset($this->getType()->getNavigationProperty()[$role])){ |
|
128 | + if($role !== null && !isset($this->getType()->getNavigationProperty()[$role])) { |
|
129 | 129 | throw new \InvalidArgumentException('If a roll is set on a assication End it should represent the navigation property on the attached type.'); |
130 | 130 | } |
131 | 131 | $this->role = $role; |
@@ -43,7 +43,8 @@ |
||
43 | 43 | unset($this->property[$offset]); |
44 | 44 | } |
45 | 45 | |
46 | - public function __toArray(){ |
|
46 | + public function __toArray() |
|
47 | + { |
|
47 | 48 | return $this->property; |
48 | 49 | } |
49 | 50 | } |
50 | 51 | \ No newline at end of file |
@@ -38,30 +38,37 @@ discard block |
||
38 | 38 | return $this->baseDocument; |
39 | 39 | } |
40 | 40 | |
41 | - public function getEdmNamespace(){ |
|
41 | + public function getEdmNamespace() |
|
42 | + { |
|
42 | 43 | return $this->namespaceContainer->getEdmNamespace(); |
43 | 44 | } |
44 | - public function getEdmxNamespace(){ |
|
45 | + public function getEdmxNamespace() |
|
46 | + { |
|
45 | 47 | return $this->namespaceContainer->getEdmxNamespace(); |
46 | 48 | } |
47 | - public function getMetadataNamespace(){ |
|
49 | + public function getMetadataNamespace() |
|
50 | + { |
|
48 | 51 | return $this->namespaceContainer->getMetadataNamespace(); |
49 | 52 | } |
50 | - public function getDataServiceNamespace(){ |
|
53 | + public function getDataServiceNamespace() |
|
54 | + { |
|
51 | 55 | return $this->namespaceContainer->getDataServiceNamespace(); |
52 | 56 | } |
53 | - public function getAnnotationsNamespace(){ |
|
57 | + public function getAnnotationsNamespace() |
|
58 | + { |
|
54 | 59 | return $this->namespaceContainer->getAnnotationsNamespace(); |
55 | 60 | } |
56 | 61 | public function getOdataVersion():string { |
57 | 62 | return strval($this->odataVersion); |
58 | 63 | } |
59 | 64 | |
60 | - public function registerNamespace($prefix, $namespace){ |
|
65 | + public function registerNamespace($prefix, $namespace) |
|
66 | + { |
|
61 | 67 | $this->namespaceRegister[$prefix] = $namespace; |
62 | 68 | } |
63 | 69 | |
64 | - public function getNamespaceForPrefix($prefix){ |
|
70 | + public function getNamespaceForPrefix($prefix) |
|
71 | + { |
|
65 | 72 | return $this->namespaceRegister[$prefix]; |
66 | 73 | } |
67 | 74 | |
@@ -90,7 +97,8 @@ discard block |
||
90 | 97 | return $this->odataVersion == OdataVersions::THREE(); |
91 | 98 | |
92 | 99 | } |
93 | - public function getXml(){ |
|
100 | + public function getXml() |
|
101 | + { |
|
94 | 102 | return $this->baseDocument->saveXML(); |
95 | 103 | } |
96 | 104 | |
@@ -106,19 +114,19 @@ discard block |
||
106 | 114 | $prefix = substr($qualifiedName,0,strpos($qualifiedName, ':')); |
107 | 115 | } |
108 | 116 | $domElement = $this->baseDocument->createElementNS($this->getNamespaceForPrefix($prefix), $qualifiedName); |
109 | - if($isTopLevel){ |
|
117 | + if($isTopLevel) { |
|
110 | 118 | $this->setUpNamespaces($domElement); |
111 | 119 | } |
112 | 120 | |
113 | 121 | $domElement->textContent = $rootNode->getTextContent(); |
114 | 122 | |
115 | - foreach( $rootNode->getAttributes($this) as $attribute){ |
|
116 | - if($this->shouldWrite($attribute)){ |
|
123 | + foreach( $rootNode->getAttributes($this) as $attribute) { |
|
124 | + if($this->shouldWrite($attribute)) { |
|
117 | 125 | $attribute->apply($domElement, $this ); |
118 | 126 | |
119 | 127 | } |
120 | 128 | } |
121 | - foreach(array_filter($rootNode->getChildElements()) as $childNode){ |
|
129 | + foreach(array_filter($rootNode->getChildElements()) as $childNode) { |
|
122 | 130 | $childElement = $this->write($childNode, false); |
123 | 131 | |
124 | 132 | $domElement->appendChild($childElement); |
@@ -127,7 +135,8 @@ discard block |
||
127 | 135 | |
128 | 136 | } |
129 | 137 | |
130 | - protected function shouldWrite(IAttribute $attribute){ |
|
138 | + protected function shouldWrite(IAttribute $attribute) |
|
139 | + { |
|
131 | 140 | return |
132 | 141 | ( |
133 | 142 | OdataVersions::TWO() == $attribute->getAttributeForVersion() && $this->shouldWriteV2() || |
@@ -137,15 +146,17 @@ discard block |
||
137 | 146 | !in_array($this->getOdataVersion(), $attribute->getAttributeProhibitedVersion()); |
138 | 147 | } |
139 | 148 | |
140 | - private function registerNamespaces(){ |
|
149 | + private function registerNamespaces() |
|
150 | + { |
|
141 | 151 | $this->registerNamespace(null, $this->getEdmNamespace()); |
142 | 152 | $this->registerNamespace("annotations", $this->getAnnotationsNamespace()); |
143 | 153 | $this->registerNamespace('metadata', $this->getMetadataNamespace()); |
144 | 154 | $this->registerNamespace('edmx', $this->getEdmxNamespace()); |
145 | 155 | } |
146 | 156 | |
147 | - private function setUpNamespaces(DOMElement $rootElement){ |
|
148 | - foreach($this->namespaceRegister as $prefix => $namespace){ |
|
157 | + private function setUpNamespaces(DOMElement $rootElement) |
|
158 | + { |
|
159 | + foreach($this->namespaceRegister as $prefix => $namespace) { |
|
149 | 160 | $qualifiedName = $prefix === "" ? 'xmlns' : 'xmlns:' . $prefix; |
150 | 161 | $rootElement->setAttributeNS( |
151 | 162 | 'http://www.w3.org/2000/xmlns/', |