Total Complexity | 8 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Coverage | 10.53% |
Changes | 0 |
1 | <?php |
||
5 | class AppIdentifier |
||
6 | { |
||
7 | /** |
||
8 | * The key registered in the container for the application identifier. |
||
9 | */ |
||
10 | const IDENTIFIER_KEY = 'apps.identifier'; |
||
11 | |||
12 | /** |
||
13 | * Get the current application identifier. |
||
14 | * |
||
15 | * @return string |
||
16 | */ |
||
17 | public static function get() |
||
18 | { |
||
19 | if (app()->bound(static::IDENTIFIER_KEY)) { |
||
20 | return app()->make(static::IDENTIFIER_KEY); |
||
21 | } |
||
22 | |||
23 | return app()->instance( |
||
24 | static::IDENTIFIER_KEY, |
||
25 | static::getIdentifierForUrl(app('request')->getUri()) |
||
26 | ); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Get application identifier for the given URL. |
||
31 | * |
||
32 | * @param string $url |
||
33 | * @return string |
||
34 | */ |
||
35 | protected static function getIdentifierForUrl($url) |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Refresh the current application identifier. |
||
56 | * |
||
57 | * @return void |
||
58 | */ |
||
59 | 1 | public static function refresh() |
|
64 |