Skip to content

Commit bb05602

Browse files
committed
Applied CS changes from sabre/cs
1 parent 71dbb2a commit bb05602

26 files changed

+131
-156
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ cache: vendor
1717

1818
script:
1919
- ./bin/phpunit --configuration tests/phpunit.xml.dist
20-
- ./bin/sabre-cs-fixer fix lib/ --dry-run --diff
20+
- ./bin/sabre-cs-fixer fix . --dry-run --diff
2121

2222
before_script: composer install

lib/Element.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Sabre\Xml;
44

5-
use XMLReader;
6-
75
/**
86
* This is the XML element interface.
97
*

lib/Element/Base.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,3 @@ static function xmlDeserialize(Xml\Reader $reader) {
8989
}
9090

9191
}
92-

lib/Element/Cdata.php

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

33
namespace Sabre\Xml\Element;
44

5-
use
6-
Sabre\Xml,
7-
LogicException;
5+
use Sabre\Xml;
86

97
/**
108
* CDATA element.

lib/Element/Elements.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function __construct(array $value = []) {
7272
*/
7373
function xmlSerialize(Xml\Writer $writer) {
7474

75-
foreach($this->value as $val) {
75+
foreach ($this->value as $val) {
7676
$writer->writeElement($val);
7777
}
7878

@@ -116,12 +116,11 @@ static function xmlDeserialize(Xml\Reader $reader) {
116116
$values[] = $reader->getClark();
117117
}
118118

119-
} while($reader->depth >= $currentDepth && $reader->next());
119+
} while ($reader->depth >= $currentDepth && $reader->next());
120120

121121
$reader->next();
122122
return $values;
123123

124124
}
125125

126126
}
127-

lib/Element/KeyValue.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Attributes will be removed, and duplicate child elements are discarded.
1212
* Complex values within the elements will be parsed by the 'standard' parser.
13-
13+
*
1414
* For example, KeyValue will parse:
1515
*
1616
* <?xml version="1.0"?>
@@ -129,4 +129,3 @@ static function xmlDeserialize(Xml\Reader $reader) {
129129
}
130130

131131
}
132-

lib/Element/Uri.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Sabre\Xml\Element;
44

55
use Sabre\Xml;
6-
use LogicException;
76

87
/**
98
* Uri element.

lib/Element/XmlFragment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ function xmlSerialize(Writer $writer) {
7070

7171
$elementNamespace = null;
7272

73-
while($reader->read()) {
73+
while ($reader->read()) {
7474

7575
if ($reader->depth < 1) {
7676
// Skipping the root node.
7777
continue;
7878
}
7979

80-
switch($reader->nodeType) {
80+
switch ($reader->nodeType) {
8181

8282
case Reader::ELEMENT :
8383
$writer->startElement(
8484
$reader->getClark()
8585
);
8686
$empty = $reader->isEmptyElement;
8787
while ($reader->moveToNextAttribute()) {
88-
switch($reader->namespaceURI) {
88+
switch ($reader->namespaceURI) {
8989
case '' :
9090
$writer->writeAttribute($reader->localName, $reader->value);
9191
break;

lib/Reader.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function parse() {
6262
// choice. See:
6363
//
6464
// https://bugs.php.net/bug.php?id=64230
65-
while($this->nodeType !== self::ELEMENT && @$this->read()) {
65+
while ($this->nodeType !== self::ELEMENT && @$this->read()) {
6666
// noop
6767
}
6868
$result = $this->parseCurrentElement();
@@ -119,9 +119,9 @@ function parseInnerTree(array $elementMap = null) {
119119
// https://bugs.php.net/bug.php?id=64230
120120
if (!@$this->read()) return false;
121121

122-
while(true) {
122+
while (true) {
123123

124-
switch($this->nodeType) {
124+
switch ($this->nodeType) {
125125
case self::ELEMENT :
126126
$elements[] = $this->parseCurrentElement();
127127
break;
@@ -147,7 +147,7 @@ function parseInnerTree(array $elementMap = null) {
147147
if (!is_null($elementMap)) {
148148
$this->popContext();
149149
}
150-
return ($elements?$elements:$text);
150+
return ($elements ? $elements : $text);
151151

152152
}
153153

@@ -161,9 +161,9 @@ function readText() {
161161
$result = '';
162162
$previousDepth = $this->depth;
163163

164-
while($this->read() && $this->depth != $previousDepth) {
164+
while ($this->read() && $this->depth != $previousDepth) {
165165
if (in_array($this->nodeType, [XMLReader::TEXT, XMLReader::CDATA, XMLReader::WHITESPACE])) {
166-
$result.=$this->value;
166+
$result .= $this->value;
167167
}
168168
}
169169
return $result;
@@ -193,25 +193,25 @@ function parseCurrentElement() {
193193
if (array_key_exists($name, $this->elementMap)) {
194194
$deserializer = $this->elementMap[$name];
195195
if (is_subclass_of($deserializer, 'Sabre\\Xml\\XmlDeserializable')) {
196-
$value = call_user_func( [ $deserializer, 'xmlDeserialize' ], $this);
196+
$value = call_user_func([ $deserializer, 'xmlDeserialize' ], $this);
197197
} elseif (is_callable($deserializer)) {
198198
$value = call_user_func($deserializer, $this);
199199
} else {
200200
$type = gettype($deserializer);
201-
if ($type==='string') {
202-
$type.=' (' . $deserializer . ')';
203-
} elseif ($type==='object') {
204-
$type.=' (' . get_class($deserializer) . ')';
201+
if ($type === 'string') {
202+
$type .= ' (' . $deserializer . ')';
203+
} elseif ($type === 'object') {
204+
$type .= ' (' . get_class($deserializer) . ')';
205205
}
206-
throw new \LogicException('Could not use this type as a deserializer: ' . $type );
206+
throw new \LogicException('Could not use this type as a deserializer: ' . $type);
207207
}
208208
} else {
209209
$value = Element\Base::xmlDeserialize($this);
210210
}
211211

212212
return [
213-
'name' => $name,
214-
'value' => $value,
213+
'name' => $name,
214+
'value' => $value,
215215
'attributes' => $attributes,
216216
];
217217
}
@@ -230,7 +230,7 @@ function parseAttributes() {
230230

231231
$attributes = [];
232232

233-
while($this->moveToNextAttribute()) {
233+
while ($this->moveToNextAttribute()) {
234234
if ($this->namespaceURI) {
235235

236236
// Ignoring 'xmlns', it doesn't make any sense.

lib/Service.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function getWriter() {
7676
*
7777
* The $rootElementName is specified by reference and will be populated
7878
* with the root element name of the document.
79-
79+
*
8080
* @param string|resource $input
8181
* @param string|null $contextUri
8282
* @param string|null $rootElementName
@@ -178,7 +178,7 @@ function write($rootElementName, $value, $contextUri = null) {
178178
*/
179179
static function parseClarkNotation($str) {
180180

181-
if (!preg_match('/^{([^}]*)}(.*)$/',$str,$matches)) {
181+
if (!preg_match('/^{([^}]*)}(.*)$/', $str, $matches)) {
182182
throw new \InvalidArgumentException('\'' . $str . '\' is not a valid clark-notation formatted string');
183183
}
184184

0 commit comments

Comments
 (0)