Skip to content

Commit b79002e

Browse files
committed
Release 0.3.3
- Update README.md - Change PHPDoc - Change the DSS_PATH constant to SS_PATH - Introducing the Request class. Response and Request now separated and support new features
1 parent 61ce5aa commit b79002e

19 files changed

+318
-130
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# damnstupidsimple/core
2-
The core package for Damn Stupid Simple framework. This is a subtree split for [Damn Stupid Simple framework](https://github.com/damnstupidsimple/framework).
1+
# stupidlysimple/core
2+
The core package for StupidlySimple framework. This is a subtree split for [StupidlySimple framework](https://github.com/stupidlysimple/framework).
33
Documentations are available on the main package.

src/Alias.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* Damn Stupid Simple - A PHP Framework For Lazy Developers
3+
* StupidlySimple Framework - A PHP Framework For Lazy Developers
44
*
5-
* Copyright (c) 2016 Studio Nexus
5+
* Copyright (c) 2017 Fariz Luqman
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a
88
* copy of this software and associated documentation files (the "Software"),
@@ -22,13 +22,14 @@
2222
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
*
25-
* @package Damn Stupid Simple
26-
* @author Studio Nexus <fariz@studionexus.co>
27-
* @copyright 2016 Studio Nexus
28-
* @license MIT
29-
* @version Release: 0.2.0
30-
* @link https://www.studionexus.co/php/damnstupidsimple
25+
* @package StupidlySimple
26+
* @author Fariz Luqman <fariz.fnb@gmail.com>
27+
* @copyright 2017 Fariz Luqman
28+
* @license MIT
29+
* @since 0.3.3
30+
* @link https://stupidlysimple.github.io/
3131
*/
32+
3233
namespace Core;
3334

3435
/**

src/App.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* Damn Stupid Simple - A PHP Framework For Lazy Developers
3+
* StupidlySimple Framework - A PHP Framework For Lazy Developers
44
*
5-
* Copyright (c) 2016 Studio Nexus
5+
* Copyright (c) 2017 Fariz Luqman
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a
88
* copy of this software and associated documentation files (the "Software"),
@@ -22,12 +22,12 @@
2222
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
*
25-
* @package Damn Stupid Simple
26-
* @author Studio Nexus <fariz@studionexus.co>
27-
* @copyright 2016 Studio Nexus
28-
* @license MIT
29-
* @version Release: 0.2.0
30-
* @link https://www.studionexus.co/php/damnstupidsimple
25+
* @package StupidlySimple
26+
* @author Fariz Luqman <fariz.fnb@gmail.com>
27+
* @copyright 2017 Fariz Luqman
28+
* @license MIT
29+
* @since 0.3.3
30+
* @link https://stupidlysimple.github.io/
3131
*/
3232
namespace Core;
3333

src/Cache.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* Damn Stupid Simple - A PHP Framework For Lazy Developers
3+
* StupidlySimple Framework - A PHP Framework For Lazy Developers
44
*
5-
* Copyright (c) 2016 Studio Nexus
5+
* Copyright (c) 2017 Fariz Luqman
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a
88
* copy of this software and associated documentation files (the "Software"),
@@ -22,12 +22,12 @@
2222
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
*
25-
* @package Damn Stupid Simple
26-
* @author Studio Nexus <fariz@studionexus.co>
27-
* @copyright 2016 Studio Nexus
28-
* @license MIT
29-
* @version Release: 0.2.0
30-
* @link https://www.studionexus.co/php/damnstupidsimple
25+
* @package StupidlySimple
26+
* @author Fariz Luqman <fariz.fnb@gmail.com>
27+
* @copyright 2017 Fariz Luqman
28+
* @license MIT
29+
* @since 0.3.3
30+
* @link https://stupidlysimple.github.io/
3131
*/
3232
namespace Core;
3333
use phpFastCache\CacheManager as CacheManager;

src/Config.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* Damn Stupid Simple - A PHP Framework For Lazy Developers
3+
* StupidlySimple Framework - A PHP Framework For Lazy Developers
44
*
5-
* Copyright (c) 2016 Studio Nexus
5+
* Copyright (c) 2017 Fariz Luqman
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a
88
* copy of this software and associated documentation files (the "Software"),
@@ -22,12 +22,12 @@
2222
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
*
25-
* @package Damn Stupid Simple
26-
* @author Studio Nexus <fariz@studionexus.co>
27-
* @copyright 2016 Studio Nexus
28-
* @license MIT
29-
* @version Release: 0.2.0
30-
* @link https://www.studionexus.co/php/damnstupidsimple
25+
* @package StupidlySimple
26+
* @author Fariz Luqman <fariz.fnb@gmail.com>
27+
* @copyright 2017 Fariz Luqman
28+
* @license MIT
29+
* @since 0.3.3
30+
* @link https://stupidlysimple.github.io/
3131
*/
3232
namespace Core;
3333

@@ -78,7 +78,7 @@ class Config {
7878
*/
7979
public static function get($file, $key = null){
8080
if(isset(self::$hive[$file]) === false){
81-
self::$hive[$file] = include_once(DSS_PATH.'config/'.$file.'.php');
81+
self::$hive[$file] = include_once(SS_PATH.'config/'.$file.'.php');
8282
}
8383

8484
if($key === null){
@@ -99,7 +99,7 @@ public static function get($file, $key = null){
9999
*/
100100
public static function setEnv(){
101101
if(self::$env === null){
102-
self::$env = require_once(DSS_PATH.'config/env.php');
102+
self::$env = require_once(SS_PATH.'config/env.php');
103103
}
104104

105105
foreach(self::$env as $v => $a){

src/Database.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* Damn Stupid Simple - A PHP Framework For Lazy Developers
3+
* StupidlySimple Framework - A PHP Framework For Lazy Developers
44
*
5-
* Copyright (c) 2016 Studio Nexus
5+
* Copyright (c) 2017 Fariz Luqman
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a
88
* copy of this software and associated documentation files (the "Software"),
@@ -22,12 +22,12 @@
2222
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
*
25-
* @package Damn Stupid Simple
26-
* @author Studio Nexus <fariz@studionexus.co>
27-
* @copyright 2016 Studio Nexus
28-
* @license MIT
29-
* @version Release: 0.2.0
30-
* @link https://www.studionexus.co/php/damnstupidsimple
25+
* @package StupidlySimple
26+
* @author Fariz Luqman <fariz.fnb@gmail.com>
27+
* @copyright 2017 Fariz Luqman
28+
* @license MIT
29+
* @since 0.3.3
30+
* @link https://stupidlysimple.github.io/
3131
*/
3232
namespace Core;
3333
use Illuminate\Database\Capsule\Manager as Capsule;

src/Debugger.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* Damn Stupid Simple - A PHP Framework For Lazy Developers
3+
* StupidlySimple Framework - A PHP Framework For Lazy Developers
44
*
5-
* Copyright (c) 2016 Studio Nexus
5+
* Copyright (c) 2017 Fariz Luqman
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a
88
* copy of this software and associated documentation files (the "Software"),
@@ -22,12 +22,12 @@
2222
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
*
25-
* @package Damn Stupid Simple
26-
* @author Studio Nexus <fariz@studionexus.co>
27-
* @copyright 2016 Studio Nexus
28-
* @license MIT
29-
* @version Release: 0.2.0
30-
* @link https://www.studionexus.co/php/damnstupidsimple
25+
* @package StupidlySimple
26+
* @author Fariz Luqman <fariz.fnb@gmail.com>
27+
* @copyright 2017 Fariz Luqman
28+
* @license MIT
29+
* @since 0.3.3
30+
* @link https://stupidlysimple.github.io/
3131
*/
3232
namespace Core;
3333

@@ -187,7 +187,7 @@ static private function microtime_diff($start)
187187
* @since Method available since Release 0.1.0
188188
*/
189189
static function exec_time(){
190-
echo ('<span style="display: table; margin: 0 auto;">Request takes '.(self::microtime_diff(DSS_START) * 1000 ) . ' milliseconds</span>');
190+
echo ('<span style="display: table; margin: 0 auto;">Request takes '.(self::microtime_diff(SS_START) * 1000 ) . ' milliseconds</span>');
191191
}
192192

193193
static function startProfiling(){
@@ -215,7 +215,7 @@ static function addProfilingData($point_name = '', $point_type = 'others'){
215215
}
216216

217217
static function endProfiling(){
218-
$timeIncludingAutoloader = self::microtime_diff(DSS_START) * 1000;
218+
$timeIncludingAutoloader = self::microtime_diff(SS_START) * 1000;
219219
$timeProfiled = self::microtime_diff(self::$profilerStartTime) * 1000;
220220
$timeMinusAutoloader = $timeIncludingAutoloader - $timeProfiled;
221221

src/Request.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/**
3+
* StupidlySimple Framework - A PHP Framework For Lazy Developers
4+
*
5+
* Copyright (c) 2017 Fariz Luqman
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a
8+
* copy of this software and associated documentation files (the "Software"),
9+
* to deal in the Software without restriction, including without limitation
10+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
11+
* and/or sell copies of the Software, and to permit persons to whom the
12+
* Software is furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included
15+
* in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+
*
25+
* @package StupidlySimple
26+
* @author Fariz Luqman <fariz.fnb@gmail.com>
27+
* @copyright 2017 Fariz Luqman
28+
* @license MIT
29+
* @since 0.3.3
30+
* @link https://stupidlysimple.github.io/
31+
*/
32+
namespace Core;
33+
34+
class Request {
35+
36+
private static $_instance = null;
37+
private $data = [];
38+
39+
private function __construct(){
40+
// merge data with get, post and files
41+
$this->data = array_merge($_GET, $_POST, $_FILES);
42+
43+
// start session to get flash variables
44+
if(!isset($_SESSION)){
45+
session_start();
46+
}
47+
// merge data with flash variables
48+
if(isset($_SESSION['ss_flash_variables'])){
49+
$this->data = array_merge($_SESSION['ss_flash_variables']);
50+
unset($_SESSION['ss_flash_variables']);
51+
}
52+
}
53+
54+
static function get($key = null){
55+
if (self::$_instance === null) {
56+
self::$_instance = new self;
57+
}
58+
59+
return self::$_instance->returnRequest($key);
60+
}
61+
62+
function returnRequest($key = null){
63+
if($key !== null){
64+
if(!isset($this->data[$key])){
65+
return null;
66+
}
67+
return $this->data[$key];
68+
}else{
69+
return $this->data;
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)