-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Env class and new controller: home, global
- Loading branch information
Showing
8 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
DEBUG=false | ||
ENV=prod | ||
VIEW_DEBUG=false | ||
BATCH_DATA_SIZE=50 | ||
BATCH_DATA_SIZE=50 | ||
REACT_FRONTEND=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Core; | ||
|
||
final class Env | ||
{ | ||
public static function get($key, $defaultValue = null) | ||
{ | ||
$envVar = getenv($key); | ||
if (is_null($envVar)) { | ||
return $defaultValue; | ||
} | ||
|
||
if (in_array($envVar, ["true", "false"])) { | ||
return boolval($envVar); | ||
} | ||
if (is_numeric($envVar)) { | ||
if (strpos($envVar, ',') !== false) { | ||
$envVar = str_replace(',', '', $envVar); | ||
} | ||
|
||
return strpos($envVar, '.') === false ? intval($envVar) : floatval($envVar); | ||
} | ||
return $envVar; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class GlobalController extends Controller | ||
{ | ||
public function handle(ResponseInterface $response) | ||
{ | ||
return $response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Core\HookManager; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class HomeController extends Controller | ||
{ | ||
public function index(ResponseInterface $response): ResponseInterface | ||
{ | ||
return view( | ||
HookManager::applyFilters('home_template', 'pages/home'), | ||
HookManager::applyFilters('home_data', []) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule layout
updated
from 044035 to 400052
Submodule react
updated
from 2347ff to e5fb33