Skip to content

Commit 28e5469

Browse files
authored
Refactor files in src/ (#242)
1 parent c858f33 commit 28e5469

19 files changed

Lines changed: 45 additions & 44 deletions

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
"yiisoft/log": "^2.1.1",
5454
"yiisoft/log-target-file": "^3.0",
5555
"yiisoft/middleware-dispatcher": "^5.3",
56-
"yiisoft/request-body-parser": "^1.1.1",
56+
"yiisoft/request-body-parser": "^1.2.0",
5757
"yiisoft/request-provider": "^1.2",
58-
"yiisoft/router": "^4.0",
59-
"yiisoft/router-fastroute": "^4.0.1",
58+
"yiisoft/router": "^4.0.1",
59+
"yiisoft/router-fastroute": "^4.0.2",
6060
"yiisoft/validator": "^2.5",
6161
"yiisoft/yii-console": "^2.3",
6262
"yiisoft/yii-event": "^2.1",
@@ -74,7 +74,7 @@
7474
"codeception/module-phpbrowser": "^3.0.2",
7575
"codeception/module-rest": "^3.4.1",
7676
"friendsofphp/php-cs-fixer": "^3.87.2",
77-
"phpunit/phpunit": "^11.5.37",
77+
"phpunit/phpunit": "^11.5.41",
7878
"rector/rector": "^2.1.7",
7979
"roave/infection-static-analysis-plugin": "^1.39",
8080
"shipmonk/composer-dependency-analyser": "^1.8.3",

config/common/di/application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
use App\ApplicationParams;
5+
use App\Shared\ApplicationParams;
66

77
/** @var array $params */
88

config/common/routes.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
declare(strict_types=1);
44

5-
use App\Controller\IndexAction;
5+
use App\Api;
66
use Yiisoft\Router\Route;
77

88
/**
99
* @var array $params
1010
*/
1111

1212
return [
13-
Route::get('/')
14-
->action(IndexAction::class)
15-
->name('app/index'),
13+
Route::get('/')->action(Api\IndexAction::class)->name('app/index'),
1614
];

config/console/commands.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
declare(strict_types=1);
44

5-
use App\Command\HelloCommand;
5+
use App\Console;
66

77
return [
8-
'hello' => HelloCommand::class,
8+
'hello' => Console\HelloCommand::class,
99
];

config/web/di/application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
declare(strict_types=1);
44

5-
use App\Http\ExceptionResponderFactory;
6-
use App\Http\NotFoundMiddleware;
5+
use App\Api\Shared\ExceptionResponderFactory;
6+
use App\Api\Shared\NotFoundMiddleware;
77
use Yiisoft\DataResponse\Formatter\JsonDataResponseFormatter;
88
use Yiisoft\DataResponse\Formatter\XmlDataResponseFormatter;
99
use Yiisoft\DataResponse\Middleware\ContentNegotiator;
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Controller;
5+
namespace App\Api;
66

7-
use App\ApplicationParams;
8-
use App\Http\ApiResponseFactory;
7+
use App\Api\Shared\ResponseFactory;
8+
use App\Shared\ApplicationParams;
99
use Psr\Http\Message\ResponseInterface;
1010

1111
final class IndexAction
1212
{
1313
public function __invoke(
14-
ApiResponseFactory $apiResponseFactory,
14+
ResponseFactory $responseFactory,
1515
ApplicationParams $applicationParams,
1616
): ResponseInterface {
17-
return $apiResponseFactory->success([
17+
return $responseFactory->success([
1818
'name' => $applicationParams->name,
1919
'version' => $applicationParams->version,
2020
]);

src/Http/ExceptionResponderFactory.php renamed to src/Api/Shared/ExceptionResponderFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Http;
5+
namespace App\Api\Shared;
66

77
use Psr\Http\Message\ResponseFactoryInterface;
88
use Psr\Http\Message\ResponseInterface;
@@ -15,8 +15,8 @@
1515
final readonly class ExceptionResponderFactory
1616
{
1717
public function __construct(
18-
private ResponseFactoryInterface $responseFactory,
19-
private ApiResponseFactory $apiResponseFactory,
18+
private ResponseFactoryInterface $psrResponseFactory,
19+
private ResponseFactory $apiResponseFactory,
2020
private Injector $injector,
2121
) {}
2222

@@ -27,7 +27,7 @@ public function create(): ExceptionResponder
2727
InputValidationException::class => $this->inputValidationException(...),
2828
Throwable::class => $this->throwable(...),
2929
],
30-
$this->responseFactory,
30+
$this->psrResponseFactory,
3131
$this->injector,
3232
);
3333
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Http;
5+
namespace App\Api\Shared;
66

77
use Psr\Http\Message\ResponseInterface;
88
use Psr\Http\Message\ServerRequestInterface;
@@ -12,11 +12,11 @@
1212
final readonly class NotFoundMiddleware implements MiddlewareInterface
1313
{
1414
public function __construct(
15-
private ApiResponseFactory $apiResponseFactory,
15+
private ResponseFactory $responseFactory,
1616
) {}
1717

1818
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
1919
{
20-
return $this->apiResponseFactory->notFound();
20+
return $this->responseFactory->notFound();
2121
}
2222
}

src/Http/Presenter/AsIsPresenter.php renamed to src/Api/Shared/Presenter/AsIsPresenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Http\Presenter;
5+
namespace App\Api\Shared\Presenter;
66

77
use Yiisoft\DataResponse\DataResponse;
88

src/Http/Presenter/CollectionPresenter.php renamed to src/Api/Shared/Presenter/CollectionPresenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace App\Http\Presenter;
5+
namespace App\Api\Shared\Presenter;
66

77
use Yiisoft\DataResponse\DataResponse;
88

0 commit comments

Comments
 (0)