38 lines
797 B
PHP
38 lines
797 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Classes\Frame;
|
||
|
|
||
|
use Illuminate\Support\Facades\Log;
|
||
|
|
||
|
use App\Classes\Server;
|
||
|
use App\User;
|
||
|
|
||
|
abstract class Action
|
||
|
{
|
||
|
const prefix = 'App\Classes\Frame\Action\\';
|
||
|
public $so = NULL;
|
||
|
public $uo = NULL;
|
||
|
public $action = NULL;
|
||
|
public $mode = NULL;
|
||
|
public $page = [];
|
||
|
|
||
|
public function __construct(Server $so,User $uo,int $action,int $mode)
|
||
|
{
|
||
|
$this->so = $so;
|
||
|
$this->uo = $uo;
|
||
|
$this->action = $action;
|
||
|
$this->mode = $mode;
|
||
|
}
|
||
|
|
||
|
public static function factory(string $class,Server $so,User $uo,int $action,int $mode)
|
||
|
{
|
||
|
$c = self::prefix.$class;
|
||
|
$o = class_exists($c) ? new $c($so,$uo,$action,$mode) : FALSE;
|
||
|
|
||
|
$so->log('debug',sprintf(($o ? 'Executing: %s' : 'Class doesnt exist: %s'),$c));
|
||
|
|
||
|
return $o;
|
||
|
}
|
||
|
|
||
|
abstract public function handle(array $fielddata);
|
||
|
}
|