Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12317620
D3793.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D3793.diff
View Options
diff --git a/workspaces/src/includes/controller/Controller.php b/workspaces/src/Engines/Controller/Controller.php
rename from workspaces/src/includes/controller/Controller.php
rename to workspaces/src/Engines/Controller/Controller.php
--- a/workspaces/src/includes/controller/Controller.php
+++ b/workspaces/src/Engines/Controller/Controller.php
@@ -15,12 +15,17 @@
* @filesource
*/
+namespace Waystone\Workspaces\Engines\Controller;
+
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* Controller class
*
* This class describes a controller
*/
abstract class Controller implements RunnableWithContext {
+
/**
* @var string the application name
*/
@@ -34,28 +39,32 @@
/**
* Initializes the controller resources
*/
- public function initialize () { }
+ public function initialize () {
+ }
/**
* Handles a web request
*/
- public abstract function handleRequest();
+ public abstract function handleRequest ();
/**
* Loads a new instance of a Controller class
*
* @param Context the site or application context
+ *
* @return Controller an instance of the class inheriting from Controller
*/
public static function load (Context $context) {
$controller = new static;
$controller->context = $context;
$controller->initialize();
+
return $controller;
}
/**
- * Initializes a new instance of the controller with the specified context and handle request
+ * Initializes a new instance of the controller with the specified context
+ * and handle request
*
* @param Context the site or application context
*/
diff --git a/workspaces/src/includes/LoadableWithContext.php b/workspaces/src/Engines/Controller/LoadableWithContext.php
rename from workspaces/src/includes/LoadableWithContext.php
rename to workspaces/src/Engines/Controller/LoadableWithContext.php
--- a/workspaces/src/includes/LoadableWithContext.php
+++ b/workspaces/src/Engines/Controller/LoadableWithContext.php
@@ -15,6 +15,10 @@
* @filesource
*/
+namespace Waystone\Workspaces\Engines\Controller;
+
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* LoadableWithContext interface
*
@@ -22,8 +26,10 @@
* execute a task they represent, with a context as parameter.
*/
interface LoadableWithContext {
+
/**
- * Initializes a new instance of the object with the specified context and handle request
+ * Initializes a new instance of the object with the specified context and
+ * handle request
*
* @return object The loaded instance of the object.
*/
diff --git a/workspaces/src/includes/controller/RunnableWithContext.php b/workspaces/src/Engines/Controller/RunnableWithContext.php
rename from workspaces/src/includes/controller/RunnableWithContext.php
rename to workspaces/src/Engines/Controller/RunnableWithContext.php
--- a/workspaces/src/includes/controller/RunnableWithContext.php
+++ b/workspaces/src/Engines/Controller/RunnableWithContext.php
@@ -15,6 +15,10 @@
* @filesource
*/
+namespace Waystone\Workspaces\Engines\Controller;
+
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* RunnableWithContext interface
*
@@ -22,8 +26,10 @@
* execute a task they represent, with a context as parameter.
*/
interface RunnableWithContext extends LoadableWithContext {
+
/**
- * Initializes a new instance of the object with the specified context and handle request
+ * Initializes a new instance of the object with the specified context and
+ * handle request
*/
public static function run (Context $context);
}
diff --git a/workspaces/src/includes/controller/Context.php b/workspaces/src/Engines/Framework/Context.php
rename from workspaces/src/includes/controller/Context.php
rename to workspaces/src/Engines/Framework/Context.php
--- a/workspaces/src/includes/controller/Context.php
+++ b/workspaces/src/Engines/Framework/Context.php
@@ -15,7 +15,12 @@
* @filesource
*/
+namespace Waystone\Workspaces\Engines\Framework;
+
+use Keruald\Database\DatabaseEngine;
use Smarty\Smarty;
+use User;
+use WorkSpace;
/**
* Context class
@@ -23,40 +28,41 @@
* This class describes the site context.
*/
class Context {
+
/**
- * @var WorkSpace the workspace currently enabled
+ * @var ?WorkSpace the workspace currently enabled
*/
- public $workspace;
+ public ?WorkSpace $workspace = null;
/**
- * @var Database the database instance
+ * @var DatabaseEngine the database
*/
- public $db;
+ public DatabaseEngine $db;
/**
* @var array the configuration
*/
- public $config;
+ public array $config;
/**
* @var User the user currently logged in
*/
- public $user;
+ public User $user;
/**
* @var Session the current session
*/
- public $session;
+ public Session $session;
/**
- * @var Array the URL fragments
+ * @var string[] the URL fragments
*/
- public $url;
+ public array $url;
/**
* @var Smarty the template engine
*/
- public $templateEngine;
+ public Smarty $templateEngine;
///
/// Helper methods
@@ -65,9 +71,9 @@
/**
* Gets application root directory
*
- * @return string the application root directory
+ * @return string|false the application root directory
*/
- public function getApplicationRootDirectory() {
+ public function getApplicationRootDirectory () : string|false {
return getcwd();
}
diff --git a/workspaces/src/controllers/errorpage.php b/workspaces/src/controllers/errorpage.php
--- a/workspaces/src/controllers/errorpage.php
+++ b/workspaces/src/controllers/errorpage.php
@@ -16,6 +16,9 @@
*
*/
+use Waystone\Workspaces\Engines\Controller\Controller;
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* Error pages controller
*/
diff --git a/workspaces/src/controllers/footer.php b/workspaces/src/controllers/footer.php
--- a/workspaces/src/controllers/footer.php
+++ b/workspaces/src/controllers/footer.php
@@ -16,6 +16,8 @@
*
*/
+use Waystone\Workspaces\Engines\Controller\Controller;
+
/**
* Footer controller
*/
diff --git a/workspaces/src/controllers/header.php b/workspaces/src/controllers/header.php
--- a/workspaces/src/controllers/header.php
+++ b/workspaces/src/controllers/header.php
@@ -16,6 +16,8 @@
*
*/
+use Waystone\Workspaces\Engines\Controller\Controller;
+
/**
* Header controller
*/
diff --git a/workspaces/src/controllers/home.php b/workspaces/src/controllers/home.php
--- a/workspaces/src/controllers/home.php
+++ b/workspaces/src/controllers/home.php
@@ -16,6 +16,8 @@
*
*/
+use Waystone\Workspaces\Engines\Controller\Controller;
+
/**
* Homepage controller
*/
diff --git a/workspaces/src/includes/apps/Application.php b/workspaces/src/includes/apps/Application.php
--- a/workspaces/src/includes/apps/Application.php
+++ b/workspaces/src/includes/apps/Application.php
@@ -15,6 +15,8 @@
* @filesource
*/
+use Waystone\Workspaces\Engines\Controller\Controller;
+
/**
* Application class
*
diff --git a/workspaces/src/includes/apps/ApplicationContext.php b/workspaces/src/includes/apps/ApplicationContext.php
--- a/workspaces/src/includes/apps/ApplicationContext.php
+++ b/workspaces/src/includes/apps/ApplicationContext.php
@@ -15,6 +15,8 @@
* @filesource
*/
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* Application context class
*
diff --git a/workspaces/src/includes/auth/AuthenticationMethod.php b/workspaces/src/includes/auth/AuthenticationMethod.php
--- a/workspaces/src/includes/auth/AuthenticationMethod.php
+++ b/workspaces/src/includes/auth/AuthenticationMethod.php
@@ -15,7 +15,9 @@
* @filesource
*/
- /**
+use Waystone\Workspaces\Engines\Framework\Context;
+
+/**
* Authentication method class
*
* This class has to be extended to implement custom authentication methods.
diff --git a/workspaces/src/includes/collection/MySQLCollection.php b/workspaces/src/includes/collection/MySQLCollection.php
--- a/workspaces/src/includes/collection/MySQLCollection.php
+++ b/workspaces/src/includes/collection/MySQLCollection.php
@@ -15,6 +15,8 @@
* @filesource
*/
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* MySQL Collection class
*
diff --git a/workspaces/src/includes/i18n/Language.php b/workspaces/src/includes/i18n/Language.php
--- a/workspaces/src/includes/i18n/Language.php
+++ b/workspaces/src/includes/i18n/Language.php
@@ -15,6 +15,9 @@
* @filesource
*/
+use Waystone\Workspaces\Engines\Controller\LoadableWithContext;
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* Gets a specified language expression defined in configuration file
*
diff --git a/workspaces/src/includes/workspaces/Workspace.php b/workspaces/src/includes/workspaces/Workspace.php
--- a/workspaces/src/includes/workspaces/Workspace.php
+++ b/workspaces/src/includes/workspaces/Workspace.php
@@ -15,6 +15,8 @@
* @filesource
*/
+use Waystone\Workspaces\Engines\Framework\Context;
+
/**
* Workspace class
*
diff --git a/workspaces/src/includes/workspaces/WorkspaceConfiguration.php b/workspaces/src/includes/workspaces/WorkspaceConfiguration.php
--- a/workspaces/src/includes/workspaces/WorkspaceConfiguration.php
+++ b/workspaces/src/includes/workspaces/WorkspaceConfiguration.php
@@ -15,7 +15,9 @@
* @filesource
*/
- /**
+use Waystone\Workspaces\Engines\Framework\Context;
+
+/**
* Workspace configuration class
*
* This class maps the workspaces table.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 24, 00:56 (16 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3099662
Default Alt Text
D3793.diff (9 KB)
Attached To
Mode
D3793: Promote Controller and Context classes in namespace
Attached
Detach File
Event Timeline
Log In to Comment