Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/routing/RouteCollectionBuilder.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
23 class RouteCollectionBuilder | 23 class RouteCollectionBuilder |
24 { | 24 { |
25 /** | 25 /** |
26 * @var Route[]|RouteCollectionBuilder[] | 26 * @var Route[]|RouteCollectionBuilder[] |
27 */ | 27 */ |
28 private $routes = array(); | 28 private $routes = []; |
29 | 29 |
30 private $loader; | 30 private $loader; |
31 private $defaults = array(); | 31 private $defaults = []; |
32 private $prefix; | 32 private $prefix; |
33 private $host; | 33 private $host; |
34 private $condition; | 34 private $condition; |
35 private $requirements = array(); | 35 private $requirements = []; |
36 private $options = array(); | 36 private $options = []; |
37 private $schemes; | 37 private $schemes; |
38 private $methods; | 38 private $methods; |
39 private $resources = array(); | 39 private $resources = []; |
40 | 40 |
41 public function __construct(LoaderInterface $loader = null) | 41 public function __construct(LoaderInterface $loader = null) |
42 { | 42 { |
43 $this->loader = $loader; | 43 $this->loader = $loader; |
44 } | 44 } |
45 | 45 |
46 /** | 46 /** |
47 * Import an external routing resource and returns the RouteCollectionBuilder. | 47 * Import an external routing resource and returns the RouteCollectionBuilder. |
48 * | 48 * |
49 * $routes->import('blog.yml', '/blog'); | 49 * $routes->import('blog.yml', '/blog'); |
50 * | 50 * |
51 * @param mixed $resource | 51 * @param mixed $resource |
52 * @param string|null $prefix | 52 * @param string|null $prefix |
53 * @param string $type | 53 * @param string $type |
54 * | 54 * |
330 private function generateRouteName(Route $route) | 330 private function generateRouteName(Route $route) |
331 { | 331 { |
332 $methods = implode('_', $route->getMethods()).'_'; | 332 $methods = implode('_', $route->getMethods()).'_'; |
333 | 333 |
334 $routeName = $methods.$route->getPath(); | 334 $routeName = $methods.$route->getPath(); |
335 $routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName); | 335 $routeName = str_replace(['/', ':', '|', '-'], '_', $routeName); |
336 $routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName); | 336 $routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName); |
337 | 337 |
338 // Collapse consecutive underscores down into a single underscore. | 338 // Collapse consecutive underscores down into a single underscore. |
339 $routeName = preg_replace('/_+/', '_', $routeName); | 339 $routeName = preg_replace('/_+/', '_', $routeName); |
340 | 340 |
358 } | 358 } |
359 | 359 |
360 if ($this->loader->supports($resource, $type)) { | 360 if ($this->loader->supports($resource, $type)) { |
361 $collections = $this->loader->load($resource, $type); | 361 $collections = $this->loader->load($resource, $type); |
362 | 362 |
363 return is_array($collections) ? $collections : array($collections); | 363 return \is_array($collections) ? $collections : [$collections]; |
364 } | 364 } |
365 | 365 |
366 if (null === $resolver = $this->loader->getResolver()) { | 366 if (null === $resolver = $this->loader->getResolver()) { |
367 throw new FileLoaderLoadException($resource, null, null, null, $type); | 367 throw new FileLoaderLoadException($resource, null, null, null, $type); |
368 } | 368 } |
371 throw new FileLoaderLoadException($resource, null, null, null, $type); | 371 throw new FileLoaderLoadException($resource, null, null, null, $type); |
372 } | 372 } |
373 | 373 |
374 $collections = $loader->load($resource, $type); | 374 $collections = $loader->load($resource, $type); |
375 | 375 |
376 return is_array($collections) ? $collections : array($collections); | 376 return \is_array($collections) ? $collections : [$collections]; |
377 } | 377 } |
378 } | 378 } |