Skip to content

Commit 5225636

Browse files
author
Fariz Luqman
authored
Merge pull request #7 from damnstupidsimple/develop-0.3.0
Release candidate 0.3.1
2 parents c7090f7 + 9a3874f commit 5225636

9 files changed

Lines changed: 61 additions & 42 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
vendor/*
1+
vendor/*
2+
.idea/*

app/Controller/Admin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
namespace Controller;
33

44
use Sentry;
5-
use Core\Viewer;
6-
use Core\Response;
5+
use Viewer;
6+
use Response;
77

88
class Admin {
99

@@ -21,4 +21,4 @@ public function displayAdminPage(){
2121
Viewer::file('/resources/views/admin/home');
2222
}
2323

24-
}
24+
}

app/Controller/Auth.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22
namespace Controller;
33
use Sentry;
4-
use Core\Response;
5-
use Core\Viewer;
4+
use Response;
5+
use Viewer;
66

77
class Auth {
88
public function __construct(){
9-
9+
1010
}
1111

1212
public function displayRegisterPage(){
@@ -82,4 +82,4 @@ public function doLogout(){
8282

8383
}
8484

85-
}
85+
}

app/Controller/User.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
namespace Controller;
33

44
use Sentry;
5-
use Core\Viewer;
6-
use Core\Response;
5+
use Viewer;
6+
use Response;
77

88
class User {
99

@@ -13,7 +13,7 @@ public function __construct(){
1313
Response::redirect('login');
1414
}
1515
}
16-
16+
1717
public function editUser(){
1818
$id = Response::get('id');
1919
$first_name = Response::get('first_name');
@@ -71,20 +71,20 @@ public function editUser(){
7171
public function deleteUser()
7272
{
7373
$id = Response::get('id');
74-
try
74+
try
7575
{
7676
$user = \Model\User::find($id);
77-
77+
7878
if($user === null){
7979
Response::redirect('admin?delete=failed');
8080
}
81-
81+
8282
$user->delete();
8383
}catch(Exception $e)
8484
{
8585
Response::redirect('admin?delete=failed');
8686
}
87-
87+
8888
Response::redirect('admin?delete=success');
8989
}
90-
}
90+
}

app/Service/Test/TestService.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22
namespace Service\Test;
33

4-
class TestService extends \Core\Service
4+
use ServiceContainer;
5+
6+
class TestService extends ServiceContainer
57
{
68
public function hello()
79
{
810
return 'Hello';
911
}
10-
12+
1113
public function calculate(int $var1, $operation, int $var2)
1214
{
1315
if($operation == 'plus' || $operation == '+')
@@ -26,9 +28,9 @@ public function calculate(int $var1, $operation, int $var2)
2628
return 'Invalid Operation';
2729
}
2830
}
29-
31+
3032
public function getRegisteredUsers()
3133
{
3234
return \Model\User::all();
3335
}
34-
}
36+
}

app/bootstrap.php

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
*/
2121
Core\Alias::init();
2222

23+
/*
24+
|--------------------------------------------------------------------------
25+
| Set the default timezone
26+
|--------------------------------------------------------------------------
27+
|
28+
| Reads the configuration file (config/datetime.php) and set timezone
29+
|
30+
*/
31+
TimeTrackr::init();
32+
2333
/*
2434
|--------------------------------------------------------------------------
2535
| Creating the Singleton
@@ -29,11 +39,7 @@
2939
| maintaining only one instantiation of a class.
3040
|
3141
*/
32-
$app = new Core\App;
33-
34-
35-
date_default_timezone_set ( 'Asia/Kuala_Lumpur' );
36-
42+
$app = new App;
3743

3844
/*
3945
|--------------------------------------------------------------------------
@@ -43,7 +49,7 @@
4349
| Connect the database for only once. Save the planet.
4450
|
4551
*/
46-
$app->link('database', Core\Database::connect());
52+
$app->link('database', Database::connect());
4753

4854
/*
4955
|--------------------------------------------------------------------------
@@ -54,29 +60,29 @@
5460
| capabilities.
5561
|
5662
*/
57-
$app->link('cachemanager', Core\Cache::init());
63+
$app->link('cachemanager', Cache::init());
5864

5965
/*
6066
|--------------------------------------------------------------------------
61-
| Share the Singleton $app with the Template Files
67+
| Load Services
6268
|--------------------------------------------------------------------------
6369
|
64-
| Eliminate complexity, get the job done.
70+
| This is where all of your applications in /app/Service are loaded.
6571
|
6672
*/
67-
Core\Sharer::share('app', $app);
73+
$service = Service::loadServices();
6874

6975
/*
7076
|--------------------------------------------------------------------------
71-
| Load Services
77+
| Share the Singleton $app and $service
7278
|--------------------------------------------------------------------------
7379
|
74-
| This is where all of your applications resides
80+
| Eliminate complexity, get the job done. Our Dependency Injection (DI) is
81+
| here!
7582
|
7683
*/
77-
$service = Core\Service::loadServices();
78-
79-
Core\Sharer::share('service', $service);
84+
Sharer::share('app', $app);
85+
Sharer::share('service', $service);
8086

8187
/*
8288
|--------------------------------------------------------------------------
@@ -87,8 +93,8 @@
8793
|
8894
*/
8995

90-
Core\Router::start();
91-
Core\Router::dispatch();
96+
Router::start();
97+
Router::dispatch();
9298

9399
/*
94100
|--------------------------------------------------------------------------
@@ -100,5 +106,5 @@
100106
|
101107
*/
102108
if(getenv('SHOW_EXECUTION_TIME')){
103-
Core\Debugger::exec_time();
104-
}
109+
Debugger::exec_time();
110+
}

config/aliases.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
'Core\Database' => 'Database',
77
'Core\Debugger' => 'Debugger',
88
'Core\Router' => 'Router',
9+
'Core\Response' => 'Response',
910
'Core\Sharer' => 'Sharer',
1011
'Core\Viewer' => 'Viewer',
12+
'Core\Service' => 'Service',
13+
'Core\Service\ServiceContainer' => 'ServiceContainer',
14+
'Core\TimeTrackr' => 'TimeTrackr',
1115
'Cartalyst\Sentry\Facades\Native\Sentry' => 'Sentry'
12-
];
16+
];

config/database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* @link https://www.studionexus.co/php/damnstupidsimple
99
*/
1010

11-
return
11+
return
1212
[
1313
'enabled' => true,
14-
'settings' =>
14+
'settings' =>
1515
[
1616
'host' => 'localhost',
1717
'driver' => 'mysql',

config/timetrackr.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
return
4+
[
5+
'timezone' => 'Asia/Kuala_Lumpur'
6+
];

0 commit comments

Comments
 (0)