Skip to content

Commit c46625d

Browse files
committed
apply psr2 codestyle changes
1 parent 7d73664 commit c46625d

7 files changed

+325
-282
lines changed

phpcs.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
<exclude-pattern>vendor/*</exclude-pattern>
77

8+
<rule ref="PSR1" />
89
<rule ref="PSR2" />
910

1011
</ruleset>

src/PrestaShopWebserviceException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
class PrestaShopWebserviceException extends \Exception
66
{
77

8-
}
8+
}

src/PrestashopWebService.php

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,36 @@ class PrestashopWebService extends PrestashopWebServiceLibrary
1515
* @return SimpleXMLElement
1616
* @throws PrestaShopWebserviceException
1717
*/
18-
public function getSchema($resource , $schema = 'blank')
18+
public function getSchema($resource, $schema = 'blank')
1919
{
2020
return $this->get(['resource' => $resource . "?schema=$schema"]);
2121
}
2222

2323
/**
24-
* Fill the provided schema with an associative array data, also remove the useless XML nodes if the corresponding flag is true
24+
* Fill the provided schema with an associative array data, also remove the useless XML nodes if
25+
* the corresponding flag is true
2526
*
2627
* @param SimpleXMLElement $xmlSchema
2728
* @param array $data
2829
* @param bool $removeUselessNodes set true if you want to remove nodes that are not present in the data array
29-
* @param array $removeSpecificNodes If $removeUselessNodes is false you may add here the first level nodes that you want to remove
30+
* @param array $removeSpecificNodes If $removeUselessNodes is false you may add here the first level nodes that
31+
* you want to remove
3032
* @return SimpleXMLElement
3133
*/
32-
public function fillSchema(SimpleXMLElement $xmlSchema, $data, $removeUselessNodes = true, $removeSpecificNodes=array())
33-
{
34+
public function fillSchema(
35+
SimpleXMLElement $xmlSchema,
36+
$data,
37+
$removeUselessNodes = true,
38+
$removeSpecificNodes = array()
39+
) {
3440
$resource = $xmlSchema->children()->children();
3541
foreach ($data as $key => $value) {
3642
$this->processNode($resource, $key, $value);
3743
}
3844
if ($removeUselessNodes) {
3945
$this->checkForUselessNodes($resource, $data);
40-
}
41-
else{
42-
$this->removeSpecificNodes($resource,$removeSpecificNodes);
46+
} else {
47+
$this->removeSpecificNodes($resource, $removeSpecificNodes);
4348
}
4449
return $xmlSchema;
4550
}
@@ -80,13 +85,12 @@ private function fillLanguageNode($node, $data)
8085
*/
8186
private function processNode(SimpleXMLElement $node, $dataKey, $dataValue)
8287
{
83-
if(is_int($dataKey)){
84-
if($dataKey===0){
88+
if (is_int($dataKey)) {
89+
if ($dataKey===0) {
8590
$this->emptyNode($node);
8691
}
87-
$this->createNode($node,$dataValue);
88-
}
89-
elseif (property_exists($node->$dataKey, 'language')) {
92+
$this->createNode($node, $dataValue);
93+
} elseif (property_exists($node->$dataKey, 'language')) {
9094
$this->fillLanguageNode($node->$dataKey, $dataValue);
9195
} elseif (is_array($dataValue)) {
9296
foreach ($dataValue as $key => $value) {
@@ -134,17 +138,15 @@ private function removeSpecificNodes($resource, $removeSpecificNodes)
134138
private function createNode(SimpleXMLElement $node, $dataValue)
135139
{
136140
foreach ($dataValue as $key => $value) {
137-
if(is_array($value)){
138-
if(is_int($key)){
139-
$this->createNode($node,$value);
140-
}
141-
else{
141+
if (is_array($value)) {
142+
if (is_int($key)) {
143+
$this->createNode($node, $value);
144+
} else {
142145
$childNode=$node->addChild($key);
143-
$this->createNode($childNode,$value);
146+
$this->createNode($childNode, $value);
144147
}
145-
}
146-
else{
147-
$node->addChild($key,$value);
148+
} else {
149+
$node->addChild($key, $value);
148150
}
149151
}
150152
}
@@ -162,4 +164,4 @@ private function emptyNode(SimpleXMLElement $node)
162164
unset($node->$nodeName);
163165
}
164166
}
165-
}
167+
}

src/PrestashopWebServiceFacade.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Protechstudio\PrestashopWebService;
44

5-
65
use Illuminate\Support\Facades\Facade;
76

87
class PrestashopWebServiceFacade extends Facade
@@ -12,5 +11,4 @@ protected static function getFacadeAccessor()
1211
{
1312
return PrestashopWebService::class;
1413
}
15-
16-
}
14+
}

0 commit comments

Comments
 (0)