Router

class OC\Route\Router
Source:lib/private/Route/Router.php#48
Implements:OCP\Route\IRouter

Properties

protected static property OC\Route\Router::$collections
Source:lib/private/Route/Router.php#50
Type:\Symfony\Component\Routing\RouteCollection[]
protected static property OC\Route\Router::$collection
Source:lib/private/Route/Router.php#52
Type:null | \Symfony\Component\Routing\RouteCollection
protected static property OC\Route\Router::$collectionName
Source:lib/private/Route/Router.php#54
Type:null | string
protected static property OC\Route\Router::$root
Source:lib/private/Route/Router.php#56
Type:null | \Symfony\Component\Routing\RouteCollection
protected static property OC\Route\Router::$generator
Source:lib/private/Route/Router.php#58
Type:null | \Symfony\Component\Routing\Generator\UrlGenerator
protected static property OC\Route\Router::$routingFiles
Source:lib/private/Route/Router.php#60
Type:string[] | null
protected static property OC\Route\Router::$loaded
Source:lib/private/Route/Router.php#62
Type:bool
protected static property OC\Route\Router::$loadedApps
Source:lib/private/Route/Router.php#64
Type:array
protected static property OC\Route\Router::$logger
Source:lib/private/Route/Router.php#66
Type:\OCP\ILogger
protected static property OC\Route\Router::$context
Source:lib/private/Route/Router.php#68
Type:\Symfony\Component\Routing\RequestContext

Methods

public OC\Route\Router::__construct($logger)
Source:

lib/private/Route/Router.php#73

Parameters:
public OC\Route\Router::getRoutingFiles()
Get the files to load the routes from
Source:lib/private/Route/Router.php#97
Returns:string[]
public OC\Route\Router::loadRoutes($app=null)
Loads the routes
Source:

lib/private/Route/Router.php#118

Parameters:
  • $app (null | string)
protected OC\Route\Router::getCollection($name)
Source:

lib/private/Route/Router.php#184

Parameters:
  • $name (string)
Returns:

\Symfony\Component\Routing\RouteCollection

public OC\Route\Router::useCollection($name)
Sets the collection to use for adding routes
Source:

lib/private/Route/Router.php#197

Parameters:
  • $name (string) Name of the collection to use.
Returns:

void

public OC\Route\Router::getCurrentCollection()
returns the current collection name in use for adding routes
Source:lib/private/Route/Router.php#207
Returns:string the collection name
public OC\Route\Router::create($name, $pattern, $defaults=[], $requirements=[])
Create a \OC\Route\Route.
Source:

lib/private/Route/Router.php#221

Parameters:
  • $name (string) Name of the route to create.
  • $pattern (string) The pattern to match
  • $defaults (array) An array of default parameter values
  • $requirements (array) An array of requirements for parameters (regexes)
Returns:

\OC\Route\Route

public OC\Route\Router::findMatchingRoute($url)
Find the route matching $url
Source:

lib/private/Route/Router.php#237

Parameters:
  • $url (string) The url to find
Throws:

\Exception

Returns:

array

public OC\Route\Router::match($url)
Find and execute the route matching $url
Source:

lib/private/Route/Router.php#293

Parameters:
  • $url (string) The url to find
Throws:

\Exception

Returns:

void

public OC\Route\Router::getGenerator()
Get the url generator
Source:lib/private/Route/Router.php#325
Returns:\Symfony\Component\Routing\Generator\UrlGenerator
public OC\Route\Router::generate($name, $parameters=[], $absolute=false)
Generate url based on $name and $parameters
Source:

lib/private/Route/Router.php#341

Parameters:
  • $name (string) Name of the route to use.
  • $parameters (array) Parameters for the route
  • $absolute (bool)
Returns:

string

protected OC\Route\Router::fixLegacyRootName($routeName)
Source:lib/private/Route/Router.php#372