Internal rework pending editframe

This commit is contained in:
Deon George
2019-07-12 10:42:01 +07:00
parent 4f79a1a997
commit 264747e2f3
14 changed files with 611 additions and 428 deletions

View File

@@ -2,18 +2,36 @@
namespace App\Classes;
use App\Classes\Control\EditFrame;
use App\Classes\Control\Register;
use App\Classes\Control\Telnet;
abstract class Control
{
// Has this control class finished with input
protected $complete = FALSE;
// The server object that is running this control class
protected $so = NULL;
// The frame applicable for this control (not the current rendered frame, thats in $so)
protected $fo = NULL;
/**
* What is the state of the server outside of this control.
* Should only contain
* + mode = Mode to follow outside of the control method
* + action = Action to run after leaving the control method
*
* @var array
*/
public $state = [];
public function __construct(Server $so) {
public function __construct(Server $so,Frame $fo=NULL) {
$this->so = $so;
$this->fo = $fo;
// Boot control, preparing anything before keyboard entry
$this->boot();
}
@@ -31,8 +49,11 @@ abstract class Control
}
// @todo Change to Dynamic Calls by the existence of files in App\Classes\Control
public static function factory(string $name, Server $so) {
public static function factory(string $name,Server $so,Frame $fo=NULL) {
switch ($name) {
case 'editframe':
return new EditFrame($so,$fo);
case 'register':
return new Register($so);
@@ -44,5 +65,5 @@ abstract class Control
}
}
abstract public function handle(string $char);
abstract public function handle(string $read);
}