|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Bluz Framework Component |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright Bluz PHP Team |
|
7
|
|
|
* @link https://github.com/bluzphp/framework |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
declare(strict_types=1); |
|
11
|
|
|
|
|
12
|
|
|
namespace Bluz\Proxy; |
|
13
|
|
|
|
|
14
|
|
|
use Bluz\Common\Exception\ComponentException; |
|
15
|
|
|
use Bluz\Router\Router as Instance; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Proxy to Router |
|
19
|
|
|
* |
|
20
|
|
|
* Example of usage |
|
21
|
|
|
* <code> |
|
22
|
|
|
* use Bluz\Proxy\Router; |
|
23
|
|
|
* |
|
24
|
|
|
* Router::getUrl('pages', 'index', ['alias' => 'about']); // for skeleton application is `/about.html` |
|
25
|
|
|
* </code> |
|
26
|
|
|
* |
|
27
|
|
|
* @package Bluz\Proxy |
|
28
|
|
|
* @author Anton Shevchuk |
|
29
|
|
|
* |
|
30
|
|
|
* @method static Instance getInstance() |
|
31
|
|
|
* |
|
32
|
|
|
* @method static string getBaseUrl() |
|
33
|
|
|
* @see Instance::getBaseUrl() |
|
34
|
|
|
* @method static void setBaseUrl($baseUrl) |
|
35
|
|
|
* @see Instance::setBaseUrl() |
|
36
|
|
|
* |
|
37
|
|
|
* @method static string getUrl($module = 'index', $controller = 'index', $params = []) |
|
38
|
|
|
* @see Instance::getUrl() |
|
39
|
|
|
* |
|
40
|
|
|
* @method static string getFullUrl($module = 'index', $controller = 'index', $params = []) |
|
41
|
|
|
* @see Instance::getFullUrl() |
|
42
|
|
|
* |
|
43
|
|
|
* @method static string getCleanUri() |
|
44
|
|
|
* @see Instance::getCleanUri() |
|
45
|
|
|
* |
|
46
|
|
|
* @method static void process() |
|
47
|
|
|
* @see Instance::process() |
|
48
|
|
|
* |
|
49
|
|
|
* @method static string getDefaultModule() |
|
50
|
|
|
* @see Instance::getDefaultModule() |
|
51
|
|
|
* |
|
52
|
|
|
* @method static string getDefaultController() |
|
53
|
|
|
* @see Instance::getDefaultController() |
|
54
|
|
|
* |
|
55
|
|
|
* @method static string getErrorModule() |
|
56
|
|
|
* @see Instance::getErrorModule() |
|
57
|
|
|
* |
|
58
|
|
|
* @method static string getErrorController() |
|
59
|
|
|
* @see Instance::getErrorController() |
|
60
|
|
|
*/ |
|
61
|
|
|
final class Router |
|
62
|
|
|
{ |
|
63
|
|
|
use ProxyTrait; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Init instance |
|
67
|
|
|
* |
|
68
|
|
|
* @throws ComponentException |
|
69
|
|
|
*/ |
|
70
|
1 |
|
private static function initInstance() |
|
|
|
|
|
|
71
|
|
|
{ |
|
72
|
1 |
|
throw new ComponentException("Class `Proxy\\Router` required external initialization"); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
This check looks for private methods that have been defined, but are not used inside the class.