for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace SlayerBirden\DataFlowServer\Authorization\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use SlayerBirden\DataFlowServer\Authorization\Service\ResourceManager;
use SlayerBirden\DataFlowServer\Stdlib\Validation\GeneralSuccessResponseFactory;
final class GetResourcesAction implements MiddlewareInterface
{
/**
* @var ResourceManager
*/
private $resourceManager;
public function __construct(ResourceManager $resourceManager)
$this->resourceManager = $resourceManager;
}
* @inheritdoc
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
$resources = $this->resourceManager->getAllResources();
$count = count($resources);
return (new GeneralSuccessResponseFactory())('Success', 'resources', $resources, 200, $count);