Skip to content

Commit

Permalink
Refactor: format constructors to PSR
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Dadyka committed Feb 8, 2023
1 parent 9d20743 commit f471555
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 30 deletions.
5 changes: 3 additions & 2 deletions adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public function execute(): string;

class AdapterImplementation implements Adapter
{
public function __construct(private APIClass $apiClass)
{
public function __construct(
private APIClass $apiClass
) {
}

public function execute(): string
Expand Down
10 changes: 6 additions & 4 deletions builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ private function setText(string $methodName): void

class Director
{
public function __construct(private Builder $builder)
{
public function __construct(
private Builder $builder
) {
}

public function build(): string
Expand All @@ -65,8 +66,9 @@ public function build(): string

class Manager
{
public function __construct(private StepABuilder $stepABuilder)
{
public function __construct(
private StepABuilder $stepABuilder
) {
}

public function build(): string
Expand Down
21 changes: 13 additions & 8 deletions builder2.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ interface Builder extends StepABuilder, StepBBuilder

class TextBuilderImplementation implements TextBuilder
{
public function __construct(protected TextDTO $textDTO)
{
public function __construct(
protected TextDTO $textDTO
) {
}

public function getText(): string
Expand Down Expand Up @@ -70,8 +71,10 @@ class BuilderImplementation implements Builder
{
private TextBuilder $textBuilder;

public function __construct(private StepABuilder $stepABuilder, private StepBBuilder $stepBBuilder)
{
public function __construct(
private StepABuilder $stepABuilder,
private StepBBuilder $stepBBuilder
) {
$this->textBuilder = $stepABuilder;
}

Expand All @@ -97,8 +100,9 @@ public function getText(): string

class Director
{
public function __construct(private Builder $builder)
{
public function __construct(
private Builder $builder
) {
}

public function build(): string
Expand All @@ -112,8 +116,9 @@ public function build(): string

class Manager
{
public function __construct(private StepABuilder $stepABuilder)
{
public function __construct(
private StepABuilder $stepABuilder
) {
}

public function build(): string
Expand Down
6 changes: 4 additions & 2 deletions command.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public function execute(): string

class Invoker
{
public function __construct(private Command $commandA, private Command $commandB)
{
public function __construct(
private Command $commandA,
private Command $commandB
) {
}

public function executeCommandA(): string
Expand Down
5 changes: 3 additions & 2 deletions decorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public function execute(): string

class ComponentADecorator implements Component
{
public function __construct(private Component $component)
{
public function __construct(
private Component $component
) {
}

public function execute(): string
Expand Down
6 changes: 4 additions & 2 deletions dependencyInjection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

class Client
{
public function __construct(private ServiceA $serviceA, private ServiceB $serviceB)
{
public function __construct(
private ServiceA $serviceA,
private ServiceB $serviceB
) {
}

public function execute(): string
Expand Down
6 changes: 4 additions & 2 deletions facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ public function process(): string

class Facade
{
public function __construct(private InterfaceA $interfaceA, private InterfaceB $interfaceB)
{
public function __construct(
private InterfaceA $interfaceA,
private InterfaceB $interfaceB
) {
}

public function execute(): string
Expand Down
6 changes: 4 additions & 2 deletions mediator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public function execute(): string

class MediatorImplementation implements Mediator
{
public function __construct(private ComponentA $componentA, private ComponentB $componentB)
{
public function __construct(
private ComponentA $componentA,
private ComponentB $componentB
) {
$this->componentA->setMediator($this);
$this->componentB->setMediator($this);
}
Expand Down
6 changes: 4 additions & 2 deletions mockObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ public function write(string $message): void

class ActionClientUseCase
{
public function __construct(private Service $service, private Logger $logger)
{
public function __construct(
private Service $service,
private Logger $logger
) {
}

public function execute(): string
Expand Down
5 changes: 3 additions & 2 deletions proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public function execute(): string

class Proxy implements Service
{
public function __construct(private ServiceImplementation $serviceImplementation)
{
public function __construct(
private ServiceImplementation $serviceImplementation
) {
}

public function execute(): string
Expand Down
5 changes: 3 additions & 2 deletions strategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ public function process(int $x, int $y): int

class Context
{
public function __construct(private Strategy $strategy)
{
public function __construct(
private Strategy $strategy
) {
}

public function execute(int $x, int $y): int
Expand Down

0 comments on commit f471555

Please sign in to comment.