Updated to PHP 8.0.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
- Release version 1.3.3. - Most property, argument and return types have been defined and are now enforced. - Drone now performs tests for both PHP 7.4 and 8.0. Extend for future versions.
This commit is contained in:
parent
51153520e2
commit
016fa03ac2
19
.drone.yml
19
.drone.yml
|
@ -8,8 +8,23 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- composer install
|
- composer install
|
||||||
|
|
||||||
- name: test
|
- name: php74test
|
||||||
image: registry.i15.nl/i15/fuzephp:7.4-alpine
|
image: registry.i15.nl/i15/fuzephp:7.4-alpine
|
||||||
commands:
|
commands:
|
||||||
- docker-php-ext-enable xdebug
|
- docker-php-ext-enable xdebug
|
||||||
- vendor/bin/phpunit -c test/phpunit.xml
|
- vendor/bin/phpunit -c test/phpunit.xml
|
||||||
|
|
||||||
|
- name: php80test
|
||||||
|
image: registry.i15.nl/i15/fuzephp:8.0-alpine
|
||||||
|
commands:
|
||||||
|
- docker-php-ext-enable xdebug
|
||||||
|
- vendor/bin/phpunit -c test/phpunit.xml
|
||||||
|
|
||||||
|
- name: coverage
|
||||||
|
image: registry.i15.nl/i15/fuzephp:8.0-alpine
|
||||||
|
commands:
|
||||||
|
- docker-php-ext-enable xdebug
|
||||||
|
- vendor/bin/phpunit -c test/phpunit.xml --coverage-text
|
||||||
|
|
||||||
|
image_pull_secrets:
|
||||||
|
- dockerconfig
|
|
@ -1,4 +1,5 @@
|
||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
.gitignore export-ignore
|
.gitignore export-ignore
|
||||||
.gitlab-ci.yml export-ignore
|
.gitlab-ci.yml export-ignore
|
||||||
|
.drone.yml export-ignore
|
||||||
test/ export-ignore
|
test/ export-ignore
|
|
@ -4,17 +4,13 @@
|
||||||
"license": ["MIT"],
|
"license": ["MIT"],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "TechFuze",
|
"name": "Abel Hoogeveen",
|
||||||
"homepage": "https://techfuze.net"
|
"homepage": "https://i15.nl"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "FuzeWorks Community",
|
|
||||||
"homepage": "https://techfuze.net/fuzeworks/contributors"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.4.0",
|
"php": ">=7.4.0",
|
||||||
"fuzeworks/core": "~1.2.0"
|
"fuzeworks/core": "~1.3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9",
|
"phpunit/phpunit": "^9",
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
* Custom callable: Adds a route that sends all matches to the provided callable. Allows user to replace defaultCallable
|
* Custom callable: Adds a route that sends all matches to the provided callable. Allows user to replace defaultCallable
|
||||||
* 'routingString' => array('callable' => array(CALLABLE))
|
* 'routingString' => array('callable' => array(CALLABLE))
|
||||||
*
|
*
|
||||||
* Dynamic rewrite: Adds a route that rewrites an URL to a specific controller and method configuration, using a callable. The callable can dynamically determine which page to load.
|
* Dynamic rewrite: Adds a route that rewrites a URL to a specific controller and method configuration, using a callable. The callable can dynamically determine which page to load.
|
||||||
* 'routingString' => CALLABLE
|
* 'routingString' => CALLABLE
|
||||||
*
|
*
|
||||||
* Static rewrite: Adds a route that rewrites and URL to a specific controller and method using a fixed route. This allows for pre-determined rewrites of pages.
|
* Static rewrite: Adds a route that rewrites and URL to a specific controller and method using a fixed route. This allows for pre-determined rewrites of pages.
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks;
|
namespace FuzeWorks;
|
||||||
|
@ -49,22 +49,22 @@ abstract class Controller
|
||||||
/**
|
/**
|
||||||
* @var Plugins
|
* @var Plugins
|
||||||
*/
|
*/
|
||||||
protected $plugins;
|
protected Plugins $plugins;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Libraries
|
* @var Libraries
|
||||||
*/
|
*/
|
||||||
protected $libraries;
|
protected Libraries $libraries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Helpers
|
* @var Helpers
|
||||||
*/
|
*/
|
||||||
protected $helpers;
|
protected Helpers $helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Config
|
* @var Config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected Config $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Controllers
|
* @var Controllers
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks;
|
namespace FuzeWorks;
|
||||||
|
@ -45,7 +45,7 @@ use FuzeWorks\Exception\NotFoundException;
|
||||||
* Controllers Class.
|
* Controllers Class.
|
||||||
*
|
*
|
||||||
* Simple loader class for MVC Controllers.
|
* Simple loader class for MVC Controllers.
|
||||||
* Typically loads controllers from Application\Controller unless otherwise specified.
|
* Typically, loads controllers from Application\Controller unless otherwise specified.
|
||||||
*
|
*
|
||||||
* @author Abel Hoogeveen <abel@techfuze.net>
|
* @author Abel Hoogeveen <abel@techfuze.net>
|
||||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Event;
|
namespace FuzeWorks\Event;
|
||||||
|
@ -52,28 +52,28 @@ class ControllerGetEvent extends Event
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $controllerPaths = array();
|
public array $controllerPaths = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the controller to be loaded.
|
* The name of the controller to be loaded.
|
||||||
*
|
*
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
public $controllerName = null;
|
public ?string $controllerName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The namespace of the controller to be loaded. Defaults to Application\Controller
|
* The namespace of the controller to be loaded. Defaults to Application\Controller
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $namespace = '\Application\Controller\\';
|
public string $namespace = '\Application\Controller\\';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arguments provided to the constructor
|
* Arguments provided to the constructor
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $arguments = [];
|
public array $arguments = [];
|
||||||
|
|
||||||
public function init($controllerName, $controllerPaths, $namespace, $arguments)
|
public function init($controllerName, $controllerPaths, $namespace, $arguments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Event;
|
namespace FuzeWorks\Event;
|
||||||
|
@ -53,28 +53,28 @@ class ModelGetEvent extends Event
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $modelPaths = array();
|
public array $modelPaths = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the model to be loaded.
|
* The name of the model to be loaded.
|
||||||
*
|
*
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
public $modelName = null;
|
public ?string $modelName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The namespace of the model to be loaded. Defaults to Application\Model
|
* The namespace of the model to be loaded. Defaults to Application\Model
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $namespace = '\Application\Model\\';
|
public string $namespace = '\Application\Model\\';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arguments provided to the constructor
|
* Arguments provided to the constructor
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $arguments = [];
|
public array $arguments = [];
|
||||||
|
|
||||||
public function init($modelName, $modelPaths, $namespace, $arguments)
|
public function init($modelName, $modelPaths, $namespace, $arguments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Event;
|
namespace FuzeWorks\Event;
|
||||||
|
@ -46,7 +46,7 @@ use FuzeWorks\View;
|
||||||
*
|
*
|
||||||
* Use this to cancel the calling of a view method.
|
* Use this to cancel the calling of a view method.
|
||||||
*
|
*
|
||||||
* Currently only used by Router::defaultCallable();
|
* Currently, only used by Router::defaultCallable();
|
||||||
*
|
*
|
||||||
* This event is currently used in the WebComponent project. It allows the component to stop loading when
|
* This event is currently used in the WebComponent project. It allows the component to stop loading when
|
||||||
* a CSRFException is thrown, and the view has no method of handling this request
|
* a CSRFException is thrown, and the view has no method of handling this request
|
||||||
|
@ -61,35 +61,35 @@ class RouterCallViewEvent extends Event
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $viewMethods;
|
public array $viewMethods;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parameters that will be provided to the function in the view
|
* The parameters that will be provided to the function in the view
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $viewParameters;
|
public array $viewParameters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The route that resulted in this controller and view
|
* The route that resulted in this controller and view
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $route;
|
public string $route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The view the method will be called on
|
* The view the method will be called on
|
||||||
*
|
*
|
||||||
* @var View
|
* @var View
|
||||||
*/
|
*/
|
||||||
public $view;
|
public View $view;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The controller that's associated with this View
|
* The controller that's associated with this View
|
||||||
*
|
*
|
||||||
* @var Controller
|
* @var Controller
|
||||||
*/
|
*/
|
||||||
public $controller;
|
public Controller $controller;
|
||||||
|
|
||||||
public function init(View $view, Controller $controller, array $viewMethods, array $viewParameters, string $route)
|
public function init(View $view, Controller $controller, array $viewMethods, array $viewParameters, string $route)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Event;
|
namespace FuzeWorks\Event;
|
||||||
|
@ -41,9 +41,9 @@ use FuzeWorks\Event;
|
||||||
/**
|
/**
|
||||||
* Event that gets fired when a callable is to be loaded by the Router class
|
* Event that gets fired when a callable is to be loaded by the Router class
|
||||||
*
|
*
|
||||||
* Use this to cancel the modify the loading of a custom callable or the defaultCallable
|
* Use this to cancel the modification the loading of a custom callable or the defaultCallable
|
||||||
*
|
*
|
||||||
* Currently only used by Router::loadCallable();
|
* Currently, only used by Router::loadCallable();
|
||||||
*
|
*
|
||||||
* @author Abel Hoogeveen <abel@techfuze.net>
|
* @author Abel Hoogeveen <abel@techfuze.net>
|
||||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||||
|
@ -63,21 +63,21 @@ class RouterLoadCallableEvent extends Event
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $matches;
|
public array $matches;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The static route configuration
|
* The static route configuration
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $routeData;
|
public array $routeData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The route which resulted in this callable being loaded
|
* The route which resulted in this callable being loaded
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $route;
|
public string $route;
|
||||||
|
|
||||||
public function init(callable $callable, array $matches, array $routeData, string $route)
|
public function init(callable $callable, array $matches, array $routeData, string $route)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Event;
|
namespace FuzeWorks\Event;
|
||||||
|
@ -44,7 +44,7 @@ use FuzeWorks\Priority;
|
||||||
*
|
*
|
||||||
* Use this to cancel the loading of a combination, or change the details of what is loaded.
|
* Use this to cancel the loading of a combination, or change the details of what is loaded.
|
||||||
*
|
*
|
||||||
* Currently only used by Router::defaultCallable();
|
* Currently, only used by Router::defaultCallable();
|
||||||
*
|
*
|
||||||
* @author Abel Hoogeveen <abel@techfuze.net>
|
* @author Abel Hoogeveen <abel@techfuze.net>
|
||||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||||
|
@ -56,49 +56,49 @@ class RouterLoadViewAndControllerEvent extends Event
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $viewName;
|
public string $viewName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of view to be loaded
|
* The type of view to be loaded
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $viewType;
|
public string $viewType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function that will be loaded in the view
|
* The function that will be loaded in the view
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $viewMethods;
|
public array $viewMethods;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parameters that will be provided to the function in the view
|
* The parameters that will be provided to the function in the view
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $viewParameters;
|
public array $viewParameters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The namespace to use to load the View and Controller
|
* The namespace to use to load the View and Controller
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $namespacePrefix;
|
public string $namespacePrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The route that resulted in this controller and view
|
* The route that resulted in this controller and view
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $route;
|
public string $route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A controller to be injected.
|
* A controller to be injected.
|
||||||
*
|
*
|
||||||
* @var Controller|null
|
* @var Controller|null
|
||||||
*/
|
*/
|
||||||
public $controller;
|
public ?Controller $controller = null;
|
||||||
|
|
||||||
public function init(string $viewName, string $viewType, array $viewMethods, array $viewParameters, string $namespacePrefix, string $route)
|
public function init(string $viewName, string $viewType, array $viewMethods, array $viewParameters, string $namespacePrefix, string $route)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks\Event;
|
namespace FuzeWorks\Event;
|
||||||
|
@ -53,40 +53,40 @@ class ViewGetEvent extends Event
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $viewPaths = [];
|
public array $viewPaths = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the view to be loaded.
|
* The name of the view to be loaded.
|
||||||
*
|
*
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
public $viewName = null;
|
public ?string $viewName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of view to be loaded. Eg: html, json, cli.
|
* The type of view to be loaded. Eg: html, json, cli.
|
||||||
*
|
*
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
public $viewType = null;
|
public ?string $viewType = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The namespace of the View to be loaded. Defaults to Application\View
|
* The namespace of the View to be loaded. Defaults to Application\View
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $namespace = '\Application\View\\';
|
public string $namespace = '\Application\View\\';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arguments provided to the constructor
|
* Arguments provided to the constructor
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $arguments = [];
|
public array $arguments = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Controller
|
* @var Controller
|
||||||
*/
|
*/
|
||||||
public $controller;
|
public Controller $controller;
|
||||||
|
|
||||||
public function init($viewName, $viewType, $viewPaths, $namespace, $controller, $arguments)
|
public function init($viewName, $viewType, $viewPaths, $namespace, $controller, $arguments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks;
|
namespace FuzeWorks;
|
||||||
|
@ -50,22 +50,22 @@ abstract class Model
|
||||||
/**
|
/**
|
||||||
* @var Plugins
|
* @var Plugins
|
||||||
*/
|
*/
|
||||||
protected $plugins;
|
protected Plugins $plugins;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Libraries
|
* @var Libraries
|
||||||
*/
|
*/
|
||||||
protected $libraries;
|
protected Libraries $libraries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Helpers
|
* @var Helpers
|
||||||
*/
|
*/
|
||||||
protected $helpers;
|
protected Helpers $helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Config
|
* @var Config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected Config $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Models
|
* @var Models
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks;
|
namespace FuzeWorks;
|
||||||
|
@ -45,7 +45,7 @@ use FuzeWorks\Exception\NotFoundException;
|
||||||
* Models Class.
|
* Models Class.
|
||||||
*
|
*
|
||||||
* Simple loader class for MVC Models.
|
* Simple loader class for MVC Models.
|
||||||
* Typically loads models from Application\Model unless otherwise specified.
|
* Typically, loads models from Application\Model unless otherwise specified.
|
||||||
*
|
*
|
||||||
* @author Abel Hoogeveen <abel@techfuze.net>
|
* @author Abel Hoogeveen <abel@techfuze.net>
|
||||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks;
|
namespace FuzeWorks;
|
||||||
|
@ -54,7 +54,7 @@ class Router
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $routes = [];
|
protected array $routes = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current callable used
|
* The current callable used
|
||||||
|
@ -68,10 +68,10 @@ class Router
|
||||||
*
|
*
|
||||||
* @var array|null
|
* @var array|null
|
||||||
*/
|
*/
|
||||||
protected $matches = null;
|
protected ?array $matches = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array|null
|
* @var array|Closure|null
|
||||||
*/
|
*/
|
||||||
protected $routeData = null;
|
protected $routeData = null;
|
||||||
|
|
||||||
|
@ -80,36 +80,36 @@ class Router
|
||||||
*
|
*
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
protected $route = null;
|
protected ?string $route = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current View
|
* The current View
|
||||||
*
|
*
|
||||||
* @var View|null
|
* @var View|null
|
||||||
*/
|
*/
|
||||||
protected $view = null;
|
protected ?View $view = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current Controller
|
* The current Controller
|
||||||
*
|
*
|
||||||
* @var Controller|null
|
* @var Controller|null
|
||||||
*/
|
*/
|
||||||
protected $controller = null;
|
protected ?Controller $controller = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Config
|
* @var Config
|
||||||
*/
|
*/
|
||||||
private $config;
|
private Config $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Controllers
|
* @var Controllers
|
||||||
*/
|
*/
|
||||||
private $controllers;
|
private Controllers $controllers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Views
|
* @var Views
|
||||||
*/
|
*/
|
||||||
private $views;
|
private Views $views;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Router constructor.
|
* Router constructor.
|
||||||
|
@ -156,7 +156,7 @@ class Router
|
||||||
$routeConfig = ['callable' => [$this, 'defaultCallable']];
|
$routeConfig = ['callable' => [$this, 'defaultCallable']];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally add the route
|
// Finally, add the route
|
||||||
$this->addRoute($route, $routeConfig);
|
$this->addRoute($route, $routeConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ class Router
|
||||||
public function route(string $path, string $category = 'default', array $routes = [])
|
public function route(string $path, string $category = 'default', array $routes = [])
|
||||||
{
|
{
|
||||||
// Select the routes to use
|
// Select the routes to use
|
||||||
$globalRoutes = isset($this->routes[$category]) ? $this->routes[$category] : [];
|
$globalRoutes = $this->routes[$category] ?? [];
|
||||||
$routes = empty($routes) ? $globalRoutes : $routes;
|
$routes = empty($routes) ? $globalRoutes : $routes;
|
||||||
|
|
||||||
// Check all the provided custom paths, ordered by priority
|
// Check all the provided custom paths, ordered by priority
|
||||||
|
@ -423,7 +423,7 @@ class Router
|
||||||
if (method_exists($this->view, $method))
|
if (method_exists($this->view, $method))
|
||||||
{
|
{
|
||||||
// Execute this method on the view
|
// Execute this method on the view
|
||||||
Logger::newLevel("Calling method '{$method}' on " . get_class($this->view) . ' with ' . get_class($this->controller));
|
Logger::newLevel("Calling method '$method' on " . get_class($this->view) . ' with ' . get_class($this->controller));
|
||||||
$output = call_user_func_array([$this->view, $method], $event->viewParameters);
|
$output = call_user_func_array([$this->view, $method], $event->viewParameters);
|
||||||
Logger::stopLevel();
|
Logger::stopLevel();
|
||||||
return $output;
|
return $output;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks;
|
namespace FuzeWorks;
|
||||||
|
@ -61,29 +61,29 @@ abstract class View
|
||||||
/**
|
/**
|
||||||
* @var Plugins
|
* @var Plugins
|
||||||
*/
|
*/
|
||||||
protected $plugins;
|
protected Plugins $plugins;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Libraries
|
* @var Libraries
|
||||||
*/
|
*/
|
||||||
protected $libraries;
|
protected Libraries $libraries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Helpers
|
* @var Helpers
|
||||||
*/
|
*/
|
||||||
protected $helpers;
|
protected Helpers $helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Config
|
* @var Config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected Config $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The controller associated with this view
|
* The controller associated with this view
|
||||||
*
|
*
|
||||||
* @var Controller
|
* @var Controller
|
||||||
*/
|
*/
|
||||||
protected $controller;
|
protected Controller $controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide the View with its associated Controller
|
* Provide the View with its associated Controller
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FuzeWorks;
|
namespace FuzeWorks;
|
||||||
|
@ -44,7 +44,7 @@ use FuzeWorks\Exception\ViewException;
|
||||||
* Views Class.
|
* Views Class.
|
||||||
*
|
*
|
||||||
* Simple loader class for MVC Views.
|
* Simple loader class for MVC Views.
|
||||||
* Typically loads views from Application\View unless otherwise specified.
|
* Typically, loads views from Application\View unless otherwise specified.
|
||||||
*
|
*
|
||||||
* @author Abel Hoogeveen <abel@techfuze.net>
|
* @author Abel Hoogeveen <abel@techfuze.net>
|
||||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||||
|
@ -130,7 +130,7 @@ class Views
|
||||||
|
|
||||||
// If the class already exists, return a new instance directly
|
// If the class already exists, return a new instance directly
|
||||||
$class = ucfirst($class);
|
$class = ucfirst($class);
|
||||||
$className = $namespace . $class . $viewType . 'View';
|
$className = $namespace . $class . ucfirst($viewType) . 'View';
|
||||||
if (class_exists($className, true)) {
|
if (class_exists($className, true)) {
|
||||||
/** @var View $view */
|
/** @var View $view */
|
||||||
$view = new $className(...$arguments);
|
$view = new $className(...$arguments);
|
||||||
|
|
|
@ -31,9 +31,11 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 0.0.1
|
* @since Version 0.0.1
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use FuzeWorks\MVCRComponent;
|
||||||
|
|
||||||
require_once(dirname(__DIR__) . '/vendor/autoload.php');
|
require_once(dirname(__DIR__) . '/vendor/autoload.php');
|
||||||
|
|
||||||
$configurator = new FuzeWorks\Configurator();
|
$configurator = new FuzeWorks\Configurator();
|
||||||
|
@ -44,14 +46,11 @@ $configurator->setLogDirectory(dirname(__FILE__) . '/temp');
|
||||||
|
|
||||||
// Other values
|
// Other values
|
||||||
$configurator->setTimeZone('Europe/Amsterdam');
|
$configurator->setTimeZone('Europe/Amsterdam');
|
||||||
$configurator->setDebugAddress('NONE');
|
$configurator->setDebugAddress();
|
||||||
|
|
||||||
// Implement the MVCR Component
|
// Implement the MVCR Component
|
||||||
$configurator->addComponent(new \FuzeWorks\MVCRComponent());
|
$configurator->addComponent(new MVCRComponent());
|
||||||
|
|
||||||
// Create container
|
// Create container
|
||||||
$container = $configurator->createContainer();
|
return $configurator->createContainer();
|
||||||
|
|
||||||
// And return the result
|
|
||||||
return $container;
|
|
||||||
|
|
||||||
|
|
|
@ -40,5 +40,5 @@ use FuzeWorks\Controller;
|
||||||
|
|
||||||
class TestDifferentComponentPathPriorityController extends Controller
|
class TestDifferentComponentPathPriorityController extends Controller
|
||||||
{
|
{
|
||||||
public $type = 'highest';
|
public string $type = 'highest';
|
||||||
}
|
}
|
|
@ -40,5 +40,5 @@ use FuzeWorks\Controller;
|
||||||
|
|
||||||
class TestDifferentComponentPathPriorityController extends Controller
|
class TestDifferentComponentPathPriorityController extends Controller
|
||||||
{
|
{
|
||||||
public $type = 'lowest';
|
public string $type = 'lowest';
|
||||||
}
|
}
|
|
@ -53,7 +53,7 @@ class ControllersTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @var Controllers
|
* @var Controllers
|
||||||
*/
|
*/
|
||||||
protected $controllers;
|
protected Controllers $controllers;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ModelsTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @var Models
|
* @var Models
|
||||||
*/
|
*/
|
||||||
protected $models;
|
protected Models $models;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,14 +55,14 @@ class RouterTest extends TestCase
|
||||||
*
|
*
|
||||||
* @var Router
|
* @var Router
|
||||||
*/
|
*/
|
||||||
protected $router;
|
protected Router $router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the Config object
|
* Holds the Config object
|
||||||
*
|
*
|
||||||
* @var Config
|
* @var Config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected Config $config;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,7 +55,7 @@ class ViewsTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @var Views
|
* @var Views
|
||||||
*/
|
*/
|
||||||
protected $views;
|
protected Views $views;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Controller
|
* @var Controller
|
||||||
|
|
|
@ -40,5 +40,5 @@ use FuzeWorks\Model;
|
||||||
|
|
||||||
class TestDifferentComponentPathPriorityModel extends Model
|
class TestDifferentComponentPathPriorityModel extends Model
|
||||||
{
|
{
|
||||||
public $type = 'highest';
|
public string $type = 'highest';
|
||||||
}
|
}
|
|
@ -40,5 +40,5 @@ use FuzeWorks\Model;
|
||||||
|
|
||||||
class TestDifferentComponentPathPriorityModel extends Model
|
class TestDifferentComponentPathPriorityModel extends Model
|
||||||
{
|
{
|
||||||
public $type = 'lowest';
|
public string $type = 'lowest';
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Application\View;
|
namespace Application\View;
|
||||||
|
@ -40,5 +40,5 @@ use FuzeWorks\View;
|
||||||
|
|
||||||
class TestDifferentComponentPathPriorityStandardView extends View
|
class TestDifferentComponentPathPriorityStandardView extends View
|
||||||
{
|
{
|
||||||
public $type = 'highest';
|
public string $type = 'highest';
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Application\View;
|
namespace Application\View;
|
||||||
|
@ -40,5 +40,5 @@ use FuzeWorks\View;
|
||||||
|
|
||||||
class TestDifferentComponentPathPriorityStandardView extends View
|
class TestDifferentComponentPathPriorityStandardView extends View
|
||||||
{
|
{
|
||||||
public $type = 'lowest';
|
public string $type = 'lowest';
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Application\View;
|
namespace Application\View;
|
||||||
|
@ -41,7 +41,7 @@ use FuzeWorks\View;
|
||||||
class TestDefaultCallableTestView extends View
|
class TestDefaultCallableTestView extends View
|
||||||
{
|
{
|
||||||
|
|
||||||
public function someMethod()
|
public function someMethod(): string
|
||||||
{
|
{
|
||||||
return "Verify Output";
|
return "Verify Output";
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Application\View;
|
namespace Application\View;
|
||||||
|
@ -40,12 +40,12 @@ use FuzeWorks\View;
|
||||||
class TestDefaultCallableChangeMethodTestView extends View
|
class TestDefaultCallableChangeMethodTestView extends View
|
||||||
{
|
{
|
||||||
|
|
||||||
public function index()
|
public function index(): string
|
||||||
{
|
{
|
||||||
return "Not altered!";
|
return "Not altered!";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function altered(string $param1, string $param2)
|
public function altered(string $param1, string $param2): array
|
||||||
{
|
{
|
||||||
return ["Altered", $param1, $param2];
|
return ["Altered", $param1, $param2];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Custom\View;
|
namespace Custom\View;
|
||||||
|
@ -41,7 +41,7 @@ use FuzeWorks\View;
|
||||||
class TestDefaultCallableCustomNamespaceTestView extends View
|
class TestDefaultCallableCustomNamespaceTestView extends View
|
||||||
{
|
{
|
||||||
|
|
||||||
public function someMethod()
|
public function someMethod(): string
|
||||||
{
|
{
|
||||||
return "Verify Output, with custom namespace!";
|
return "Verify Output, with custom namespace!";
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* @link http://techfuze.net/fuzeworks
|
* @link http://techfuze.net/fuzeworks
|
||||||
* @since Version 1.2.0
|
* @since Version 1.2.0
|
||||||
*
|
*
|
||||||
* @version Version 1.2.0
|
* @version Version 1.3.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Application\View;
|
namespace Application\View;
|
||||||
|
@ -40,6 +40,6 @@ use FuzeWorks\View;
|
||||||
class TestDefaultCallableHaltTestView extends View
|
class TestDefaultCallableHaltTestView extends View
|
||||||
{
|
{
|
||||||
|
|
||||||
public $halt = true;
|
public bool $halt = true;
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue