| Total Complexity | 69 |
| Total Lines | 610 |
| Duplicated Lines | 0 % |
| Coverage | 93.17% |
| Changes | 0 | ||
Complex classes like App often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use App, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 24 | class App extends Container |
||
| 25 | { |
||
| 26 | const VERSION = '6.0.0RC3'; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * 应用调试模式 |
||
| 30 | * @var bool |
||
| 31 | */ |
||
| 32 | protected $appDebug = false; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * 应用开始时间 |
||
| 36 | * @var float |
||
| 37 | */ |
||
| 38 | protected $beginTime; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * 应用内存初始占用 |
||
| 42 | * @var integer |
||
| 43 | */ |
||
| 44 | protected $beginMem; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * 当前应用类库命名空间 |
||
| 48 | * @var string |
||
| 49 | */ |
||
| 50 | protected $namespace = 'app'; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * 应用根目录 |
||
| 54 | * @var string |
||
| 55 | */ |
||
| 56 | protected $rootPath = ''; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * 框架目录 |
||
| 60 | * @var string |
||
| 61 | */ |
||
| 62 | protected $thinkPath = ''; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * 应用目录 |
||
| 66 | * @var string |
||
| 67 | */ |
||
| 68 | protected $appPath = ''; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Runtime目录 |
||
| 72 | * @var string |
||
| 73 | */ |
||
| 74 | protected $runtimePath = ''; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * 配置后缀 |
||
| 78 | * @var string |
||
| 79 | */ |
||
| 80 | protected $configExt = '.php'; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * 应用初始化器 |
||
| 84 | * @var array |
||
| 85 | */ |
||
| 86 | protected $initializers = [ |
||
| 87 | Error::class, |
||
| 88 | RegisterService::class, |
||
| 89 | BootService::class, |
||
| 90 | ]; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * 注册的系统服务 |
||
| 94 | * @var array |
||
| 95 | */ |
||
| 96 | protected $services = []; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * 初始化 |
||
| 100 | * @var bool |
||
| 101 | */ |
||
| 102 | protected $initialized = false; |
||
| 103 | |||
| 104 | /** |
||
| 105 | * 架构方法 |
||
| 106 | * @access public |
||
| 107 | * @param string $rootPath 应用根目录 |
||
|
1 ignored issue
–
show
|
|||
| 108 | */ |
||
| 109 | 18 | public function __construct(string $rootPath = '') |
|
| 110 | { |
||
| 111 | 18 | $this->thinkPath = dirname(__DIR__) . DIRECTORY_SEPARATOR; |
|
| 112 | 18 | $this->rootPath = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $this->getDefaultRootPath(); |
|
| 113 | 18 | $this->appPath = $this->rootPath . 'app' . DIRECTORY_SEPARATOR; |
|
| 114 | 18 | $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR; |
|
| 115 | |||
| 116 | 18 | if (is_file($this->appPath . 'provider.php')) { |
|
| 117 | 1 | $this->bind(include $this->appPath . 'provider.php'); |
|
| 118 | } |
||
| 119 | |||
| 120 | 18 | static::setInstance($this); |
|
| 121 | |||
| 122 | 18 | $this->instance('app', $this); |
|
| 123 | 18 | $this->instance('think\Container', $this); |
|
| 124 | 18 | } |
|
| 125 | |||
| 126 | /** |
||
| 127 | * 注册服务 |
||
| 128 | * @access public |
||
| 129 | * @param Service|string $service 服务 |
||
|
1 ignored issue
–
show
|
|||
| 130 | * @param bool $force 强制重新注册 |
||
|
1 ignored issue
–
show
|
|||
| 131 | * @return Service|null |
||
| 132 | */ |
||
| 133 | 1 | public function register($service, bool $force = false) |
|
| 134 | { |
||
| 135 | 1 | $registered = $this->getService($service); |
|
| 136 | |||
| 137 | 1 | if ($registered && !$force) { |
|
| 138 | 1 | return $registered; |
|
| 139 | } |
||
| 140 | |||
| 141 | 1 | if (is_string($service)) { |
|
| 142 | 1 | $service = new $service($this); |
|
| 143 | } |
||
| 144 | |||
| 145 | 1 | if (method_exists($service, 'register')) { |
|
| 146 | 1 | $service->register(); |
|
| 147 | } |
||
| 148 | |||
| 149 | 1 | if (property_exists($service, 'bind')) { |
|
| 150 | 1 | $this->bind($service->bind); |
|
| 151 | } |
||
| 152 | |||
| 153 | 1 | $this->services[] = $service; |
|
| 154 | 1 | } |
|
| 155 | |||
| 156 | /** |
||
| 157 | * 执行服务 |
||
| 158 | * @access public |
||
| 159 | * @param Service $service 服务 |
||
|
1 ignored issue
–
show
|
|||
| 160 | * @return mixed |
||
| 161 | */ |
||
| 162 | 1 | public function bootService($service) |
|
| 163 | { |
||
| 164 | 1 | if (method_exists($service, 'boot')) { |
|
| 165 | 1 | return $this->invoke([$service, 'boot']); |
|
| 166 | } |
||
| 167 | 1 | } |
|
| 168 | |||
| 169 | /** |
||
| 170 | * 获取服务 |
||
| 171 | * @param string|Service $service |
||
|
1 ignored issue
–
show
|
|||
| 172 | * @return Service|null |
||
| 173 | */ |
||
| 174 | 1 | public function getService($service) |
|
| 175 | { |
||
| 176 | 1 | $name = is_string($service) ? $service : get_class($service); |
|
| 177 | return array_values(array_filter($this->services, function ($value) use ($name) { |
||
| 178 | 1 | return $value instanceof $name; |
|
| 179 | 1 | }, ARRAY_FILTER_USE_BOTH))[0] ?? null; |
|
| 180 | } |
||
| 181 | |||
| 182 | /** |
||
| 183 | * 开启应用调试模式 |
||
| 184 | * @access public |
||
| 185 | * @param bool $debug 开启应用调试模式 |
||
|
1 ignored issue
–
show
|
|||
| 186 | * @return $this |
||
| 187 | */ |
||
| 188 | 2 | public function debug(bool $debug = true) |
|
| 192 | } |
||
| 193 | |||
| 194 | /** |
||
| 195 | * 是否为调试模式 |
||
| 196 | * @access public |
||
| 197 | * @return bool |
||
| 198 | */ |
||
| 199 | 7 | public function isDebug(): bool |
|
| 200 | { |
||
| 201 | 7 | return $this->appDebug; |
|
| 202 | } |
||
| 203 | |||
| 204 | /** |
||
| 205 | * 设置应用命名空间 |
||
| 206 | * @access public |
||
| 207 | * @param string $namespace 应用命名空间 |
||
|
1 ignored issue
–
show
|
|||
| 208 | * @return $this |
||
| 209 | */ |
||
| 210 | 7 | public function setNamespace(string $namespace) |
|
| 211 | { |
||
| 212 | 7 | $this->namespace = $namespace; |
|
| 213 | 7 | return $this; |
|
| 214 | } |
||
| 215 | |||
| 216 | /** |
||
| 217 | * 获取应用类库命名空间 |
||
| 218 | * @access public |
||
| 219 | * @return string |
||
| 220 | */ |
||
| 221 | 1 | public function getNamespace(): string |
|
| 222 | { |
||
| 223 | 1 | return $this->namespace; |
|
| 224 | } |
||
| 225 | |||
| 226 | /** |
||
| 227 | * 获取框架版本 |
||
| 228 | * @access public |
||
| 229 | * @return string |
||
| 230 | */ |
||
| 231 | 1 | public function version(): string |
|
| 232 | { |
||
| 233 | 1 | return static::VERSION; |
|
| 234 | } |
||
| 235 | |||
| 236 | /** |
||
| 237 | * 获取应用根目录 |
||
| 238 | * @access public |
||
| 239 | * @return string |
||
| 240 | */ |
||
| 241 | 1 | public function getRootPath(): string |
|
| 242 | { |
||
| 243 | 1 | return $this->rootPath; |
|
| 244 | } |
||
| 245 | |||
| 246 | /** |
||
| 247 | * 获取应用基础目录 |
||
| 248 | * @access public |
||
| 249 | * @return string |
||
| 250 | */ |
||
| 251 | 10 | public function getBasePath(): string |
|
| 252 | { |
||
| 253 | 10 | return $this->rootPath . 'app' . DIRECTORY_SEPARATOR; |
|
| 254 | } |
||
| 255 | |||
| 256 | /** |
||
| 257 | * 获取当前应用目录 |
||
| 258 | * @access public |
||
| 259 | * @return string |
||
| 260 | */ |
||
| 261 | 7 | public function getAppPath(): string |
|
| 262 | { |
||
| 263 | 7 | return $this->appPath; |
|
| 264 | } |
||
| 265 | |||
| 266 | /** |
||
| 267 | * 设置应用目录 |
||
| 268 | * @param $path |
||
| 269 | */ |
||
| 270 | 6 | public function setAppPath($path) |
|
| 271 | { |
||
| 272 | 6 | $this->appPath = $path; |
|
| 273 | 6 | } |
|
| 274 | |||
| 275 | /** |
||
| 276 | * 获取应用运行时目录 |
||
| 277 | * @access public |
||
| 278 | * @return string |
||
| 279 | */ |
||
| 280 | 7 | public function getRuntimePath(): string |
|
| 281 | { |
||
| 282 | 7 | return $this->runtimePath; |
|
| 283 | } |
||
| 284 | |||
| 285 | /** |
||
| 286 | * 设置runtime目录 |
||
| 287 | * @param $path |
||
| 288 | */ |
||
| 289 | 6 | public function setRuntimePath($path) |
|
| 290 | { |
||
| 291 | 6 | $this->runtimePath = $path; |
|
| 292 | 6 | } |
|
| 293 | |||
| 294 | /** |
||
| 295 | * 获取核心框架目录 |
||
| 296 | * @access public |
||
| 297 | * @return string |
||
| 298 | */ |
||
| 299 | 1 | public function getThinkPath(): string |
|
| 300 | { |
||
| 301 | 1 | return $this->thinkPath; |
|
| 302 | } |
||
| 303 | |||
| 304 | /** |
||
| 305 | * 获取应用配置目录 |
||
| 306 | * @access public |
||
| 307 | * @return string |
||
| 308 | */ |
||
| 309 | 10 | public function getConfigPath(): string |
|
| 310 | { |
||
| 311 | 10 | return $this->rootPath . 'config' . DIRECTORY_SEPARATOR; |
|
| 312 | } |
||
| 313 | |||
| 314 | /** |
||
| 315 | * 获取配置后缀 |
||
| 316 | * @access public |
||
| 317 | * @return string |
||
| 318 | */ |
||
| 319 | 9 | public function getConfigExt(): string |
|
| 320 | { |
||
| 321 | 9 | return $this->configExt; |
|
| 322 | } |
||
| 323 | |||
| 324 | /** |
||
| 325 | * 获取应用开启时间 |
||
| 326 | * @access public |
||
| 327 | * @return float |
||
| 328 | */ |
||
| 329 | 1 | public function getBeginTime(): float |
|
| 330 | { |
||
| 331 | 1 | return $this->beginTime; |
|
| 332 | } |
||
| 333 | |||
| 334 | /** |
||
| 335 | * 获取应用初始内存占用 |
||
| 336 | * @access public |
||
| 337 | * @return integer |
||
| 338 | */ |
||
| 339 | 1 | public function getBeginMem(): int |
|
| 342 | } |
||
| 343 | |||
| 344 | /** |
||
| 345 | * 初始化应用 |
||
| 346 | * @access public |
||
| 347 | * @return $this |
||
| 348 | */ |
||
| 349 | 1 | public function initialize() |
|
| 350 | { |
||
| 351 | 1 | $this->initialized = true; |
|
| 352 | |||
| 353 | 1 | $this->beginTime = microtime(true); |
|
| 354 | 1 | $this->beginMem = memory_get_usage(); |
|
| 355 | |||
| 356 | // 加载环境变量 |
||
| 357 | 1 | if (is_file($this->rootPath . '.env')) { |
|
| 358 | 1 | $this->env->load($this->rootPath . '.env'); |
|
| 359 | } |
||
| 360 | |||
| 361 | 1 | $this->configExt = $this->env->get('config_ext', '.php'); |
|
| 362 | |||
| 363 | // 加载全局初始化文件 |
||
| 364 | 1 | $this->load(); |
|
| 365 | |||
| 366 | 1 | $this->debugModeInit(); |
|
| 367 | |||
| 368 | // 加载框架默认语言包 |
||
| 369 | 1 | $langSet = $this->lang->defaultLangSet(); |
|
| 370 | |||
| 371 | 1 | $this->lang->load($this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $langSet . '.php'); |
|
| 372 | |||
| 373 | // 加载应用默认语言包 |
||
| 374 | 1 | $this->loadLangPack($langSet); |
|
| 375 | |||
| 376 | // 监听AppInit |
||
| 377 | 1 | $this->event->trigger('AppInit'); |
|
| 378 | |||
| 379 | 1 | date_default_timezone_set($this->config->get('app.default_timezone', 'Asia/Shanghai')); |
|
| 380 | |||
| 381 | // 初始化 |
||
| 382 | 1 | foreach ($this->initializers as $initializer) { |
|
| 383 | 1 | $this->make($initializer)->init($this); |
|
| 384 | } |
||
| 385 | |||
| 386 | 1 | return $this; |
|
| 387 | } |
||
| 388 | |||
| 389 | /** |
||
| 390 | * 是否初始化过 |
||
| 391 | * @return bool |
||
| 392 | */ |
||
| 393 | 1 | public function initialized() |
|
| 394 | { |
||
| 395 | 1 | return $this->initialized; |
|
| 396 | } |
||
| 397 | |||
| 398 | /** |
||
| 399 | * 加载语言包 |
||
| 400 | * @param string $langset 语言 |
||
|
1 ignored issue
–
show
|
|||
| 401 | * @return void |
||
| 402 | */ |
||
| 403 | 6 | public function loadLangPack($langset) |
|
| 404 | { |
||
| 405 | 6 | if (empty($langset)) { |
|
| 406 | return; |
||
| 407 | } |
||
| 408 | |||
| 409 | // 加载系统语言包 |
||
| 410 | 6 | $files = glob($this->appPath . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*'); |
|
| 411 | 6 | $this->lang->load($files); |
|
| 412 | |||
| 413 | // 加载扩展(自定义)语言包 |
||
| 414 | 6 | $list = $this->config->get('lang.extend_list', []); |
|
| 415 | |||
| 416 | 6 | if (isset($list[$langset])) { |
|
| 417 | $this->lang->load($list[$langset]); |
||
| 418 | } |
||
| 419 | 6 | } |
|
| 420 | |||
| 421 | /** |
||
| 422 | * 引导应用 |
||
| 423 | * @access public |
||
| 424 | * @return void |
||
| 425 | */ |
||
| 426 | 1 | public function boot(): void |
|
| 427 | { |
||
| 428 | array_walk($this->services, function ($service) { |
||
| 429 | 1 | $this->bootService($service); |
|
| 430 | 1 | }); |
|
| 431 | 1 | } |
|
| 432 | |||
| 433 | /** |
||
| 434 | * 加载应用文件和配置 |
||
| 435 | * @access protected |
||
| 436 | * @return void |
||
| 437 | */ |
||
| 438 | 1 | protected function load(): void |
|
| 439 | { |
||
| 440 | 1 | $appPath = $this->getAppPath(); |
|
| 441 | |||
| 442 | 1 | if (is_file($appPath . 'common.php')) { |
|
| 443 | 1 | include $appPath . 'common.php'; |
|
| 444 | } |
||
| 445 | |||
| 446 | 1 | include $this->thinkPath . 'helper.php'; |
|
| 447 | |||
| 448 | 1 | $configPath = $this->getConfigPath(); |
|
| 449 | |||
| 450 | 1 | $files = []; |
|
| 451 | |||
| 452 | 1 | if (is_dir($configPath)) { |
|
| 453 | 1 | $files = glob($configPath . '*' . $this->configExt); |
|
| 454 | } |
||
| 455 | |||
| 456 | 1 | foreach ($files as $file) { |
|
| 457 | $this->config->load($file, pathinfo($file, PATHINFO_FILENAME)); |
||
| 458 | } |
||
| 459 | |||
| 460 | 1 | if (is_file($appPath . 'event.php')) { |
|
| 461 | 1 | $this->loadEvent(include $appPath . 'event.php'); |
|
| 462 | } |
||
| 463 | |||
| 464 | 1 | if (is_file($appPath . 'service.php')) { |
|
| 465 | $services = include $appPath . 'service.php'; |
||
| 466 | foreach ($services as $service) { |
||
| 467 | $this->register($service); |
||
| 468 | } |
||
| 469 | } |
||
| 470 | 1 | } |
|
| 471 | |||
| 472 | /** |
||
| 473 | * 调试模式设置 |
||
| 474 | * @access protected |
||
| 475 | * @return void |
||
| 476 | */ |
||
| 477 | 1 | protected function debugModeInit(): void |
|
| 478 | { |
||
| 479 | // 应用调试模式 |
||
| 480 | 1 | if (!$this->appDebug) { |
|
| 481 | 1 | $this->appDebug = $this->env->get('app_debug') ? true : false; |
|
| 482 | 1 | ini_set('display_errors', 'Off'); |
|
| 483 | } |
||
| 484 | |||
| 485 | 1 | if (!$this->runningInConsole()) { |
|
| 486 | //重新申请一块比较大的buffer |
||
| 487 | if (ob_get_level() > 0) { |
||
| 488 | $output = ob_get_clean(); |
||
| 489 | } |
||
| 490 | ob_start(); |
||
| 491 | if (!empty($output)) { |
||
| 492 | echo $output; |
||
| 493 | } |
||
| 494 | } |
||
| 495 | 1 | } |
|
| 496 | |||
| 497 | /** |
||
| 498 | * 注册应用事件 |
||
| 499 | * @access protected |
||
| 500 | * @param array $event 事件数据 |
||
|
1 ignored issue
–
show
|
|||
| 501 | * @return void |
||
| 502 | */ |
||
| 503 | 2 | public function loadEvent(array $event): void |
|
| 504 | { |
||
| 505 | 2 | if (isset($event['bind'])) { |
|
| 506 | 2 | $this->event->bind($event['bind']); |
|
| 507 | } |
||
| 508 | |||
| 509 | 2 | if (isset($event['listen'])) { |
|
| 510 | 2 | $this->event->listenEvents($event['listen']); |
|
| 511 | } |
||
| 512 | |||
| 513 | 2 | if (isset($event['subscribe'])) { |
|
| 514 | 2 | $this->event->subscribe($event['subscribe']); |
|
| 515 | } |
||
| 516 | 2 | } |
|
| 517 | |||
| 518 | /** |
||
| 519 | * 解析应用类的类名 |
||
| 520 | * @access public |
||
| 521 | * @param string $layer 层名 controller model ... |
||
|
1 ignored issue
–
show
|
|||
| 522 | * @param string $name 类名 |
||
|
1 ignored issue
–
show
|
|||
| 523 | * @return string |
||
| 524 | */ |
||
| 525 | 1 | public function parseClass(string $layer, string $name): string |
|
| 526 | { |
||
| 527 | 1 | $name = str_replace(['/', '.'], '\\', $name); |
|
| 528 | 1 | $array = explode('\\', $name); |
|
| 529 | 1 | $class = self::parseName(array_pop($array), 1); |
|
| 530 | 1 | $path = $array ? implode('\\', $array) . '\\' : ''; |
|
| 531 | |||
| 532 | 1 | return $this->namespace . '\\' . $layer . '\\' . $path . $class; |
|
| 533 | } |
||
| 534 | |||
| 535 | /** |
||
| 536 | * 是否运行在命令行下 |
||
| 537 | * @return bool |
||
| 538 | */ |
||
| 539 | 1 | public function runningInConsole() |
|
| 540 | { |
||
| 541 | 1 | return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; |
|
| 542 | } |
||
| 543 | |||
| 544 | /** |
||
| 545 | * 获取应用根目录 |
||
| 546 | * @access protected |
||
| 547 | * @return string |
||
| 548 | */ |
||
| 549 | 18 | protected function getDefaultRootPath(): string |
|
| 550 | { |
||
| 551 | 18 | $path = dirname(dirname(dirname(dirname($this->thinkPath)))); |
|
| 552 | |||
| 553 | 18 | return $path . DIRECTORY_SEPARATOR; |
|
| 554 | } |
||
| 555 | |||
| 556 | /** |
||
| 557 | * 字符串命名风格转换 |
||
| 558 | * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格 |
||
| 559 | * @access public |
||
| 560 | * @param string $name 字符串 |
||
|
1 ignored issue
–
show
|
|||
| 561 | * @param integer $type 转换类型 |
||
|
1 ignored issue
–
show
|
|||
| 562 | * @param bool $ucfirst 首字母是否大写(驼峰规则) |
||
|
1 ignored issue
–
show
|
|||
| 563 | * @return string |
||
| 564 | */ |
||
| 565 | 13 | public static function parseName(string $name = null, int $type = 0, bool $ucfirst = true): string |
|
| 566 | { |
||
| 567 | 13 | if ($type) { |
|
| 568 | $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { |
||
| 569 | 2 | return strtoupper($match[1]); |
|
| 570 | 2 | }, $name); |
|
| 571 | 2 | return $ucfirst ? ucfirst($name) : lcfirst($name); |
|
| 572 | } |
||
| 573 | |||
| 574 | 12 | return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_")); |
|
| 575 | } |
||
| 576 | |||
| 577 | /** |
||
| 578 | * 获取类名(不包含命名空间) |
||
| 579 | * @access public |
||
| 580 | * @param string|object $class |
||
|
1 ignored issue
–
show
|
|||
| 581 | * @return string |
||
| 582 | */ |
||
| 583 | 1 | public static function classBaseName($class): string |
|
| 584 | { |
||
| 585 | 1 | $class = is_object($class) ? get_class($class) : $class; |
|
| 586 | 1 | return basename(str_replace('\\', '/', $class)); |
|
| 587 | } |
||
| 588 | |||
| 589 | /** |
||
| 590 | * 创建工厂对象实例 |
||
| 591 | * @access public |
||
| 592 | * @param string $name 工厂类名 |
||
|
1 ignored issue
–
show
|
|||
| 593 | * @param string $namespace 默认命名空间 |
||
|
1 ignored issue
–
show
|
|||
| 594 | * @param array $args |
||
|
1 ignored issue
–
show
|
|||
| 595 | * @return mixed |
||
| 596 | */ |
||
| 597 | 1 | public static function factory(string $name, string $namespace = '', ...$args) |
|
| 598 | { |
||
| 599 | 1 | $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name); |
|
| 600 | |||
| 601 | 1 | if (class_exists($class)) { |
|
| 602 | 1 | return Container::getInstance()->invokeClass($class, $args); |
|
| 603 | } |
||
| 604 | |||
| 605 | 1 | throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
| 606 | } |
||
| 607 | |||
| 608 | /** |
||
| 609 | * @param $data |
||
|
1 ignored issue
–
show
|
|||
| 610 | * @codeCoverageIgnore |
||
| 611 | * @return string |
||
|
1 ignored issue
–
show
|
|||
| 612 | */ |
||
| 613 | public static function serialize($data): string |
||
| 620 | } |
||
| 621 | |||
| 622 | /** |
||
| 623 | * @param string $data |
||
|
1 ignored issue
–
show
|
|||
| 624 | * @codeCoverageIgnore |
||
| 625 | * @return mixed|string |
||
|
1 ignored issue
–
show
|
|||
| 626 | */ |
||
| 627 | public static function unserialize(string $data) |
||
| 634 | } |
||
| 635 | } |
||
| 636 |