1 | <?php |
||
22 | class RestlerEnhancer implements DecoratingEnhancerInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var RestlerBuilder |
||
26 | */ |
||
27 | private $restlerBuilder; |
||
28 | |||
29 | private $default; |
||
30 | |||
31 | public function __construct($configuration) |
||
43 | |||
44 | |||
45 | /** |
||
46 | * Gets pattern that can be used to redecorate (undecorate) |
||
47 | * a potential previously decorated route path. |
||
48 | * |
||
49 | * Example: |
||
50 | * + route path: 'first/second.html' |
||
51 | * + redecoration pattern: '(?:\.html|\.json)$' |
||
52 | * -> 'first/second' might be the redecorated route path after |
||
53 | * applying the redecoration pattern to preg_match/preg_replace |
||
54 | * |
||
55 | * @return string regular expression pattern |
||
56 | */ |
||
57 | public function getRoutePathRedecorationPattern(): string |
||
61 | |||
62 | /** |
||
63 | * Decorates route collection to be processed during URL resolving. |
||
64 | * Executed before invoking routing enhancers. |
||
65 | * |
||
66 | * @param RouteCollection $collection |
||
67 | * @param string $routePath URL path |
||
68 | */ |
||
69 | public function decorateForMatching(RouteCollection $collection, string $routePath): void |
||
82 | |||
83 | /** |
||
84 | * Decorates route collection during URL URL generation. |
||
85 | * Executed before invoking routing enhancers. |
||
86 | * |
||
87 | * @param RouteCollection $collection |
||
88 | * @param array $parameters query parameters |
||
89 | */ |
||
90 | public function decorateForGeneration(RouteCollection $collection, array $parameters): void |
||
93 | |||
94 | /** |
||
95 | * @param AspectInterface[] $aspects |
||
96 | */ |
||
97 | public function setAspects(array $aspects): void |
||
100 | |||
101 | /** |
||
102 | * @return AspectInterface[] |
||
103 | */ |
||
104 | public function getAspects(): array |
||
108 | |||
109 | private function isRestlerUrl($uri): bool |
||
113 | |||
114 | } |
||
115 |
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: