Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
CallableParser.php
Go to the documentation of this file.
1<?php
2
7
9
19
20 public static function parseRouteArray(&$result, $callable, $routeArray, \ReflectionFunction $function, $prefix = "", $httpMethods = NULL) {
21 $pathParameters = ControllerParser::addParamsPath ( $routeArray ["path"], $function, $routeArray ["requirements"] );
22 $name = $routeArray ["name"];
23 if (! isset ( $name )) {
24 $name = UString::cleanAttribute ( $pathParameters );
25 }
26 $cache = $routeArray ["cache"];
27 $duration = $routeArray ["duration"];
28 $path = $pathParameters ["path"];
29 $parameters = $pathParameters ["parameters"];
30 $priority = $routeArray ["priority"];
31 $path = ControllerParser::cleanpath ( $prefix, $path );
32 if (isset ( $routeArray ["methods"] ) && \is_array ( $routeArray ["methods"] )) {
33 self::createRouteMethod ( $result, $callable, $path, $routeArray ["methods"], $parameters, $name, $cache, $duration, $priority );
34 } elseif (\is_array ( $httpMethods )) {
35 self::createRouteMethod ( $result, $callable, $path, $httpMethods, $parameters, $name, $cache, $duration, $priority );
36 } else {
37 $result [$path] = [ "controller" => $callable,"action" => "","parameters" => $parameters,"name" => $name,"cache" => $cache,"duration" => $duration,"priority" => $priority ];
38 }
39 }
40
41 private static function createRouteMethod(&$result, $callable, $path, $httpMethods, $parameters, $name, $cache, $duration, $priority) {
42 foreach ( $httpMethods as $httpMethod ) {
43 $result [$path] [$httpMethod] = [ "controller" => $callable,"action" => "","parameters" => $parameters,"name" => $name,"cache" => $cache,"duration" => $duration,"priority" => $priority ];
44 }
45 }
46}
47
Ubiquity\cache\parser$CallableParser This class is part of Ubiquity.
static parseRouteArray(&$result, $callable, $routeArray, \ReflectionFunction $function, $prefix="", $httpMethods=NULL)
static createRouteMethod(&$result, $callable, $path, $httpMethods, $parameters, $name, $cache, $duration, $priority)
static addParamsPath($path, \ReflectionFunctionAbstract $method, $requirements)
static cleanpath($prefix, $path="", &$isRoot=false)
String utilities.
Definition UString.php:15