| 1 | <?php |
||
| 27 | final class InstallFiles implements ActionInterface, VarAwareInterface |
||
| 28 | { |
||
| 29 | use VarAwareTrait, |
||
| 30 | FilesystemAwareTrait; |
||
| 31 | |||
| 32 | 2 | public function execute() |
|
| 33 | { |
||
| 34 | try { |
||
| 35 | /** @var Finder $finder */ |
||
| 36 | 2 | $finder = Finder::create() |
|
| 37 | 2 | ->files() |
|
| 38 | 2 | ->in($this->vars['skeleton']) |
|
| 39 | 2 | ->ignoreDotFiles(false); |
|
| 40 | |||
| 41 | 2 | foreach ($finder as $file) { |
|
| 42 | 2 | $target = str_replace( |
|
| 43 | 2 | $this->vars['skeleton'], |
|
| 44 | 2 | $this->vars['root'], |
|
| 45 | 2 | $file->getRealPath() |
|
| 46 | ); |
||
| 47 | 2 | $this->fs->rename( |
|
| 48 | 2 | $file->getRealPath(), |
|
| 49 | 2 | (string)StaticStringy::removeRight($target, '.skltn'), |
|
| 50 | 2 | true |
|
| 51 | ); |
||
| 52 | } |
||
| 53 | } catch (\Exception $e) { |
||
| 54 | throw new \RuntimeException($e->getMessage(), $e->getCode(), $e); |
||
| 55 | } |
||
| 56 | 2 | } |
|
| 57 | |||
| 58 | /** |
||
| 59 | * {@inheritdoc} |
||
| 60 | */ |
||
| 61 | 4 | public function getPriority(): int |
|
| 65 | } |
||
| 66 |