1 | <?php |
||
20 | class RestlerEnhancer extends RestlerBuilderAware implements DecoratingEnhancerInterface |
||
21 | { |
||
22 | private $default; |
||
23 | |||
24 | public function __construct($configuration) |
||
35 | |||
36 | /** |
||
37 | * Gets pattern that can be used to redecorate (undecorate) |
||
38 | * a potential previously decorated route path. |
||
39 | * |
||
40 | * Example: |
||
41 | * + route path: 'first/second.html' |
||
42 | * + redecoration pattern: '(?:\.html|\.json)$' |
||
43 | * -> 'first/second' might be the redecorated route path after |
||
44 | * applying the redecoration pattern to preg_match/preg_replace |
||
45 | * |
||
46 | * @return string regular expression pattern |
||
47 | */ |
||
48 | public function getRoutePathRedecorationPattern(): string |
||
52 | |||
53 | /** |
||
54 | * Decorates route collection to be processed during URL resolving. |
||
55 | * Executed before invoking routing enhancers. |
||
56 | * |
||
57 | * @param RouteCollection $collection |
||
58 | * @param string $routePath URL path |
||
59 | */ |
||
60 | public function decorateForMatching(RouteCollection $collection, string $routePath): void |
||
75 | |||
76 | /** |
||
77 | * Decorates route collection during URL URL generation. |
||
78 | * Executed before invoking routing enhancers. |
||
79 | * |
||
80 | * @param RouteCollection $collection |
||
81 | * @param array $parameters query parameters |
||
82 | */ |
||
83 | public function decorateForGeneration(RouteCollection $collection, array $parameters): void |
||
86 | |||
87 | /** |
||
88 | * @param AspectInterface[] $aspects |
||
89 | */ |
||
90 | public function setAspects(array $aspects): void |
||
93 | |||
94 | /** |
||
95 | * @return AspectInterface[] |
||
96 | */ |
||
97 | public function getAspects(): array |
||
101 | |||
102 | private function isRestlerUrl($uri): bool |
||
106 | } |
||
107 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: