Skip to content

Commit 536b136

Browse files
committed
refactor: Rename options
1 parent be18fab commit 536b136

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

bin/php-class-diagram

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ $options = getopt('hv', [
3737
'header::',
3838
'include::',
3939
'exclude::',
40-
'from::',
41-
'to::',
42-
'depth::',
40+
'rel-target-from::',
41+
'rel-target-to::',
42+
'rel-target-depth::',
4343
], $rest_index);
4444
$arguments = array_slice($argv, $rest_index);
4545

@@ -68,9 +68,9 @@ OPTIONS
6868
--header='header string' additional header string. You can specify multiple header values.
6969
--include='wildcard' include target file pattern. (default: `*.php`) You can specify multiple include patterns.
7070
--exclude='wildcard' exclude target file pattern. You can specify multiple exclude patterns.
71-
--from='class1,class2,...' comma separated list of classes to filter dependencies from
72-
--to='class1,class2,...' comma separated list of classes to filter dependencies to
73-
--depth=integer max depth of dependencies to show when using --from or --to filters
71+
--rel-target-from='clases' comma separated list of classes to filter dependencies from
72+
--rel-target-to='classes' comma separated list of classes to filter dependencies to
73+
--rel-target-depth=integer max depth of dependencies to show when using --from or --to filters
7474
EOS;
7575

7676
if (isset($options['v']) || isset($options['version'])) {

src/Config/Options.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,27 +172,27 @@ public function hidePrivateMethods(): bool
172172
*/
173173
public function fromClass(): array
174174
{
175-
if (!isset($this->opt['from'])) {
175+
if (!isset($this->opt['rel-target-from'])) {
176176
return [];
177177
}
178178

179-
return explode(',', $this->opt['from']);
179+
return explode(',', $this->opt['rel-target-from']);
180180
}
181181

182182
/**
183183
* @return array<string>
184184
*/
185185
public function toClass(): array
186186
{
187-
if (!isset($this->opt['to'])) {
187+
if (!isset($this->opt['rel-target-to'])) {
188188
return [];
189189
}
190190

191-
return explode(',', $this->opt['to']);
191+
return explode(',', $this->opt['rel-target-to']);
192192
}
193193

194194
public function depth(): int
195195
{
196-
return (int) ($this->opt['depth'] ?? PHP_INT_MAX);
196+
return (int) ($this->opt['rel-target-depth'] ?? PHP_INT_MAX);
197197
}
198198
}

test/RelationsFilterTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function setUp(): void
6363
public function testFiltersInboundRelations(): void
6464
{
6565
$relationsFilter = new RelationsFilter(new Options([
66-
'to' => 'PackageNode'
66+
'rel-target-to' => 'PackageNode'
6767
]));
6868

6969
$result = $relationsFilter->filterRelations($this->fixture);
@@ -78,8 +78,8 @@ public function testFiltersInboundRelations(): void
7878
public function testFiltersInboundRelationsWithDepth(): void
7979
{
8080
$relationsFilter = new RelationsFilter(new Options([
81-
'to' => 'PackageNode',
82-
'depth' => 1
81+
'rel-target-to' => 'PackageNode',
82+
'rel-target-depth' => 1
8383
]));
8484

8585
$result = $relationsFilter->filterRelations($this->fixture);
@@ -93,7 +93,7 @@ public function testFiltersInboundRelationsWithDepth(): void
9393
public function testFiltersOutboundRelations(): void
9494
{
9595
$relationsFilter = new RelationsFilter(new Options([
96-
'from' => 'Package'
96+
'rel-target-from' => 'Package'
9797
]));
9898

9999
$result = $relationsFilter->filterRelations($this->fixture);
@@ -112,8 +112,8 @@ public function testFiltersOutboundRelations(): void
112112
public function testFiltersOutboundRelationsWithDepth(): void
113113
{
114114
$relationsFilter = new RelationsFilter(new Options([
115-
'from' => 'Package',
116-
'depth' => 1
115+
'rel-target-from' => 'Package',
116+
'rel-target-depth' => 1
117117
]));
118118

119119
$result = $relationsFilter->filterRelations($this->fixture);
@@ -128,7 +128,7 @@ public function testFiltersOutboundRelationsWithDepth(): void
128128
public function testGeneratesRemoveUnlinkedDirective(): void
129129
{
130130
$relationsFilter = new RelationsFilter(new Options([
131-
'from' => 'Package'
131+
'rel-target-from' => 'Package'
132132
]));
133133

134134
$relationsFilter->filterRelations($this->fixture);

0 commit comments

Comments
 (0)