42 lines
1019 B
PHP
42 lines
1019 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
abstract class CommonService
|
|
{
|
|
private $_serviceDatas = [];
|
|
private $class_name = "";
|
|
private $class_path = "";
|
|
public function __construct(string $class_name, string $class_path)
|
|
{
|
|
$this->class_name = $class_name;
|
|
$this->class_path = $class_path;
|
|
// dd($this->class_name, $this->class_path);
|
|
}
|
|
|
|
abstract public function getModel(): mixed;
|
|
final public function __get($name)
|
|
{
|
|
if (!array_key_exists($name, $this->_serviceDatas)) {
|
|
return null;
|
|
}
|
|
return $this->_serviceDatas[$name];
|
|
}
|
|
final public function __set($name, $value): void
|
|
{
|
|
$this->_serviceDatas[$name] = $value;
|
|
}
|
|
final public function getClassName(): string
|
|
{
|
|
return $this->class_name;
|
|
}
|
|
final public function getClassPath(): string
|
|
{
|
|
return $this->class_path;
|
|
}
|
|
final public function getServiceDatas(): array
|
|
{
|
|
return $this->_serviceDatas;
|
|
}
|
|
}
|