Skip to content

Commit fb01525

Browse files
Merge pull request #7 from infinitybrackets/main
Fix initializing environment object
2 parents d35a774 + 2932071 commit fb01525

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/Core/Application.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ class Application {
1515

1616
public function __construct($config = [])
1717
{
18-
self::$ROOT_DIR = $config['root'];
19-
self::$app = $this;
2018
$this->LoadSettings($config);
19+
self::$app = $this;
2120

2221
$this->user = null;
2322
$this->userClass = $config['userClass'];
@@ -40,8 +39,10 @@ public function __construct($config = [])
4039
* TODO: Add checking on $config keys before assigning
4140
*/
4241
public function LoadSettings($config) {
42+
self::$ROOT_DIR = $config['root'];
4343
$this->config['app'] = $config['app'];
4444
$this->config['auth'] = $config['auth'];
45+
$this->config['environment'] = $config['environment'];
4546
$this->config['connections'] = $config['connections'];
4647

4748
// Load env file

src/Core/Request.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ public function Compose() {
1616

1717
switch(Application::$app->config->env->APP_ENV) {
1818
case "local":
19-
$path = str_replace(Application::$app->config->app->path->local, "/", $path);
19+
$path = str_replace(Application::$app->config->environment->local, "/", $path);
2020
break;
2121
case "sandbox":
22-
$path = str_replace(Application::$app->config->app->path->sandbox, "/", $path);
22+
$path = str_replace(Application::$app->config->environment->sandbox, "/", $path);
2323
break;
2424
case "live":
25-
$path = str_replace(Application::$app->config->app->path->live, "/", $path);
25+
$path = str_replace(Application::$app->config->environment->live, "/", $path);
2626
break;
2727
}
2828
return $path;
2929
}
3030

3131
public function GetUrl()
3232
{
33-
$path = $this->Composer();
33+
$path = $this->Compose();
3434

3535
if($path != '/') {
3636
$path = str_replace('/', '', $path);
@@ -50,7 +50,7 @@ public function GetUrl()
5050

5151
public function GetUrlConverted()
5252
{
53-
$path = $this->Composer();
53+
$path = $this->Compose();
5454

5555
if($path != '/') {
5656
$path = str_replace('/', '', $path);

0 commit comments

Comments
 (0)