1 | <?php |
||
18 | class Canonicalizer |
||
19 | { |
||
20 | /** |
||
21 | * @var UriInterface |
||
22 | */ |
||
23 | protected $uri; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $baseUrl; |
||
29 | |||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | protected $isCanonicalized = false; |
||
34 | |||
35 | /** |
||
36 | * @param UriInterface $uri |
||
37 | * @param null $baseUrl |
||
38 | */ |
||
39 | public function __construct(UriInterface $uri, $baseUrl = null) |
||
51 | |||
52 | /** |
||
53 | * Return true if URI was canonicalized |
||
54 | * |
||
55 | * @return bool |
||
56 | */ |
||
57 | public function isCanonicalized() |
||
61 | |||
62 | /** |
||
63 | * Canonicalize URI to use www or not |
||
64 | * |
||
65 | * @param bool $useWww |
||
66 | * @return self |
||
67 | */ |
||
68 | public function www($useWww) |
||
89 | |||
90 | /** |
||
91 | * Canonicalize URI to use trailingSlash or not |
||
92 | * |
||
93 | * @param bool $useTrailingSlash |
||
94 | * @return self |
||
95 | */ |
||
96 | public function trailingSlash($useTrailingSlash) |
||
119 | |||
120 | /** |
||
121 | * Return URI as string |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | public function toString() |
||
129 | |||
130 | /** |
||
131 | * Magic method to convert the URI to a string |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public function __toString() |
||
143 | } |
||
144 |