Skip to content

Commit b745ea5

Browse files
committed
reformat code
1 parent 0419457 commit b745ea5

12 files changed

+128
-125
lines changed

src/Command/MakeDecisionCommand.php

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

33
namespace ADR\Command;
44

5+
use ADR\Domain\DecisionContent;
6+
use ADR\Domain\DecisionRecord;
7+
use ADR\Domain\Sequence;
58
use ADR\Filesystem\Config;
9+
use ADR\Filesystem\Workspace;
610
use Symfony\Component\Console\Command\Command;
711
use Symfony\Component\Console\Input\InputArgument;
812
use Symfony\Component\Console\Input\InputInterface;
9-
use Symfony\Component\Console\Output\OutputInterface;
1013
use Symfony\Component\Console\Input\InputOption;
11-
use ADR\Filesystem\Workspace;
12-
use ADR\Domain\Sequence;
13-
use ADR\Domain\DecisionRecord;
14-
use ADR\Domain\DecisionContent;
14+
use Symfony\Component\Console\Output\OutputInterface;
1515

1616
/**
1717
* Command to make ADRs

src/Command/WorkspaceCountCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
namespace ADR\Command;
44

55
use ADR\Filesystem\Config;
6+
use ADR\Filesystem\Workspace;
67
use Symfony\Component\Console\Command\Command;
7-
use Symfony\Component\Console\Input\InputOption;
88
use Symfony\Component\Console\Input\InputInterface;
9+
use Symfony\Component\Console\Input\InputOption;
910
use Symfony\Component\Console\Output\OutputInterface;
1011
use Symfony\Component\Console\Style\SymfonyStyle;
11-
use ADR\Filesystem\Workspace;
1212

1313
/**
1414
* Command to count ADRs in workspace
15-
*
15+
*
1616
* @author José Carlos <josecarlos@globtec.com.br>
1717
*/
1818
class WorkspaceCountCommand extends Command
@@ -34,11 +34,11 @@ protected function configure()
3434
'adr.yml'
3535
);
3636
}
37-
37+
3838
/**
3939
* Execute the command
4040
*
41-
* @param InputInterface $input
41+
* @param InputInterface $input
4242
* @param OutputInterface $output
4343
*/
4444
protected function execute(InputInterface $input, OutputInterface $output)

src/Command/WorkspaceListCommand.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
namespace ADR\Command;
44

55
use ADR\Filesystem\Config;
6+
use ADR\Filesystem\Workspace;
67
use Symfony\Component\Console\Command\Command;
7-
use Symfony\Component\Console\Input\InputOption;
88
use Symfony\Component\Console\Input\InputInterface;
9+
use Symfony\Component\Console\Input\InputOption;
910
use Symfony\Component\Console\Output\OutputInterface;
1011
use Symfony\Component\Console\Style\SymfonyStyle;
11-
use ADR\Filesystem\Workspace;
1212

1313
/**
1414
* Command to list ADRs in workspace
15-
*
15+
*
1616
* @author José Carlos <josecarlos@globtec.com.br>
1717
*/
1818
class WorkspaceListCommand extends Command
@@ -34,29 +34,31 @@ protected function configure()
3434
'adr.yml'
3535
);
3636
}
37-
37+
3838
/**
3939
* Execute the command
4040
*
41-
* @param InputInterface $input
41+
* @param InputInterface $input
4242
* @param OutputInterface $output
4343
*/
4444
protected function execute(InputInterface $input, OutputInterface $output)
4545
{
4646
$config = new Config($input->getOption('config'));
4747
$workspace = new Workspace($config->directory());
48-
48+
4949
$records = $workspace->records();
50-
50+
5151
asort($records);
52-
52+
5353
if (empty($records)) {
5454
$output->writeln('<info>Workspace is empty</info>');
5555
} else {
5656
$style = new SymfonyStyle($input, $output);
5757
$style->table(
58-
['Filename'],
59-
array_map(function ($record) { return [$record]; }, $records)
58+
['Filename'],
59+
array_map(function ($record) {
60+
return [$record];
61+
}, $records)
6062
);
6163
}
6264
}

