-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathApplication.php
More file actions
97 lines (80 loc) · 2.47 KB
/
Copy pathApplication.php
File metadata and controls
97 lines (80 loc) · 2.47 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace OpenDominion;
use Illuminate\Foundation\Application as LaravelApplication;
class Application extends LaravelApplication
{
/**
* The application app path.
*
* @var string
*/
protected $appPath;
/** @noinspection MagicMethodsValidityInspection */
/** @noinspection PhpMissingParentConstructorInspection */
/**
* Create a new OpenDominion application instance.
*
* @param string|null $basePath
*/
public function __construct($basePath = null)
{
// We don't want to call the parent constructor, since we need to bind basePath manually, then set appPath, and
// then call bindPathsInContainer(), exactly in that order.
//
// Parent constructor calls setBasePath(), which calls bindPathsInContainer() before we can set our appPath.
// And we shouldn't set appPath before basePath, else our custom structure breaks.
if ($basePath) {
$this->basePath = rtrim($basePath, '\/');
}
$this->appPath = ($this->basePath() . DIRECTORY_SEPARATOR . 'app');
$this->bindPathsInContainer();
$this->registerBaseBindings();
$this->registerBaseServiceProviders();
$this->registerCoreContainerAliases();
}
/**
* {@inheritdoc}
*/
public function path($path = '')
{
return ($this->basePath . DIRECTORY_SEPARATOR . 'src' . $this->getSuffixPath($path));
}
/**
* {@inheritdoc}
*/
public function configPath($path = '')
{
return ($this->appPath . DIRECTORY_SEPARATOR . 'config' . $this->getSuffixPath($path));
}
/**
* {@inheritdoc}
*/
public function databasePath($path = '')
{
return ($this->appPath . DIRECTORY_SEPARATOR . 'database' . $this->getSuffixPath($path));
}
/**
* {@inheritdoc}
*/
public function langPath($path = ''): string
{
return ($this->appPath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'lang' . $this->getSuffixPath($path));
}
/**
* {@inheritdoc}
*/
public function resourcePath($path = '')
{
return ($this->appPath . DIRECTORY_SEPARATOR . 'resources' . $this->getSuffixPath($path));
}
/**
* Get path prefixed by directory separator if not empty.
*
* @param string $path
* @return string
*/
protected function getSuffixPath($path = '')
{
return ($path ? (DIRECTORY_SEPARATOR . $path) : '');
}
}