8000 fixed CS · jeremymarc/symfony@2ab9974 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ab9974

Browse files
committed
fixed CS
1 parent b219ab6 commit 2ab9974

File tree

7 files changed

+56
-76
lines changed

7 files changed

+56
-76
lines changed

src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Routing\Matcher\Dumper;
1313

1414
/**
15-
* Collection of routes with attributes
15+
* Collection of routes with attributes.
1616
*
1717
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
1818
*/
@@ -23,8 +23,10 @@ class DumperCollection implements \IteratorAggregate
2323
private $attributes;
2424

2525
/**
26-
* @param array $routes Array of DumperCollection|DumperRoute
27-
* @param array $atributes Array of attributes
26+
* Constructor.
27+
*
28+
* @param array $routes Array of DumperCollection|DumperRoute
29+
* @param array $atributes Array of attributes
2830
*/
2931
public function __construct(array $routes = array(), array $attributes = array())
3032
{
@@ -33,7 +35,7 @@ public function __construct(array $routes = array(), array $attributes = array()
3335
}
3436

3537
/**
36-
* Returns the parent collection
38+
* Returns the parent collection.
3739
*
3840
* @return DumperCollection The parent collection
3941
*/
@@ -43,7 +45,7 @@ public function getParent()
4345
}
4446

4547
/**
46-
* Sets the parent collection
48+
* Sets the parent collection.
4749
*
4850
* @param DumperCollection $parent The parent collection
4951
*/
@@ -53,7 +55,7 @@ public function setParent(DumperCollection $parent)
5355
}
5456

5557
/**
56-
* Returns the child routes
58+
* Returns the child routes.
5759
*
5860
* @return array Array of DumperCollection|DumperRoute
5961
*/
@@ -63,9 +65,10 @@ public function getRoutes()
6365
}
6466

6567
/**
66-
* Gets a route by index
68+
* Gets a route by index.
69+
*
70+
* @param int $index The index
6771
*
68-
* @param int $index The index
6972
* @return DumperCollection|DumperRoute The route at given index
7073
*/
7174
public function getRoute($index)
@@ -74,7 +77,7 @@ public function getRoute($index)
7477
}
7578

7679
/**
77-
* Adds a route or route collection
80+
* Adds a route or route collection.
7881
*
7982
* @param DumperCollection|DumperRoute The route or route collection
8083
*/
@@ -87,9 +90,10 @@ public function addRoute($route)
8790
}
8891

8992
/**
90-
* Returns true if the attribute is defined
93+
* Returns true if the attribute is defined.
9194
*
9295
* @param string $name The attribute name
96+
*
9397
* @return Boolean true if the attribute is defined, false otherwise
9498
*/
9599
public function has($name)
@@ -98,23 +102,20 @@ public function has($name)
98102
}
99103

100104
/**
101-
* Returns an attribute by name
105+
* Returns an attribute by name.
106+
*
107+
* @param string $name The attribute name
108+
* @param mixed $default Default value is the attribute doesn't exist
102109
*
103-
* @param string $name The attribute name
104-
* @param mixed $default Default value is the attribute doesn't exist
105110
* @return mixed The attribute value
106111
*/
107112
public function get($name, $default = null)
108113
{
109-
if ($this->has($name)) {
110-
return $this->attributes[$name];
111-
} else {
112-
return $default;
113-
}
114+
return $this->has($name) ? $this->attributes[$name] : $default;
114115
}
115116

116117
/**
117-
* Sets an attribute by name
118+
* Sets an attribute by name.
118119
*
119120
* @param string $name The attribute name
120121
* @param mixed $value The attribute value
@@ -125,7 +126,7 @@ public function set($name, $value)
125126
}
126127

127128
/**
128-
* Returns an iterator over the children
129+
* Returns an iterator over the children.
129130
*
130131
* @return \Iterator The iterator
131132
*/
@@ -135,11 +136,12 @@ public function getIterator()
135136
}
136137

137138
/**
138-
* Clones the collection and its parents, up to the given parent
139+
* Clones the collection and its parents, up to the given parent.
139140
*
140-
* Children are reset
141+
* Children are reset.
142+
*
143+
* @param DumperCollection $until If given, cloning will stop before this parent
141144
*
142-
* @param DumperCollection $until If given, cloning will stop before this parent
143145
* @return DumperCollection The cloned collection
144146
*/
145147
public function cloneHierarchyUntil(DumperCollection $until = null)
@@ -160,35 +162,27 @@ public function cloneHierarchyUntil(DumperCollection $until = null)
160162
}
161163

