Test Failed
Pull Request — master (#154)
by Alex
09:09
created
src/Writer/AttributeContainer.php 2 patches
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
     private function strval($value):string
113 113
     {
114
-        if(is_bool($value)){
114
+        if (is_bool($value)) {
115 115
             return $value ? "true" : "false";
116 116
         }
117 117
         return strval($value);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     public function setAttributeName(string $name): AttributeContainer
136 136
     {
137 137
         $prefix = null;
138
-        if(strpos($name, ':') !== false) {
138
+        if (strpos($name, ':') !== false) {
139 139
             list($prefix, $name) = explode(":", $name);
140 140
         }
141 141
         $this->name = $name;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             return;
171 171
         }
172 172
         if (null === $this->prefix) {
173
-$node->setAttribute($this->name,$this->value);
173
+$node->setAttribute($this->name, $this->value);
174 174
         } else {
175 175
                 $node->setAttributeNS($context->getNamespaceForPrefix($this->prefix), $this->prefix . ':' . $this->name, $this->value);
176 176
         }
Please login to merge, or discard this patch.
src/MetadataV3/edm/EntityType/PropertyHolder.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
         unset($this->property[$offset]);
44 44
     }
45 45
 
46
-    public function __toArray(){
46
+    public function __toArray() {
47 47
         return $this->property;
48 48
     }
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Writer/WritterContext.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -38,34 +38,34 @@  discard block
 block discarded – undo
38 38
         return $this->baseDocument;
39 39
     }
40 40
 
41
-    public function getEdmNamespace(){
41
+    public function getEdmNamespace() {
42 42
         return $this->namespaceContainer->getEdmNamespace();
43 43
     }
44
-    public function getEdmxNamespace(){
44
+    public function getEdmxNamespace() {
45 45
         return $this->namespaceContainer->getEdmxNamespace();
46 46
     }
47
-    public function getMetadataNamespace(){
47
+    public function getMetadataNamespace() {
48 48
         return $this->namespaceContainer->getMetadataNamespace();
49 49
     }
50
-    public function getDataServiceNamespace(){
50
+    public function getDataServiceNamespace() {
51 51
         return $this->namespaceContainer->getDataServiceNamespace();
52 52
     }
53
-    public function getAnnotationsNamespace(){
53
+    public function getAnnotationsNamespace() {
54 54
         return $this->namespaceContainer->getAnnotationsNamespace();
55 55
     }
56 56
     public function getOdataVersion():string {
57 57
         return strval($this->odataVersion);
58 58
     }
59 59
 
60
-    public function registerNamespace($prefix, $namespace){
60
+    public function registerNamespace($prefix, $namespace) {
61 61
         $this->namespaceRegister[$prefix] = $namespace;
62 62
     }
63 63
 
64
-    public function getNamespaceForPrefix($prefix){
64
+    public function getNamespaceForPrefix($prefix) {
65 65
         return $this->namespaceRegister[$prefix];
66 66
     }
67 67
 
68
-    protected function createElement($namespace,$name): DOMElement
68
+    protected function createElement($namespace, $name): DOMElement
69 69
     {
70 70
         return $this->baseDocument->createElementNS($namespace, $name);
71 71
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         return $this->odataVersion == OdataVersions::THREE();
91 91
 
92 92
     }
93
-    public function getXml(){
93
+    public function getXml() {
94 94
         return $this->baseDocument->saveXML();
95 95
     }
96 96
 
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
     public function write(DomBase $rootNode, bool $isTopLevel = true): DOMElement{
103 103
         $prefix = null;
104 104
         $qualifiedName = $rootNode->getDomName();
105
-        if(strpos($qualifiedName, ':') !== false) {
106
-            $prefix = substr($qualifiedName,0,strpos($qualifiedName, ':'));
105
+        if (strpos($qualifiedName, ':') !== false) {
106
+            $prefix = substr($qualifiedName, 0, strpos($qualifiedName, ':'));
107 107
         }
108 108
         $domElement = $this->baseDocument->createElementNS($this->getNamespaceForPrefix($prefix), $qualifiedName);
109
-        if($isTopLevel){
109
+        if ($isTopLevel) {
110 110
             $this->setUpNamespaces($domElement);
111 111
         }
112 112
 
113 113
         $domElement->textContent = $rootNode->getTextContent();
114 114
 
115
-        foreach( $rootNode->getAttributes($this) as $attribute){
116
-            if($this->shouldWrite($attribute)){
117
-                $attribute->apply($domElement, $this );
115
+        foreach ($rootNode->getAttributes($this) as $attribute) {
116
+            if ($this->shouldWrite($attribute)) {
117
+                $attribute->apply($domElement, $this);
118 118
 
119 119
             }
120 120
         }
121
-        foreach(array_filter($rootNode->getChildElements()) as $childNode){
121
+        foreach (array_filter($rootNode->getChildElements()) as $childNode) {
122 122
             $childElement = $this->write($childNode, false);
123 123
 
124 124
             $domElement->appendChild($childElement);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
     }
129 129
 
130
-    protected function shouldWrite(IAttribute $attribute){
130
+    protected function shouldWrite(IAttribute $attribute) {
131 131
         return
132 132
             (
133 133
                 OdataVersions::TWO() == $attribute->getAttributeForVersion() && $this->shouldWriteV2() ||
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
             !in_array($this->getOdataVersion(), $attribute->getAttributeProhibitedVersion());
138 138
     }
139 139
 
140
-    private function registerNamespaces(){
140
+    private function registerNamespaces() {
141 141
         $this->registerNamespace(null, $this->getEdmNamespace());
142 142
         $this->registerNamespace("annotations", $this->getAnnotationsNamespace());
143 143
         $this->registerNamespace('metadata', $this->getMetadataNamespace());
144 144
         $this->registerNamespace('edmx', $this->getEdmxNamespace());
145 145
     }
146 146
 
147
-    private function setUpNamespaces(DOMElement $rootElement){
148
-        foreach($this->namespaceRegister as $prefix => $namespace){
147
+    private function setUpNamespaces(DOMElement $rootElement) {
148
+        foreach ($this->namespaceRegister as $prefix => $namespace) {
149 149
             $qualifiedName = $prefix === "" ? 'xmlns' : 'xmlns:' . $prefix;
150 150
             $rootElement->setAttributeNS(
151 151
                 'http://www.w3.org/2000/xmlns/',
Please login to merge, or discard this patch.
Braces   +27 added lines, -16 removed lines patch added patch discarded remove patch
@@ -38,30 +38,37 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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/',
Please login to merge, or discard this patch.