Total Complexity | 10 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
5 | class CopyPhpstormMeta |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | private $pathToProjectRoot; |
||
11 | |||
12 | |||
13 | public function run(): void |
||
24 | } |
||
25 | } |
||
26 | |||
27 | private function getTargetDir() |
||
28 | { |
||
29 | if (null === $this->pathToProjectRoot) { |
||
30 | throw new \RuntimeException('You must set the project root path before running this process'); |
||
31 | } |
||
32 | $targetDir = $this->pathToProjectRoot . '/.phpstorm.meta.php'; |
||
33 | if (!is_dir($targetDir) && mkdir($targetDir, 0777, true) && !is_dir($targetDir)) { |
||
34 | throw new \RuntimeException('Failed making targetDir ' . $targetDir); |
||
35 | } |
||
36 | |||
37 | return realpath($targetDir); |
||
38 | } |
||
39 | |||
40 | private function getSourceFiles(): array |
||
41 | { |
||
42 | return glob(__DIR__ . '/../../../.phpstorm.meta.php/*.php'); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param string $pathToProjectRoot |
||
47 | * |
||
48 | * @return self |
||
49 | */ |
||
50 | public function setPathToProjectRoot(string $pathToProjectRoot): self |
||
55 | } |
||
56 | } |
||
57 |