Skip to content

Commit

Permalink
Adapt to router changes (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
rustamwin authored Nov 22, 2021
1 parent 2ac9df5 commit e5dd730
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/Controller/DebugController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Yiisoft\Yii\Debug\Api\Controller;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Yiisoft\DataResponse\DataResponseFactoryInterface;
use Yiisoft\Router\CurrentRouteInterface;
use Yiisoft\Yii\Debug\Api\Repository\CollectorRepositoryInterface;

/**
Expand Down Expand Up @@ -38,27 +38,27 @@ public function index(): ResponseInterface
/**
* Summary about a processed request identified by ID specified.
*
* @param ServerRequestInterface $request
* @param CurrentRouteInterface $currentRoute
*
* @return ResponseInterface
*/
public function summary(ServerRequestInterface $request): ResponseInterface
public function summary(CurrentRouteInterface $currentRoute): ResponseInterface
{
$data = $this->collectorRepository->getSummary($request->getAttribute('id'));
$data = $this->collectorRepository->getSummary($currentRoute->getArgument('id'));
return $this->responseFactory->createResponse($data);
}

/**
* Detail information about a processed request identified by ID.
*
* @param ServerRequestInterface $request
* @param CurrentRouteInterface $currentRoute
*
* @return ResponseInterface response.
*/
public function view(ServerRequestInterface $request): ResponseInterface
public function view(CurrentRouteInterface $currentRoute): ResponseInterface
{
$data = $this->collectorRepository->getDetail(
$request->getAttribute('id')
$currentRoute->getArgument('id')
);

return $this->responseFactory->createResponse($data);
Expand All @@ -67,14 +67,14 @@ public function view(ServerRequestInterface $request): ResponseInterface
/**
* Dump information about a processed request identified by ID.
*
* @param ServerRequestInterface $request
* @param CurrentRouteInterface $currentRoute
*
* @return ResponseInterface response.
*/
public function dump(ServerRequestInterface $request): ResponseInterface
public function dump(CurrentRouteInterface $currentRoute): ResponseInterface
{
$data = $this->collectorRepository->getDumpObject(
$request->getAttribute('id')
$currentRoute->getArgument('id')
);

return $this->responseFactory->createResponse($data);
Expand All @@ -83,15 +83,15 @@ public function dump(ServerRequestInterface $request): ResponseInterface
/**
* Object information about a processed request identified by ID.
*
* @param ServerRequestInterface $request
* @param CurrentRouteInterface $currentRoute
*
* @return ResponseInterface response.
*/
public function object(ServerRequestInterface $request): ResponseInterface
public function object(CurrentRouteInterface $currentRoute): ResponseInterface
{
$data = $this->collectorRepository->getObject(
$request->getAttribute('id'),
$request->getAttribute('objectId')
$currentRoute->getArgument('id'),
$currentRoute->getArgument('objectId')
);

return $this->responseFactory->createResponse($data);
Expand Down

0 comments on commit e5dd730

Please sign in to comment.