src/Domain/DecisionContent.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* Represents value object of the architecture decision
9-
*
9+
*
1010
* @author José Carlos <josecarlos@globtec.com.br>
1111
*/
1212
class DecisionContent
@@ -15,52 +15,52 @@ class DecisionContent
1515
* @var integer
1616
*/
1717
const TITLE_MAX_LENGTH = 100;
18-
18+
1919
/**
2020
* If the project stakeholders haven't agreed with it yet
21-
*
21+
*
2222
* @var string
2323
*/
2424
const STATUS_PROPOSED = 'Proposed';
25-
25+
2626
/**
2727
* Once it is agreed
28-
*
28+
*
2929
* @var string
3030
*/
3131
const STATUS_ACCEPTED = 'Accepted';
32-
32+
3333
/**
3434
* If a later ADR changes or reverses a decision to declined
35-
*
35+
*
3636
* @var string
3737
*/
3838
const STATUS_REJECTED = 'Rejected';
39-
39+
4040
/**
4141
* If a later ADR changes or reverses a decision to deprecated
42-
*
42+
*
4343
* @var string
4444
*/
4545
const STATUS_DEPRECATED = 'Deprecated';
46-
46+
4747
/**
4848
* @var int
4949
*/
5050
private $id;
51-
51+
5252
/**
5353
* @var string
5454
*/
5555
private $title;
56-
56+
5757
/**
5858
* @var string
5959
*/
6060
private $status;
61-
61+
6262
/**
63-
* @param int $id
63+
* @param int $id
6464
* @param string $title
6565
* @param string $status
6666
*
@@ -69,41 +69,41 @@ class DecisionContent
6969
public function __construct(int $id, string $title, string $status = self::STATUS_ACCEPTED)
7070
{
7171
$this->id = $id;
72-
72+
7373
$this->setTitle($title);
7474
$this->setStatus($status);
7575
}
76-
76+
7777
/**
7878
* Returns the number of the ADR
79-
*
79+
*
8080
* @return int ID value
8181
*/
8282
public function getId(): int
8383
{
8484
return $this->id;
8585
}
86-
86+
8787
/**
8888
* Returns the title
89-
*
89+
*
9090
* @return string The title
9191
*/
9292
public function getTitle(): string
9393
{
9494
return $this->title;
9595
}
96-
96+
9797
/**
9898
* Returns the status
99-
*
99+
*
100100
* @return string The status
101101
*/
102102
public function getStatus(): string
103103
{
104104
return $this->status;
105105
}
106-
106+
107107
/**
108108
* Set title
109109
*
@@ -118,16 +118,16 @@ private function setTitle(string $title): void
118118
'The title must be less than or equal to %d characters',
119119
self::TITLE_MAX_LENGTH
120120
);
121-
121+
122122
throw new InvalidArgumentException($message);
123123
}
124-
124+
125125
$this->title = $title;
126126
}
127-
127+
128128
/**
129-
* Set status
130-
*
129+
* Set status
130+
*
131131
* @param string $status Decision status
132132
*
133133
* @throws InvalidArgumentException
@@ -140,27 +140,27 @@ private function setStatus(string $status): void
140140
self::STATUS_REJECTED,
141141
self::STATUS_DEPRECATED,
142142
];
143-
143+
144144
$key = array_search(strtolower($status), array_map('strtolower', $statuses));
145-
145+
146146
if (false === $key) {
147147
$message = sprintf(
148148
'Invalid status "%s". Available status: [%s]',
149149
$status,
150150
implode(', ', $statuses)
151151
);
152-
152+
153153
throw new InvalidArgumentException($message);
154154
}
155-
155+
156156
$this->status = $statuses[$key];
157157
}
158158

159159
/**
160160
* Determines whether the title is greater than maximum length set
161-
*
161+
*
162162
* @param string $title
163-
*
163+
*
164164
* @return bool
165165
*/
166166
private function isGreaterThanTitleMaxLenght(string $title): bool

src/Domain/Sequence.php

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

33
namespace ADR\Domain;
44

5-
use Symfony\Component\Console\Exception\LogicException;
65
use ADR\Filesystem\Workspace;
6+
use Symfony\Component\Console\Exception\LogicException;
77

88
/**
99
* Represents the numbered sequentially and monotonically
10-
*
10+
*
1111
* @author José Carlos <josecarlos@globtec.com.br>
1212
*/
1313
class Sequence
1414
{
1515
/**
1616
* Max value to sequence
17-
*
17+
*
1818
* @var integer
1919
*/
2020
const MAX_VALUE = 9999;
21-
21+
2222
/**
2323
* @var Workspace
2424
*/
2525
private $workspace;
26-
26+
2727
/**
2828
* @param Workspace $workspace
2929
*/
3030
public function __construct(Workspace $workspace)
3131
{
32-
$this->workspace = $workspace;
32+
$this->workspace = $workspace;
3333
}
34-
34+
3535
/**
3636
* Create sequence monotonically, numbers will not be reused
37-
*
37+
*
3838
* @throws LogicException
39-
*
39+
*
4040
* @return int The next value in a sequence
4141
*/
4242
public function next(): int
4343
{
4444
$sequence = $this->workspace->count() + 1;
45-
45+
4646
if ($sequence > self::MAX_VALUE) {
4747
throw new LogicException('Next value exceeds the max value and cannot be used');
4848
}
49-
49+
5050
return $sequence;
5151
}
5252
}

src/Filesystem/Workspace.php

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

33
namespace ADR\Filesystem;
44

5-
use Symfony\Component\Console\Exception\RuntimeException;
65
use ADR\Domain\DecisionRecord;
76
use FilesystemIterator;
87
use SplFileInfo;
8+
use Symfony\Component\Console\Exception\RuntimeException;
99

1010
/**
1111
* Represents the workspace that store the ADRs

0 commit comments

Comments
 (0)