nystudio107 /
twig-bundle-installer
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Twig Bundle Installer |
||
| 4 | * |
||
| 5 | * @link https://nystudio107.com/ |
||
| 6 | * @copyright Copyright (c) 2020 nystudio107 |
||
| 7 | */ |
||
| 8 | |||
| 9 | namespace nystudio107\composer; |
||
| 10 | |||
| 11 | use Composer\Composer; |
||
| 12 | use Composer\Installer\BinaryInstaller; |
||
| 13 | use Composer\Installer\LibraryInstaller as BaseLibraryInstaller; |
||
| 14 | |||
| 15 | use Composer\IO\IOInterface; |
||
| 16 | use Composer\Util\Filesystem; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Class Installer |
||
| 20 | * |
||
| 21 | * Installer is the Composer Installer that handles packages of the type: twig-bundle |
||
| 22 | * |
||
| 23 | * @author nystudio107 |
||
| 24 | * @package bundle-installer |
||
| 25 | * @since 1.0.0 |
||
| 26 | */ |
||
| 27 | class Installer extends BaseLibraryInstaller |
||
| 28 | { |
||
| 29 | // Constants |
||
| 30 | // ========================================================================= |
||
| 31 | |||
| 32 | const TEMPLATES_VENDOR_DIR = './templates/vendor'; |
||
| 33 | const TWIG_BUNDLE_PACKAGE_TYPE = 'twig-bundle'; |
||
| 34 | |||
| 35 | // Public Methods |
||
| 36 | // ========================================================================= |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Initializes library installer. |
||
| 40 | * |
||
| 41 | * @param IOInterface $io |
||
| 42 | * @param Composer $composer |
||
| 43 | * @param string $type |
||
| 44 | * @param Filesystem $filesystem |
||
| 45 | * @param BinaryInstaller $binaryInstaller |
||
| 46 | */ |
||
| 47 | public function __construct(IOInterface $io, Composer $composer, $type = self::TWIG_BUNDLE_PACKAGE_TYPE, Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null) |
||
| 48 | { |
||
| 49 | parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller); |
||
| 50 | $this->vendorDir = rtrim(self::TEMPLATES_VENDOR_DIR, '/'); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 51 | $this->type = self::TWIG_BUNDLE_PACKAGE_TYPE; |
||
|
0 ignored issues
–
show
|
|||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritdoc |
||
| 56 | */ |
||
| 57 | public function supports($packageType) |
||
| 58 | { |
||
| 59 | return $packageType === self::TWIG_BUNDLE_PACKAGE_TYPE; |
||
| 60 | } |
||
| 61 | } |
||
| 62 |