26 lines
589 B
PHP
26 lines
589 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
abstract class CommonService
|
|
{
|
|
private $_serviceDatas = [];
|
|
public function __construct() {}
|
|
abstract protected 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 getServiceDatas(): array
|
|
{
|
|
return $this->_serviceDatas;
|
|
}
|
|
}
|