Skip to content

Commit a475e73

Browse files
Added analyze PresenterFactory
1 parent 2a684dd commit a475e73

8 files changed

+42
-70
lines changed

app/Commands/Analyze/AnalyzeCommand.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
use App\Application\Analyze\AnalyzeAction;
77
use App\Application\Analyze\AnalyzeRequest;
88
use App\Application\Analyze\AnalyzePresenter;
9-
use App\Commands\Analyze\GraphPresenterFactory;
10-
use App\Presenter\Analyze\Graph\GraphPresenter;
11-
use App\Commands\Analyze\SummaryPresenterFactory;
12-
use App\Presenter\Analyze\Summary\SummaryPresenter;
139

1410
class AnalyzeCommand extends AbstractCommand
1511
{
@@ -46,18 +42,6 @@ private function makeRequest(): AnalyzeRequest
4642

4743
private function makePresenter(): AnalyzePresenter
4844
{
49-
return $this->option('graph')
50-
? $this->makeGraphPresenter()
51-
: $this->makeSummaryPresenter();
52-
}
53-
54-
private function makeGraphPresenter(): GraphPresenter
55-
{
56-
return app(GraphPresenterFactory::class)->make($this);
57-
}
58-
59-
private function makeSummaryPresenter(): SummaryPresenter
60-
{
61-
return app(SummaryPresenterFactory::class)->make($this);
45+
return app(PresenterFactory::class)->make($this);
6246
}
6347
}

app/Commands/Analyze/ComponentPresenterFactory.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

app/Commands/Analyze/ComponentSettingsFactory.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

app/Commands/Analyze/GraphPresenterFactory.php renamed to app/Commands/Analyze/Graph/GraphPresenterFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace App\Commands\Analyze;
3+
namespace App\Commands\Analyze\Graph;
44

5-
use App\Commands\Analyze\TransformerFactory;
65
use App\Presenter\Analyze\Graph\GraphView;
76
use LaravelZero\Framework\Commands\Command;
8-
use App\Commands\Analyze\GraphSettingsFactory;
7+
use App\Commands\Analyze\TransformerFactory;
98
use App\Presenter\Analyze\Graph\GraphPresenter;
109
use App\Presenter\Analyze\Graph\Ports\GraphMapper;
10+
use App\Commands\Analyze\Graph\GraphSettingsFactory;
1111

1212
class GraphPresenterFactory
1313
{

app/Commands/Analyze/GraphSettingsFactory.php renamed to app/Commands/Analyze/Graph/GraphSettingsFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App\Commands\Analyze;
3+
namespace App\Commands\Analyze\Graph;
44

55
use LaravelZero\Framework\Commands\Command;
66
use App\Presenter\Analyze\Graph\GraphSettings;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace App\Commands\Analyze;
4+
5+
use Illuminate\Console\Command;
6+
use App\Commands\AbstractCommand;
7+
use App\Application\Analyze\AnalyzeAction;
8+
use App\Application\Analyze\AnalyzeRequest;
9+
use App\Application\Analyze\AnalyzePresenter;
10+
use App\Presenter\Analyze\Graph\GraphPresenter;
11+
use App\Presenter\Analyze\Summary\SummaryPresenter;
12+
use App\Commands\Analyze\Graph\GraphPresenterFactory;
13+
use App\Commands\Analyze\Summary\SummaryPresenterFactory;
14+
15+
class PresenterFactory
16+
{
17+
public function make(Command $command): AnalyzePresenter
18+
{
19+
return $command->option('graph')
20+
? $this->makeGraphPresenter($command)
21+
: $this->makeSummaryPresenter($command);
22+
}
23+
24+
private function makeGraphPresenter(Command $command): GraphPresenter
25+
{
26+
return app(GraphPresenterFactory::class)->make($command);
27+
}
28+
29+
private function makeSummaryPresenter(Command $command): SummaryPresenter
30+
{
31+
return app(SummaryPresenterFactory::class)->make($command);
32+
}
33+
}

app/Commands/Analyze/SummaryPresenterFactory.php renamed to app/Commands/Analyze/Summary/SummaryPresenterFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace App\Commands\Analyze;
3+
namespace App\Commands\Analyze\Summary;
44

5-
use App\Commands\Analyze\TransformerFactory;
65
use LaravelZero\Framework\Commands\Command;
6+
use App\Commands\Analyze\TransformerFactory;
77
use App\Presenter\Analyze\Summary\SummaryView;
8-
use App\Commands\Analyze\SummarySettingsFactory;
98
use App\Presenter\Analyze\Summary\SummaryMapper;
109
use App\Presenter\Analyze\Summary\SummaryPresenter;
10+
use App\Commands\Analyze\Summary\SummarySettingsFactory;
1111

1212
class SummaryPresenterFactory
1313
{

app/Commands/Analyze/SummarySettingsFactory.php renamed to app/Commands/Analyze/Summary/SummarySettingsFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App\Commands\Analyze;
3+
namespace App\Commands\Analyze\Summary;
44

55
use LaravelZero\Framework\Commands\Command;
66
use App\Presenter\Analyze\Summary\SummarySettings;

0 commit comments

Comments
 (0)