forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServices.php
More file actions
40 lines (35 loc) · 770 Bytes
/
Copy pathServices.php
File metadata and controls
40 lines (35 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Tests\Support\Config;
use CodeIgniter\HTTP\URI;
use Config\Services as BaseServices;
use RuntimeException;
/**
* Services Class
*
* Provides a replacement uri Service
* to demonstrate overriding core services.
*/
class Services extends BaseServices
{
/**
* The URI class provides a way to model and manipulate URIs.
*
* @param string $uri
* @param boolean $getShared
*
* @return URI
*/
public static function uri(string $uri = null, bool $getShared = true)
{
// Intercept our test case
if ($uri === 'testCanReplaceFrameworkServices')
{
throw new RuntimeException('Service originated from ' . static::class);
}
if ($getShared)
{
return static::getSharedInstance('uri', $uri);
}
return new URI($uri);
}
}