47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Test;
|
|
|
|
use App\Controller\AbstractController;
|
|
use App\Service\Test\Decorator\AopService;
|
|
use App\Service\Test\Decorator\BasicService;
|
|
use App\Service\Test\Decorator\ContainerService;
|
|
use App\Service\Test\Decorator\HttpService;
|
|
use Hyperf\HttpServer\Annotation\Controller;
|
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
|
|
|
#[Controller(prefix: 'decorator/test')]
|
|
class DecoratorController extends AbstractController
|
|
{
|
|
/**
|
|
* basic 装饰器
|
|
* @return array
|
|
*/
|
|
#[RequestMapping(path: 'basic', methods: 'GET')]
|
|
public function basic(): array
|
|
{
|
|
return (new BasicService)->handle();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
#[RequestMapping(path: 'container', methods: 'GET')]
|
|
public function container(): array
|
|
{
|
|
return (new ContainerService)->handle();
|
|
}
|
|
|
|
public function aop()
|
|
{
|
|
return (new AopService)->handle();
|
|
}
|
|
|
|
public function http()
|
|
{
|
|
return (new HttpService)->handle();
|
|
}
|
|
}
|