From 4e58b42ce77f5de847eadfca2c8c3f53d9ec36b6 Mon Sep 17 00:00:00 2001 From: therselman Date: Fri, 4 Aug 2017 13:56:34 +0200 Subject: [PATCH] --- HISTORY.md | 15 ++++++ composer.json | 50 +++++++++---------- src/{ => Twister}/Assets.php | 0 src/{ => Twister}/Collection.php | 0 src/{ => Twister}/Container.php | 0 src/{ => Twister}/ContainerAwareTrait.php | 0 src/{ => Twister}/ContainerInterface.php | 0 src/{ => Twister}/Controller.php | 0 src/{ => Twister}/Css.php | 0 src/{ => Twister}/Db.php | 0 src/{ => Twister}/Duo.php | 0 src/{ => Twister}/Entity.php | 0 src/{ => Twister}/ExceptionHandler.php | 0 src/{ => Twister}/Lang.php | 0 src/{ => Twister}/Mb.php | 0 src/{ => Twister}/Request.php | 6 +-- src/{ => Twister}/Response.php | 0 src/{ => Twister}/S.php | 0 src/{ => Twister}/Schema/Model.php | 0 src/{ => Twister}/Schema/Schema.php | 0 src/{ => Twister}/Schema/Table.php | 0 src/{ => Twister}/Schema/Types/ArrayType.php | 0 src/{ => Twister}/Schema/Types/BaseType.php | 0 src/{ => Twister}/Schema/Types/BinaryType.php | 0 src/{ => Twister}/Schema/Types/DateType.php | 0 src/{ => Twister}/Schema/Types/EnumType.php | 0 src/{ => Twister}/Schema/Types/FloatType.php | 0 .../Schema/Types/IntegerType.php | 0 src/{ => Twister}/Schema/Types/SetType.php | 0 src/{ => Twister}/Schema/Types/StringType.php | 0 src/{ => Twister}/Schema/Types/Type.php | 0 src/{ => Twister}/Schema/composer.json | 0 src/{ => Twister}/Session.php | 5 +- src/{ => Twister}/Str.php | 0 src/{ => Twister}/Uri.php | 0 src/{ => Twister}/User.php | 2 +- src/{ => Twister}/Utf8.php | 0 src/{ => Twister}/Validation.php | 0 38 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 HISTORY.md rename src/{ => Twister}/Assets.php (100%) rename src/{ => Twister}/Collection.php (100%) rename src/{ => Twister}/Container.php (100%) rename src/{ => Twister}/ContainerAwareTrait.php (100%) rename src/{ => Twister}/ContainerInterface.php (100%) rename src/{ => Twister}/Controller.php (100%) rename src/{ => Twister}/Css.php (100%) rename src/{ => Twister}/Db.php (100%) rename src/{ => Twister}/Duo.php (100%) rename src/{ => Twister}/Entity.php (100%) rename src/{ => Twister}/ExceptionHandler.php (100%) rename src/{ => Twister}/Lang.php (100%) rename src/{ => Twister}/Mb.php (100%) rename src/{ => Twister}/Request.php (97%) rename src/{ => Twister}/Response.php (100%) rename src/{ => Twister}/S.php (100%) rename src/{ => Twister}/Schema/Model.php (100%) rename src/{ => Twister}/Schema/Schema.php (100%) rename src/{ => Twister}/Schema/Table.php (100%) rename src/{ => Twister}/Schema/Types/ArrayType.php (100%) rename src/{ => Twister}/Schema/Types/BaseType.php (100%) rename src/{ => Twister}/Schema/Types/BinaryType.php (100%) rename src/{ => Twister}/Schema/Types/DateType.php (100%) rename src/{ => Twister}/Schema/Types/EnumType.php (100%) rename src/{ => Twister}/Schema/Types/FloatType.php (100%) rename src/{ => Twister}/Schema/Types/IntegerType.php (100%) rename src/{ => Twister}/Schema/Types/SetType.php (100%) rename src/{ => Twister}/Schema/Types/StringType.php (100%) rename src/{ => Twister}/Schema/Types/Type.php (100%) rename src/{ => Twister}/Schema/composer.json (100%) rename src/{ => Twister}/Session.php (91%) rename src/{ => Twister}/Str.php (100%) rename src/{ => Twister}/Uri.php (100%) rename src/{ => Twister}/User.php (93%) rename src/{ => Twister}/Utf8.php (100%) rename src/{ => Twister}/Validation.php (100%) diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000..f4e3650 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,15 @@ +17 July 2017: @ 3:30am - I implemented the \ArrayAccess syntactic suggar to SQL, it's taking readability to the next level! + +16 July 2017: On this day, I was on the MyBatis website reading documentation on their `Dynamic SQL` and `SQL Builder Class`; + http://www.mybatis.org/mybatis-3/statement-builders.html + http://www.mybatis.org/mybatis-3/dynamic-sql.html + So I have begun the first steps in implementing the SQL class. + The really funny thing about all these Query builders is that they normally require MORE code than straight SQL, I hate them all! + @ 2:30pm I had the idea to incorporate my `builder` technique as well! + The MyBatis `Dynamic SQL` builder is somewhat similar to my `builder` technique, except it's in XML! Yuk! + + Reading the Doctrine Data Mapping page (I hate Doctrine even more now), I have so much disrespect for it! + Why put `check constraints` in the Entity class? http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#property-mapping + + @ 4:15pm - BRAINSTORM! I had the idea to do `= new SQL().('My Additional Text here').().().('howdee doodee folks %s', $test).('WHERE id = :id', ['id' => 5]).('AND name = ?', $name) + OMG! I don't have to use sprintf() ... OMG ... I can add text DIRECTLY to the SQL('SELECT * FROM bla bla WHERE id = ', $id) ... diff --git a/composer.json b/composer.json index 75ffdb8..0c07a25 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,25 @@ -{ - "name": "twister/twister", - "description": "Twister - micro-framework component library", - "keywords": ["framework", "micro-framework", "library", "router"], - "type": "library", - "homepage": "https://github.com/twister-php/twister/", - "license": "MIT", - "authors": [ - { - "name": "Trevor Herselman", - "email": "therselman@gmail.com" - } - ], - "require": { - "php": ">=5.6", - "psr/http-message": "^1.0", - "twister/sql": "*" - }, - "autoload": { - "psr-4": { - "Twister\\": "src/", - "": "src/" - } - } -} +{ + "name": "twister/twister", + "description": "Twister - micro-framework component library", + "keywords": ["framework", "micro-framework", "library", "router"], + "type": "library", + "homepage": "https://github.com/twister-php/twister/", + "license": "MIT", + "authors": [ + { + "name": "Trevor Herselman", + "email": "therselman@gmail.com" + } + ], + "require": { + "php": ">=5.6", + "psr/http-message": "^1.0", + "twister/sql": "*" + }, + "autoload": { + "psr-4": { + "Twister\\": "src/Twister/", + "": "src/" + } + } +} diff --git a/src/Assets.php b/src/Twister/Assets.php similarity index 100% rename from src/Assets.php rename to src/Twister/Assets.php diff --git a/src/Collection.php b/src/Twister/Collection.php similarity index 100% rename from src/Collection.php rename to src/Twister/Collection.php diff --git a/src/Container.php b/src/Twister/Container.php similarity index 100% rename from src/Container.php rename to src/Twister/Container.php diff --git a/src/ContainerAwareTrait.php b/src/Twister/ContainerAwareTrait.php similarity index 100% rename from src/ContainerAwareTrait.php rename to src/Twister/ContainerAwareTrait.php diff --git a/src/ContainerInterface.php b/src/Twister/ContainerInterface.php similarity index 100% rename from src/ContainerInterface.php rename to src/Twister/ContainerInterface.php diff --git a/src/Controller.php b/src/Twister/Controller.php similarity index 100% rename from src/Controller.php rename to src/Twister/Controller.php diff --git a/src/Css.php b/src/Twister/Css.php similarity index 100% rename from src/Css.php rename to src/Twister/Css.php diff --git a/src/Db.php b/src/Twister/Db.php similarity index 100% rename from src/Db.php rename to src/Twister/Db.php diff --git a/src/Duo.php b/src/Twister/Duo.php similarity index 100% rename from src/Duo.php rename to src/Twister/Duo.php diff --git a/src/Entity.php b/src/Twister/Entity.php similarity index 100% rename from src/Entity.php rename to src/Twister/Entity.php diff --git a/src/ExceptionHandler.php b/src/Twister/ExceptionHandler.php similarity index 100% rename from src/ExceptionHandler.php rename to src/Twister/ExceptionHandler.php diff --git a/src/Lang.php b/src/Twister/Lang.php similarity index 100% rename from src/Lang.php rename to src/Twister/Lang.php diff --git a/src/Mb.php b/src/Twister/Mb.php similarity index 100% rename from src/Mb.php rename to src/Twister/Mb.php diff --git a/src/Request.php b/src/Twister/Request.php similarity index 97% rename from src/Request.php rename to src/Twister/Request.php index e62d047..daaf3f0 100644 --- a/src/Request.php +++ b/src/Twister/Request.php @@ -292,9 +292,9 @@ class Request private function _get_args_from_params(array $params) { $byType = [ 'twister\container' => &$this->container, - 'db' => &$this->db, - 'request' => &$this, - // 'user' => &$this->container->user + 'twister\db' => &$this->db, + 'twister\user' => &$this->container->user, + 'twister\request' => &$this ]; $args = []; foreach ($params as $param) diff --git a/src/Response.php b/src/Twister/Response.php similarity index 100% rename from src/Response.php rename to src/Twister/Response.php diff --git a/src/S.php b/src/Twister/S.php similarity index 100% rename from src/S.php rename to src/Twister/S.php diff --git a/src/Schema/Model.php b/src/Twister/Schema/Model.php similarity index 100% rename from src/Schema/Model.php rename to src/Twister/Schema/Model.php diff --git a/src/Schema/Schema.php b/src/Twister/Schema/Schema.php similarity index 100% rename from src/Schema/Schema.php rename to src/Twister/Schema/Schema.php diff --git a/src/Schema/Table.php b/src/Twister/Schema/Table.php similarity index 100% rename from src/Schema/Table.php rename to src/Twister/Schema/Table.php diff --git a/src/Schema/Types/ArrayType.php b/src/Twister/Schema/Types/ArrayType.php similarity index 100% rename from src/Schema/Types/ArrayType.php rename to src/Twister/Schema/Types/ArrayType.php diff --git a/src/Schema/Types/BaseType.php b/src/Twister/Schema/Types/BaseType.php similarity index 100% rename from src/Schema/Types/BaseType.php rename to src/Twister/Schema/Types/BaseType.php diff --git a/src/Schema/Types/BinaryType.php b/src/Twister/Schema/Types/BinaryType.php similarity index 100% rename from src/Schema/Types/BinaryType.php rename to src/Twister/Schema/Types/BinaryType.php diff --git a/src/Schema/Types/DateType.php b/src/Twister/Schema/Types/DateType.php similarity index 100% rename from src/Schema/Types/DateType.php rename to src/Twister/Schema/Types/DateType.php diff --git a/src/Schema/Types/EnumType.php b/src/Twister/Schema/Types/EnumType.php similarity index 100% rename from src/Schema/Types/EnumType.php rename to src/Twister/Schema/Types/EnumType.php diff --git a/src/Schema/Types/FloatType.php b/src/Twister/Schema/Types/FloatType.php similarity index 100% rename from src/Schema/Types/FloatType.php rename to src/Twister/Schema/Types/FloatType.php diff --git a/src/Schema/Types/IntegerType.php b/src/Twister/Schema/Types/IntegerType.php similarity index 100% rename from src/Schema/Types/IntegerType.php rename to src/Twister/Schema/Types/IntegerType.php diff --git a/src/Schema/Types/SetType.php b/src/Twister/Schema/Types/SetType.php similarity index 100% rename from src/Schema/Types/SetType.php rename to src/Twister/Schema/Types/SetType.php diff --git a/src/Schema/Types/StringType.php b/src/Twister/Schema/Types/StringType.php similarity index 100% rename from src/Schema/Types/StringType.php rename to src/Twister/Schema/Types/StringType.php diff --git a/src/Schema/Types/Type.php b/src/Twister/Schema/Types/Type.php similarity index 100% rename from src/Schema/Types/Type.php rename to src/Twister/Schema/Types/Type.php diff --git a/src/Schema/composer.json b/src/Twister/Schema/composer.json similarity index 100% rename from src/Schema/composer.json rename to src/Twister/Schema/composer.json diff --git a/src/Session.php b/src/Twister/Session.php similarity index 91% rename from src/Session.php rename to src/Twister/Session.php index 4e65d34..8926b95 100644 --- a/src/Session.php +++ b/src/Twister/Session.php @@ -1,15 +1,14 @@ $query_data]; $query_data['warning'] = 'Protected Area! Login with relevant permissions required!'; // <== TODO: Translate this!!! Or send a constant! - $this->container->request->redirect('/login', $query_data); + $this->container->request->redirect('/login?' . http_build_query($query_data)); } return false; } diff --git a/src/Utf8.php b/src/Twister/Utf8.php similarity index 100% rename from src/Utf8.php rename to src/Twister/Utf8.php diff --git a/src/Validation.php b/src/Twister/Validation.php similarity index 100% rename from src/Validation.php rename to src/Twister/Validation.php