1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace App; |
||
6 | |||
7 | use Composer\Script\Event; |
||
8 | use FilesystemIterator as FSIterator; |
||
9 | use RecursiveDirectoryIterator as DirIterator; |
||
10 | use RecursiveIteratorIterator as RIterator; |
||
11 | |||
12 | final class Installer |
||
13 | { |
||
14 | /** |
||
15 | * @psalm-suppress UndefinedClass |
||
16 | */ |
||
17 | public static function postUpdate(Event $event = null): void |
||
0 ignored issues
–
show
|
|||
18 | { |
||
19 | self::chmodRecursive('runtime', 0777); |
||
20 | self::chmodRecursive('public/assets', 0777); |
||
21 | } |
||
22 | |||
23 | private static function chmodRecursive(string $path, int $mode): void |
||
24 | { |
||
25 | chmod($path, $mode); |
||
26 | |||
27 | /** @var iterable<string, string> $iterator */ |
||
28 | $iterator = new RIterator( |
||
29 | new DirIterator($path, FSIterator::SKIP_DOTS | FSIterator::CURRENT_AS_PATHNAME), |
||
30 | RIterator::SELF_FIRST |
||
31 | ); |
||
32 | |||
33 | foreach ($iterator as $item) { |
||
34 | chmod($item, $mode); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | public static function copyEnvFile(): void |
||
39 | { |
||
40 | if (!file_exists('.env')) { |
||
41 | copy('.env.example', '.env'); |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.