Skip to content

Commit 1c4397c

Browse files
committed
add division diagram description to README.
1 parent c984b61 commit 1c4397c

File tree

9 files changed

+19
-5
lines changed

9 files changed

+19
-5
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM php:8.1-cli
22

3-
RUN apt-get update && apt-get install -y zip git plantuml && apt-get clean && rm -rf /var/lib/apt/lists/*
3+
RUN apt-get update && apt-get install -y zip git plantuml fonts-noto-cjk && apt-get clean && rm -rf /var/lib/apt/lists/*
44

55
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ If it finds packages that depend on each other, it will warn you with a thick re
208208
![PlantUML output image.](output-package.png)
209209
210210
211+
### Division Diagram
212+
213+
If you are using the Enum added in PHP8.1, you can output the division chart.
214+
Visualizing the divisions used in the program can be useful for research and design.
215+
216+
![PlantUML output image.](output-division.png)
217+
211218
## Development
212219
213220
### Open shell

dogfood-model.png

11.3 KB
Loading

dogfood-package.png

3.57 KB
Loading

dogfood.png

34.3 KB
Loading

output-division.png

24.4 KB
Loading

src/DiagramElement/Entry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function dumpDivisions($level = 0): array
8585
if (empty($doc)) {
8686
return sprintf('%s %s', $indent, $x->getName());
8787
}
88-
return sprintf("%s %s\n%s <b>%s</b>", $indent, $x->getName(), $indent, $doc);
88+
return sprintf("%s %s\r\n%s <b>%s</b>", $indent, $x->getName(), $indent, $doc);
8989
}, $cases));
9090
$lines[] = sprintf('%s]', $indent);
9191
}

test/fixtures/enum/Sub/Status.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ enum MyExceptionCase {
1818

1919
enum Size
2020
{
21+
public static function getSmallest(): self
22+
{
23+
return self::Small;
24+
}
2125
case Small;
2226
case Medium;
2327
case Large;

update-dogfood-images.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ SCRIPT_DIR=$(cd $(dirname $0); pwd)
66
$SCRIPT_DIR/bin/php-class-diagram \
77
--enable-class-properties \
88
--enable-class-methods $SCRIPT_DIR/src \
9-
| plantuml -pipe -tpng > $SCRIPT_DIR/dogfood.png
9+
| plantuml -charset utf-8 -pipe -tpng > $SCRIPT_DIR/dogfood.png
1010
$SCRIPT_DIR/bin/php-class-diagram \
1111
--disable-class-properties \
1212
--disable-class-methods $SCRIPT_DIR/src \
13-
| plantuml -pipe -tpng > $SCRIPT_DIR/dogfood-model.png
13+
| plantuml -charset utf-8 -pipe -tpng > $SCRIPT_DIR/dogfood-model.png
1414
$SCRIPT_DIR/bin/php-class-diagram \
1515
--package-diagram $SCRIPT_DIR/src \
16-
| plantuml -pipe -tpng > $SCRIPT_DIR/dogfood-package.png
16+
| plantuml -charset utf-8 -pipe -tpng > $SCRIPT_DIR/dogfood-package.png
17+
$SCRIPT_DIR/bin/php-class-diagram \
18+
--division-diagram $SCRIPT_DIR/test/fixtures/enum \
19+
| plantuml -charset utf-8 -pipe -tpng > $SCRIPT_DIR/output-division.png

0 commit comments

Comments
 (0)