Total Complexity | 9 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
19 | class ProviderDecorator extends DelegatingProvider |
||
20 | { |
||
21 | /** |
||
22 | * Constructor |
||
23 | * |
||
24 | * @param Aliasing $aliasing |
||
25 | */ |
||
26 | public function __construct(Aliasing $aliasing) |
||
27 | { |
||
28 | parent::__construct(); |
||
29 | |||
30 | $this->aliasing = $aliasing; |
||
|
|||
31 | } |
||
32 | |||
33 | |||
34 | /** |
||
35 | * @{inheritDoc} |
||
36 | */ |
||
37 | public function url($object, array $options = array()) |
||
38 | { |
||
39 | try { |
||
40 | $ret = parent::url($object, $options); |
||
41 | } catch (UnsupportedException $e) { |
||
42 | if (is_string($object)) { |
||
43 | // allows for referencing strings to be aliased separately. |
||
44 | $ret = $object; |
||
45 | } else { |
||
46 | throw $e; |
||
47 | } |
||
48 | } |
||
49 | if ((!isset($options['aliasing']) || $options['aliasing'] == false) |
||
50 | && $publicUrl = $this->aliasing->hasPublicAlias($ret) |
||
51 | ) { |
||
52 | $ret = $publicUrl; |
||
53 | } |
||
54 | return $ret; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @{inheritDoc} |
||
59 | */ |
||
60 | public function all(AuthorizationCheckerInterface $security) |
||
69 | } |
||
70 | } |
||
71 |