Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code refactoring #100

Merged
merged 6 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix cs
  • Loading branch information
butschster committed Dec 1, 2023
commit 894322c40b4ce9503d06aebb560a7c7b13f8c897
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ rr*
protoc-gen-php-grpc*
.env
.phpunit.result.cache
.php-cs-fixer.cache
.deptrac.cache
composer.lock
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<a href="https://discord.gg/vDsCD3EKUB"><img src="https://img.shields.io/badge/discord-chat-magenta.svg"></a>
[![Twitter](https://img.shields.io/badge/twitter-Follow-blue)](https://twitter.com/buggregator)
[![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dbutschster%26type%3Dpatrons&style=flat)](https://patreon.com/butschster)
[![phpunit](https://github.com/buggregator/server/actions/workflows/phpunit.yml/badge.svg)](https://github.com/buggregator/server/actions/workflows/phpunit.yml)

**Buggregator is a lightweight, standalone server that offers a range of debugging features for PHP applications. Think of it as a Swiss Army knife for developers. What makes it special is that it offers a range of features that you would usually find in various paid tools, but it's available for free.**

Expand Down
3 changes: 1 addition & 2 deletions app/src/Application/AppDirectories.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ final class AppDirectories
{
public function __construct(
private readonly DirectoriesInterface $directories
) {
}
) {}

/**
* Application root directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ final class BroadcastEventInterceptor implements CoreInterceptorInterface
{
public function __construct(
private readonly BroadcastInterface $broadcast
) {
}
) {}

public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed
{
Expand Down
3 changes: 1 addition & 2 deletions app/src/Application/Broadcasting/Channel/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class Channel implements \Stringable
{
public function __construct(
public readonly string $name
) {
}
) {}

public function __toString(): string
{
Expand Down
3 changes: 1 addition & 2 deletions app/src/Application/Commands/AskEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ abstract class AskEvents implements QueryInterface
public function __construct(
public readonly ?string $type = null,
public readonly ?int $projectId = null,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions app/src/Application/Commands/ClearEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class ClearEvents implements CommandInterface
{
public function __construct(
public readonly ?string $type = null
) {
}
) {}
}
4 changes: 1 addition & 3 deletions app/src/Application/Commands/CountEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\Application\Commands;

final class CountEvents extends AskEvents
{
}
final class CountEvents extends AskEvents {}
3 changes: 1 addition & 2 deletions app/src/Application/Commands/DeleteEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ class DeleteEvent implements CommandInterface
{
public function __construct(
public readonly Uuid $uuid
) {
}
) {}
}
3 changes: 1 addition & 2 deletions app/src/Application/Commands/FinUserByUsername.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class FinUserByUsername implements QueryInterface
{
public function __construct(
public readonly string $username
) {
}
) {}
}
4 changes: 1 addition & 3 deletions app/src/Application/Commands/FindAllProjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use Spiral\Cqrs\QueryInterface;

class FindAllProjects implements QueryInterface
{
}
class FindAllProjects implements QueryInterface {}
4 changes: 1 addition & 3 deletions app/src/Application/Commands/FindAllTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use Spiral\Cqrs\QueryInterface;

class FindAllTransactions implements QueryInterface
{
}
class FindAllTransactions implements QueryInterface {}
3 changes: 1 addition & 2 deletions app/src/Application/Commands/FindEventByUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ class FindEventByUuid implements QueryInterface
{
public function __construct(
public readonly Uuid $uuid
) {
}
) {}
}
4 changes: 1 addition & 3 deletions app/src/Application/Commands/FindEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\Application\Commands;

final class FindEvents extends AskEvents
{
}
final class FindEvents extends AskEvents {}
3 changes: 1 addition & 2 deletions app/src/Application/Commands/FindProjectByName.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class FindProjectByName implements QueryInterface
{
public function __construct(
public readonly string $name
) {
}
) {}
}
3 changes: 1 addition & 2 deletions app/src/Application/Commands/FindTransactionByName.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class FindTransactionByName implements QueryInterface
{
public function __construct(
public readonly string $name
) {
}
) {}
}
3 changes: 1 addition & 2 deletions app/src/Application/Domain/Entity/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ final class Json implements \JsonSerializable
{
public function __construct(
private readonly array $data = []
) {
}
) {}

public static function cast(string $value, DatabaseInterface $db): self
{
Expand Down
5 changes: 1 addition & 4 deletions app/src/Application/Exception/EntityNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@

namespace App\Application\Exception;

class EntityNotFoundException extends \DomainException
{
}

class EntityNotFoundException extends \DomainException {}
3 changes: 1 addition & 2 deletions app/src/Application/HTTP/GzippedStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ final class GzippedStream
{
public function __construct(
private readonly StreamInterface $stream,
) {
}
) {}

public function getPayload(): \Traversable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ final class JsonResourceInterceptor implements CoreInterceptorInterface
public function __construct(
private readonly ResponseFactoryInterface $responseFactory,
private readonly ExceptionHandlerInterface $exceptionHandler,
) {
}
) {}

public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed
{
Expand Down
3 changes: 1 addition & 2 deletions app/src/Application/Persistence/MongoDBEventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ final class MongoDBEventRepository implements EventRepositoryInterface
{
public function __construct(
private readonly Collection $collection,
) {
}
) {}

public function store(Event $event): bool
{
Expand Down
3 changes: 1 addition & 2 deletions app/src/Application/Service/HttpHandler/HandlerPipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final class HandlerPipeline implements HandlerRegistryInterface, CoreHandlerInte

public function __construct(
private readonly FactoryInterface $factory,
) {
}
) {}

public function register(HandlerInterface $handler): void
{
Expand Down
3 changes: 1 addition & 2 deletions app/src/Application/TCP/ExceptionHandlerInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ final class ExceptionHandlerInterceptor implements CoreInterceptorInterface
{
public function __construct(
private readonly ExceptionReporterInterface $reporter
) {
}
) {}

public function process(string $controller, string $action, array $parameters, CoreInterface $core): ResponseInterface
{
Expand Down
7 changes: 1 addition & 6 deletions app/src/Interfaces/Centrifugo/RPCService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ final class RPCService implements ServiceInterface
public function __construct(
private readonly Http $http,
private readonly ServerRequestFactoryInterface $requestFactory,
) {
}
) {}

/**
* @param Request\RPC $request
Expand Down Expand Up @@ -60,10 +59,6 @@ public function createHttpRequest(Request\RPC $request): ServerRequestInterface
$httpRequest = $this->requestFactory->createServerRequest(\strtoupper($method), \ltrim($uri, '/'))
->withHeader('Content-Type', 'application/json');

// foreach ($request->headers as $key => $headers) {
// $httpRequest = $httpRequest->withHeader($key, $headers);
// }

return match ($method) {
'GET', 'HEAD' => $httpRequest->withQueryParams($request->getData()),
'POST', 'PUT', 'DELETE' => $httpRequest->withParsedBody($request->getData()),
Expand Down
3 changes: 1 addition & 2 deletions app/src/Interfaces/Http/Handler/FrontendRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ final class FrontendRequest implements HandlerInterface

public function __construct(
private readonly string $publicPath,
) {
}
) {}

public function priority(): int
{
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"phpunit/phpunit": "^9.5",
"qossmic/deptrac-shim": "^1.0",
"spiral/testing": "^2.6",
"friendsofphp/php-cs-fixer": "^3.40",
"vimeo/psalm": "^5.16"
},
"autoload": {
Expand All @@ -66,7 +67,8 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"spiral/composer-publish-plugin": true
"spiral/composer-publish-plugin": true,
"php-http/discovery": false
}
},
"scripts": {
Expand All @@ -76,9 +78,9 @@
"php app.php configure -vv",
"rr get-binary"
],
"rr:download": "rr get-binary",
"rr:download-protoc": "rr download-protoc-binary",
"psalm:config": "psalm",
"psalm": "vendor/bin/psalm --config=psalm.xml ./app",
"cs-check": "vendor/bin/php-cs-fixer fix ./app/src [email protected] --dry-run",
"cs-fix": "vendor/bin/php-cs-fixer fix ./app/src [email protected]",
"deptrack": [
"deptrac analyze --report-uncovered"
]
Expand Down
Loading