Skip to content

Commit

Permalink
Release 0.3.3
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
farizluqman committed Feb 3, 2017
1 parent 61ce5aa commit b79002e
Show file tree
Hide file tree
Showing 19 changed files with 318 additions and 130 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# damnstupidsimple/core
The core package for Damn Stupid Simple framework. This is a subtree split for [Damn Stupid Simple framework](https://github.com/damnstupidsimple/framework).
# stupidlysimple/core
The core package for StupidlySimple framework. This is a subtree split for [StupidlySimple framework](https://github.com/stupidlysimple/framework).
Documentations are available on the main package.
17 changes: 9 additions & 8 deletions src/Alias.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Damn Stupid Simple - A PHP Framework For Lazy Developers
* StupidlySimple Framework - A PHP Framework For Lazy Developers
*
* Copyright (c) 2016 Studio Nexus
* Copyright (c) 2017 Fariz Luqman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand All @@ -22,13 +22,14 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @package Damn Stupid Simple
* @author Studio Nexus <fariz@studionexus.co>
* @copyright 2016 Studio Nexus
* @license MIT
* @version Release: 0.2.0
* @link https://www.studionexus.co/php/damnstupidsimple
* @package StupidlySimple
* @author Fariz Luqman <fariz[email protected]>
* @copyright 2017 Fariz Luqman
* @license MIT
* @since 0.3.3
* @link https://stupidlysimple.github.io/
*/

namespace Core;

/**
Expand Down
16 changes: 8 additions & 8 deletions src/App.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Damn Stupid Simple - A PHP Framework For Lazy Developers
* StupidlySimple Framework - A PHP Framework For Lazy Developers
*
* Copyright (c) 2016 Studio Nexus
* Copyright (c) 2017 Fariz Luqman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand All @@ -22,12 +22,12 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @package Damn Stupid Simple
* @author Studio Nexus <fariz@studionexus.co>
* @copyright 2016 Studio Nexus
* @license MIT
* @version Release: 0.2.0
* @link https://www.studionexus.co/php/damnstupidsimple
* @package StupidlySimple
* @author Fariz Luqman <fariz[email protected]>
* @copyright 2017 Fariz Luqman
* @license MIT
* @since 0.3.3
* @link https://stupidlysimple.github.io/
*/
namespace Core;

Expand Down
16 changes: 8 additions & 8 deletions src/Cache.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Damn Stupid Simple - A PHP Framework For Lazy Developers
* StupidlySimple Framework - A PHP Framework For Lazy Developers
*
* Copyright (c) 2016 Studio Nexus
* Copyright (c) 2017 Fariz Luqman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand All @@ -22,12 +22,12 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @package Damn Stupid Simple
* @author Studio Nexus <fariz@studionexus.co>
* @copyright 2016 Studio Nexus
* @license MIT
* @version Release: 0.2.0
* @link https://www.studionexus.co/php/damnstupidsimple
* @package StupidlySimple
* @author Fariz Luqman <fariz[email protected]>
* @copyright 2017 Fariz Luqman
* @license MIT
* @since 0.3.3
* @link https://stupidlysimple.github.io/
*/
namespace Core;
use phpFastCache\CacheManager as CacheManager;
Expand Down
20 changes: 10 additions & 10 deletions src/Config.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Damn Stupid Simple - A PHP Framework For Lazy Developers
* StupidlySimple Framework - A PHP Framework For Lazy Developers
*
* Copyright (c) 2016 Studio Nexus
* Copyright (c) 2017 Fariz Luqman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand All @@ -22,12 +22,12 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @package Damn Stupid Simple
* @author Studio Nexus <fariz@studionexus.co>
* @copyright 2016 Studio Nexus
* @license MIT
* @version Release: 0.2.0
* @link https://www.studionexus.co/php/damnstupidsimple
* @package StupidlySimple
* @author Fariz Luqman <fariz[email protected]>
* @copyright 2017 Fariz Luqman
* @license MIT
* @since 0.3.3
* @link https://stupidlysimple.github.io/
*/
namespace Core;

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

if($key === null){
Expand All @@ -99,7 +99,7 @@ public static function get($file, $key = null){
*/
public static function setEnv(){
if(self::$env === null){
self::$env = require_once(DSS_PATH.'config/env.php');
self::$env = require_once(SS_PATH.'config/env.php');
}

foreach(self::$env as $v => $a){
Expand Down
16 changes: 8 additions & 8 deletions src/Database.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Damn Stupid Simple - A PHP Framework For Lazy Developers
* StupidlySimple Framework - A PHP Framework For Lazy Developers
*
* Copyright (c) 2016 Studio Nexus
* Copyright (c) 2017 Fariz Luqman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand All @@ -22,12 +22,12 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @package Damn Stupid Simple
* @author Studio Nexus <fariz@studionexus.co>
* @copyright 2016 Studio Nexus
* @license MIT
* @version Release: 0.2.0
* @link https://www.studionexus.co/php/damnstupidsimple
* @package StupidlySimple
* @author Fariz Luqman <fariz[email protected]>
* @copyright 2017 Fariz Luqman
* @license MIT
* @since 0.3.3
* @link https://stupidlysimple.github.io/
*/
namespace Core;
use Illuminate\Database\Capsule\Manager as Capsule;
Expand Down
20 changes: 10 additions & 10 deletions src/Debugger.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Damn Stupid Simple - A PHP Framework For Lazy Developers
* StupidlySimple Framework - A PHP Framework For Lazy Developers
*
* Copyright (c) 2016 Studio Nexus
* Copyright (c) 2017 Fariz Luqman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand All @@ -22,12 +22,12 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @package Damn Stupid Simple
* @author Studio Nexus <fariz@studionexus.co>
* @copyright 2016 Studio Nexus
* @license MIT
* @version Release: 0.2.0
* @link https://www.studionexus.co/php/damnstupidsimple
* @package StupidlySimple
* @author Fariz Luqman <fariz[email protected]>
* @copyright 2017 Fariz Luqman
* @license MIT
* @since 0.3.3
* @link https://stupidlysimple.github.io/
*/
namespace Core;

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

static function startProfiling(){
Expand Down Expand Up @@ -215,7 +215,7 @@ static function addProfilingData($point_name = '', $point_type = 'others'){
}

static function endProfiling(){
$timeIncludingAutoloader = self::microtime_diff(DSS_START) * 1000;
$timeIncludingAutoloader = self::microtime_diff(SS_START) * 1000;
$timeProfiled = self::microtime_diff(self::$profilerStartTime) * 1000;
$timeMinusAutoloader = $timeIncludingAutoloader - $timeProfiled;

Expand Down
72 changes: 72 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* StupidlySimple Framework - A PHP Framework For Lazy Developers
*
* Copyright (c) 2017 Fariz Luqman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @package StupidlySimple
* @author Fariz Luqman <[email protected]>
* @copyright 2017 Fariz Luqman
* @license MIT
* @since 0.3.3
* @link https://stupidlysimple.github.io/
*/
namespace Core;

class Request {

private static $_instance = null;
private $data = [];

private function __construct(){
// merge data with get, post and files
$this->data = array_merge($_GET, $_POST, $_FILES);

// start session to get flash variables
if(!isset($_SESSION)){
session_start();
}
// merge data with flash variables
if(isset($_SESSION['ss_flash_variables'])){
$this->data = array_merge($_SESSION['ss_flash_variables']);
unset($_SESSION['ss_flash_variables']);
}
}

static function get($key = null){
if (self::$_instance === null) {
self::$_instance = new self;
}

return self::$_instance->returnRequest($key);
}

function returnRequest($key = null){
if($key !== null){
if(!isset($this->data[$key])){
return null;
}
return $this->data[$key];
}else{
return $this->data;
}
}
}
Loading

0 comments on commit b79002e

Please sign in to comment.