projects
/
yaffs-website
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website]
/
vendor
/
symfony
/
routing
/
RouteCollection.php
diff --git
a/vendor/symfony/routing/RouteCollection.php
b/vendor/symfony/routing/RouteCollection.php
index 2ccb90f3b096696963487f9a726cf83d63341a48..c42229af2878250fe5478eeb253d7c343a8052a2 100644
(file)
--- a/
vendor/symfony/routing/RouteCollection.php
+++ b/
vendor/symfony/routing/RouteCollection.php
@@
-63,7
+63,7
@@
class RouteCollection implements \IteratorAggregate, \Countable
*/
public function count()
{
*/
public function count()
{
- return count($this->routes);
+ return
\
count($this->routes);
}
/**
}
/**
@@
-104,7
+104,7
@@
class RouteCollection implements \IteratorAggregate, \Countable
/**
* Removes a route or an array of routes by name from the collection.
*
/**
* Removes a route or an array of routes by name from the collection.
*
- * @param string|
array
$name The route name or an array of route names
+ * @param string|
string[]
$name The route name or an array of route names
*/
public function remove($name)
{
*/
public function remove($name)
{
@@
-116,10
+116,8
@@
class RouteCollection implements \IteratorAggregate, \Countable
/**
* Adds a route collection at the end of the current set by appending all
* routes of the added collection.
/**
* Adds a route collection at the end of the current set by appending all
* routes of the added collection.
- *
- * @param RouteCollection $collection A RouteCollection instance
*/
*/
- public function addCollection(
RouteCollection
$collection)
+ public function addCollection(
self
$collection)
{
// we need to remove all routes with the same names first because just replacing them
// would not place the new route at the end of the merged array
{
// we need to remove all routes with the same names first because just replacing them
// would not place the new route at the end of the merged array
@@
-128,7
+126,9
@@
class RouteCollection implements \IteratorAggregate, \Countable
$this->routes[$name] = $route;
}
$this->routes[$name] = $route;
}
- $this->resources = array_merge($this->resources, $collection->getResources());
+ foreach ($collection->getResources() as $resource) {
+ $this->addResource($resource);
+ }
}
/**
}
/**
@@
-234,7
+234,7
@@
class RouteCollection implements \IteratorAggregate, \Countable
/**
* Sets the schemes (e.g. 'https') all child routes are restricted to.
*
/**
* Sets the schemes (e.g. 'https') all child routes are restricted to.
*
- * @param string|
array
$schemes The scheme or an array of schemes
+ * @param string|
string[]
$schemes The scheme or an array of schemes
*/
public function setSchemes($schemes)
{
*/
public function setSchemes($schemes)
{
@@
-246,7
+246,7
@@
class RouteCollection implements \IteratorAggregate, \Countable
/**
* Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
*
/**
* Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
*
- * @param string|
array
$methods The method or an array of methods
+ * @param string|
string[]
$methods The method or an array of methods
*/
public function setMethods($methods)
{
*/
public function setMethods($methods)
{
@@
-262,16
+262,19
@@
class RouteCollection implements \IteratorAggregate, \Countable
*/
public function getResources()
{
*/
public function getResources()
{
- return array_
unique
($this->resources);
+ return array_
values
($this->resources);
}
/**
}
/**
- * Adds a resource for this collection.
- *
- * @param ResourceInterface $resource A resource instance
+ * Adds a resource for this collection. If the resource already exists
+ * it is not added.
*/
public function addResource(ResourceInterface $resource)
{
*/
public function addResource(ResourceInterface $resource)
{
- $this->resources[] = $resource;
+ $key = (string) $resource;
+
+ if (!isset($this->resources[$key])) {
+ $this->resources[$key] = $resource;
+ }
}
}
}
}