1
0
mirror of https://github.com/jupeter/clean-code-php.git synced 2025-09-25 21:49:04 +02:00

rename rectangleAreaVerifier to areaVerifier

This commit is contained in:
Peter Gribanov
2017-09-04 20:32:02 +03:00
committed by GitHub
parent eff33c5dfd
commit cb933d10a5

View File

@@ -1181,7 +1181,7 @@ class Square extends Rectangle
} }
} }
function rectangleAreaVerifier(Rectangle $rectangle) function areaVerifier(Rectangle $rectangle)
{ {
$rectangle->setWidth(4); $rectangle->setWidth(4);
$rectangle->setHeight(5); $rectangle->setHeight(5);
@@ -1193,7 +1193,7 @@ function rectangleAreaVerifier(Rectangle $rectangle)
$rectangles = [new Rectangle(), new Square()]; $rectangles = [new Rectangle(), new Square()];
foreach ($rectangles as $rectangle) { foreach ($rectangles as $rectangle) {
if (!rectangleAreaVerifier($rectangle)) {    if (!areaVerifier($rectangle)) {
throw new Exception('Bad area!'); throw new Exception('Bad area!');
} }
} }
@@ -1258,20 +1258,16 @@ function squareAreaVerifier(Square $square)
return $square->area() == 25; return $square->area() == 25;
} }
$rectangles = [new Rectangle()]; $rectangle = new Rectangle();
foreach ($rectangles as $rectangle) { if (!rectangleAreaVerifier($rectangle)) {
if (!rectangleAreaVerifier($rectangle)) {
throw new Exception('Bad area!'); throw new Exception('Bad area!');
}
} }
$squares = [new Square()]; $square = new Square();
foreach ($squares as $square) { if (!squareAreaVerifier($square)) {
if (!squareAreaVerifier($square)) {
throw new Exception('Bad area!'); throw new Exception('Bad area!');
}
} }
``` ```