diff --git a/complicated_functions/nested.php b/complicated_functions/nested.php
index 67ed664..a96fe1a 100644
--- a/complicated_functions/nested.php
+++ b/complicated_functions/nested.php
@@ -2,7 +2,8 @@
function father($a)
{
echo $a, "
";
- function child($b) {
+ function child($b)
+ {
echo $b + 1, "
";
return $b * $b;
}
diff --git a/complicated_functions/array_walk_args.php b/complicated_functions/walk_args.php
similarity index 100%
rename from complicated_functions/array_walk_args.php
rename to complicated_functions/walk_args.php
diff --git a/complicated_functions/array_walk_recursive.php b/complicated_functions/walk_recursive.php
similarity index 100%
rename from complicated_functions/array_walk_recursive.php
rename to complicated_functions/walk_recursive.php
diff --git a/generators/array.php b/generators/array.php
index 5d373c0..870eac2 100644
--- a/generators/array.php
+++ b/generators/array.php
@@ -5,4 +5,4 @@ function generator()
yield from [2, 3];
}
-foreach(generator() as $i) echo "$i ";
+foreach (generator() as $i) echo "$i ";
diff --git a/generators/collect.php b/generators/collect.php
index c678436..8eafc1f 100644
--- a/generators/collect.php
+++ b/generators/collect.php
@@ -1,13 +1,13 @@
$e * $e);
-foreach($collect as $val) {
+foreach ($collect as $val) {
echo "$val ";
}
diff --git a/generators/combine.php b/generators/combine.php
index 80c9ff5..2ce05e7 100644
--- a/generators/combine.php
+++ b/generators/combine.php
@@ -1,21 +1,21 @@
$e % 2 == 0);
$collect = collect($select, fn($e) => $e * $e);
-foreach($collect as $val) {
+foreach ($collect as $val) {
echo "$val ";
}
diff --git a/generators/combine_from.php b/generators/combine_from.php
index ddaa276..05bbd5f 100644
--- a/generators/combine_from.php
+++ b/generators/combine_from.php
@@ -5,10 +5,10 @@ function square($value)
}
function even_square($arr) {
- foreach($arr as $value) {
+ foreach ($arr as $value) {
if ($value % 2 == 0) yield from square($value);
}
}
$arr = [1, 2, 3, 4, 5, 6];
-foreach(even_square($arr) as $val) echo "$val ";
+foreach (even_square($arr) as $val) echo "$val ";
diff --git a/generators/keys.php b/generators/keys.php
index ed7baf9..4e6d563 100644
--- a/generators/keys.php
+++ b/generators/keys.php
@@ -1,7 +1,7 @@
$value) {
+ foreach ($arr as $key => $value) {
yield $key => $callback($value);
}
}
@@ -16,6 +16,6 @@ $arr = [
];
$collect = collect($arr, fn($e) => $e * $e);
-foreach($collect as $key => $val) {
+foreach ($collect as $key => $val) {
echo "$val ($key) ";
}
diff --git a/generators/makerange_bad.php b/generators/makerange_bad.php
index f51c4ec..5a1549d 100644
--- a/generators/makerange_bad.php
+++ b/generators/makerange_bad.php
@@ -2,13 +2,13 @@
function crange($size)
{
$arr = [];
- for($i = 0; $i < $size; $i++) {
+ for ($i = 0; $i < $size; $i++) {
$arr[] = $i;
}
return $arr;
}
$range = crange(1_024_000);
-foreach($range as $i) echo "$i ";
+foreach ($range as $i) echo "$i ";
echo '
' . PHP_EOL;
echo memory_get_usage();
diff --git a/generators/makerange_good.php b/generators/makerange_good.php
index 1ee3417..bc8235b 100644
--- a/generators/makerange_good.php
+++ b/generators/makerange_good.php
@@ -1,12 +1,12 @@
' . PHP_EOL;
echo memory_get_usage();
diff --git a/generators/next.php b/generators/next.php
index 0d6251a..3cd2d93 100644
--- a/generators/next.php
+++ b/generators/next.php
@@ -1,7 +1,7 @@
valid()) {
+while ($obj->valid()) {
echo ($obj->current() * $obj->current()) . ' ';
// К следующему элементу
$obj->next();
diff --git a/generators/object.php b/generators/object.php
index fa1a333..1b5c6e0 100644
--- a/generators/object.php
+++ b/generators/object.php
@@ -1,7 +1,7 @@
";
yield $i;
}
diff --git a/generators/reject.php b/generators/reject.php
index 1bca7a4..879ce38 100644
--- a/generators/reject.php
+++ b/generators/reject.php
@@ -1,13 +1,13 @@
$e % 2 == 0);
-foreach($reject as $val) {
+foreach ($reject as $val) {
echo "$val ";
}
diff --git a/generators/select.php b/generators/select.php
index 8a13d42..9d6c063 100644
--- a/generators/select.php
+++ b/generators/select.php
@@ -1,13 +1,13 @@
$e % 2 == 0);
-foreach($select as $val) {
+foreach ($select as $val) {
echo "$val ";
}
diff --git a/generators/send.php b/generators/send.php
index 16054f3..7dafee2 100644
--- a/generators/send.php
+++ b/generators/send.php
@@ -1,7 +1,7 @@
";
yield $i;
}
}
-foreach(simple() as $val) {
+foreach (simple() as $val) {
echo 'квадрат = ' . ($val * $val) . '
';
if ($val >= 5) break;
}
diff --git a/methods/minmax.php b/methods/minmax.php
index 1925741..c8cf379 100644
--- a/methods/minmax.php
+++ b/methods/minmax.php
@@ -3,7 +3,7 @@ class MinMax
{
public function __call(string $method, array $arr)
{
- switch($method) {
+ switch ($method) {
case 'min':
return $this->min($arr);
case 'max':
@@ -17,7 +17,7 @@ class MinMax
{
$result = $arr[0];
- foreach($arr as $value) {
+ foreach ($arr as $value) {
if ($value < $result) {
$result = $value;
}
@@ -30,7 +30,7 @@ class MinMax
{
$result = $arr[0];
- foreach($arr as $value) {
+ foreach ($arr as $value) {
if ($value > $result) {
$result = $value;
}
diff --git a/methods/minmax_alter.php b/methods/minmax_alter.php
index d35e6c6..3ab7983 100644
--- a/methods/minmax_alter.php
+++ b/methods/minmax_alter.php
@@ -3,7 +3,7 @@ class MinMax
{
public function __call(string $method, array $arr)
{
- switch($method) {
+ switch ($method) {
case 'min':
return min($arr);
case 'max':
diff --git a/methods/rainbow.php b/methods/rainbow.php
index 01905f3..1dd1713 100644
--- a/methods/rainbow.php
+++ b/methods/rainbow.php
@@ -1,5 +1,6 @@
'красный',
'orange' => 'оранжевый',
@@ -12,7 +13,7 @@ class Rainbow {
public function __get(string $key) : ?string
{
- if(array_key_exists($key, Rainbow::COLORS)) {
+ if (array_key_exists($key, Rainbow::COLORS)) {
return Rainbow::COLORS[$key];
} else {
return null;
diff --git a/methods/greeting_say_param.php b/methods/say_param.php
similarity index 100%
rename from methods/greeting_say_param.php
rename to methods/say_param.php
diff --git a/methods/settings.php b/methods/settings.php
index b880777..821d216 100644
--- a/methods/settings.php
+++ b/methods/settings.php
@@ -1,10 +1,11 @@
properties)) {
+ if (array_key_exists($key, $this->properties)) {
return $this->properties[$key];
} else {
return null;
diff --git a/methods/algorithm_static_distances.php b/methods/static_distances.php
similarity index 100%
rename from methods/algorithm_static_distances.php
rename to methods/static_distances.php