PluginProbe
Presto Player / 4.2.3
Presto Player v4.2.3
4.5.0 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 All 126 releases
presto-player / vendor / typisttech / imposter-plugin / src / Transformer.php
Transformer.php
54 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace TypistTech\Imposter\Plugin;
6
7 use Composer\IO\IOInterface;
8 use TypistTech\Imposter\ImposterFactory;
9
10 class Transformer
11 {
12 public static function run(IOInterface $io): void
13 {
14 // Print an empty line to separate imposter outputs.
15 $io->write('', true);
16 $io->write('', true);
17 $io->write('<info>Running Imposter...</info>', true);
18 $io->write('<info>======================</info>', true);
19 $io->write('Loading package information from <comment>' . getcwd() . '/composer.json</comment>', true);
20
21 $imposter = ImposterFactory::forProject(getcwd(), ['typisttech/imposter-plugin']);
22
23 $autoloads = $imposter->getAutoloads();
24 $count = count($autoloads);
25 $index = 1;
26 foreach ($autoloads as $autoload) {
27 $io->write(" - <comment>$index/$count</comment>: Transforming $autoload", true);
28 $imposter->transform($autoload);
29 $index++;
30 }
31
32 $io->write('<info>Success: Imposter transformed vendor files.</info>', true);
33
34 $invalidAutoloads = $imposter->getInvalidAutoloads();
35 if (! empty($invalidAutoloads)) {
36 $invalidAutoloadsCount = count($invalidAutoloads);
37 $io->writeError('', true);
38 $io->writeError(
39 // phpcs:ignore Generic.Files.LineLength.TooLong
40 "<warning>Warning: Imposter failed to transformed $invalidAutoloadsCount of the autoload path(s).</warning>",
41 true
42 );
43
44 foreach ($invalidAutoloads as $invalidAutoload) {
45 $io->writeError(" - $invalidAutoload", true);
46 }
47 }
48
49 // Print empty lines to separate imposter outputs.
50 $io->write('', true);
51 $io->write('', true);
52 }
53 }
54