162164
/**
163-
* Returns the root of the collection
165+
* Returns the root of the collection.
164166
*
165167
* @return DumperCollection|null The root collection
166168
*/
167169
public function getRoot()
168170
{
169-
if (null !== $parent = $this->parent) {
170-
return $parent->getRoot();
171-
} else {
172-
return $this;
173-
}
171+
return (null !== $parent = $this->parent) ? $parent->getRoot() : $this;
174172
}
175173

176174
/**
177-
* Returns an array of parent collections, from the closer parent to the root
175+
* Returns an array of parent collections, from the closer parent to the root.
178176
*
179177
* @return array Array of DumperCollection parents
180178
*/
181179
public function getParents()
182180
{
183-
if ($parent = $this->parent) {
184-
return array_merge(array($parent), $parent->getParents());
185-
} else {
186-
return array();
187-
}
181+
return $this->parent ? array_merge(array($this->parent), $this->parent->getParents()) : array();
188182
}
189183

190184
/**
191-
* Returns an array of this collection and its parents, from this collection to the root
185+
* Returns an array of this collection and its parents, from this collection to the root.
192186
*
193187
* @return array Array of DumperCollection collections
194188
*/
@@ -198,7 +192,7 @@ public function getParentsAndSelf()
198192
}
199193

200194
/**
201-
* Returns a debug string representation of this collection
195+
* Returns a debug string representation of this collection.
202196
*
203197
* @param Callable $toString Callback used to get the string representation of each individual child
204198
* @param string $prefix String prepended to each line
@@ -216,4 +210,3 @@ public function toString($toString, $prefix)
216210
return $string;
217211
}
218212
}
219-

src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Routing\Matcher\Dumper;
1313

1414
/**
15-
* Prefix tree of routes preserving routes order
15+
* Prefix tree of routes preserving routes order.
1616
*
1717
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
1818
*/
@@ -21,7 +21,7 @@ class DumperPrefixCollection extends DumperCollection
2121
private $prefix;
2222

2323
/**
24-
* Returns the prefix
24+
* Returns the prefix.
2525
*
2626
* @return string The prefix
2727
*/
@@ -31,7 +31,7 @@ public function getPrefix()
3131
}
3232

3333
/**
34-
* Sets the prefix
34+
* Sets the prefix.
3535
*
3636
* @param string $prefix The prefix
3737
*/
@@ -41,9 +41,10 @@ public function setPrefix($prefix)
4141
}
4242

4343
/**
44-
* Adds a route in the tree
44+
* Adds a route in the tree.
45+
*
46+
* @param DumperRoute $route The route
4547
*
46-
* @param DumperRoute $route The route
4748
* @return DumperPrefixCollection The node the route was added to
4849
*/
4950
public function addPrefixRoute(DumperRoute $route)
@@ -52,8 +53,8 @@ public function addPrefixRoute(DumperRoute $route)
5253

5354
if ($this->getPrefix() === $prefix) {
5455
$this->addRoute($route);
55-
return $this;
5656

57+
return $this;
5758
} else if ('' === $this->getPrefix() || 0 === strpos($prefix, $this->getPrefix())) {
5859
$prev = $this;
5960
for ($i = strlen($this->getPrefix()); $i < strlen($prefix); ++$i) {
@@ -66,10 +67,8 @@ public function addPrefixRoute(DumperRoute $route)
6667
$collection->addRoute($route);
6768

6869
return $collection;
69-
7070
} else {
7171
return $this->getParent()->addPrefixRoute($route);
7272
}
7373
}
7474
}
75-

src/Symfony/Component/Routing/Matcher/Dumper/DumperRoute.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Routing\RouteCollection;
1616

1717
/**
18-
* Container for a Route
18+
* Container for a Route.
1919
*
2020
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
2121
*/
@@ -26,6 +26,8 @@ class DumperRoute
2626
private $parentCollection;
2727

2828
/**
29+
* Constructor.
30+
*
2931
* @param string $name The route name
3032
* @param Route $route The route
3133
* @param RouteCollection $parentCollection The parent of the route
@@ -38,7 +40,7 @@ public function __construct($name, Route $route, RouteCollection $parentCollecti
3840
}
3941

4042
/**
41-
* Returns the route name
43+
* Returns the route name.
4244
*
4345
* @return string The route name
4446
*/
@@ -48,7 +50,7 @@ public function getName()
4850
}
4951

5052
/**
51-
* Returns the route
53+
* Returns the route.
5254
*
5355
* @return Route The route
5456
*/
@@ -58,7 +60,7 @@ public function getRoute()
5860
}
5961

6062
/**
61-
* Returns the parent collection
63+
* Returns the parent collection.
6264
*
6365
* @return RouteCollection the parent collection
6466
*/

0 commit comments

Comments
 (0)
0