Enabled user registration
This commit is contained in:
48
app/Classes/Control.php
Normal file
48
app/Classes/Control.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes;
|
||||
|
||||
use App\Classes\Control\Register;
|
||||
use App\Classes\Control\Telnet;
|
||||
|
||||
abstract class Control
|
||||
{
|
||||
protected $complete = FALSE;
|
||||
protected $so = NULL;
|
||||
public $state = [];
|
||||
|
||||
public function __construct(Server $so) {
|
||||
$this->so = $so;
|
||||
|
||||
$this->boot();
|
||||
}
|
||||
|
||||
// Default boot method if a child class doesnt have one.
|
||||
protected function boot() {
|
||||
$this->state['mode'] = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has control completed?
|
||||
*/
|
||||
public function complete()
|
||||
{
|
||||
return $this->complete;
|
||||
}
|
||||
|
||||
// @todo Change to Dynamic Calls by the existence of files in App\Classes\Control
|
||||
public static function factory(string $name, Server $so) {
|
||||
switch ($name) {
|
||||
case 'register':
|
||||
return new Register($so);
|
||||
|
||||
case 'telnet':
|
||||
return new Telnet($so);
|
||||
|
||||
default:
|
||||
throw new \Exception('Unknown control method: '.$name);
|
||||
}
|
||||
}
|
||||
|
||||
abstract public function handle(string $char);
|
||||
}
|
Reference in New Issue
Block a user