Installer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 5
dl 0
loc 5
rs 10
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
0 ignored issues
show
Bug introduced by
The type Composer\IO\IOInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
     * @param Composer        $composer
0 ignored issues
show
Bug introduced by
The type Composer\Composer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
43
     * @param string          $type
44
     * @param Filesystem      $filesystem
0 ignored issues
show
Bug introduced by
The type Composer\Util\Filesystem was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
45
     * @param BinaryInstaller $binaryInstaller
0 ignored issues
show
Bug introduced by
The type Composer\Installer\BinaryInstaller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
The property vendorDir does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
51
        $this->type = self::TWIG_BUNDLE_PACKAGE_TYPE;
0 ignored issues
show
Bug Best Practice introduced by
The property type does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
52
    }
53
54
    /**
55
     * @inheritdoc
56
     */
57
    public function supports($packageType)
58
    {
59
        return $packageType === self::TWIG_BUNDLE_PACKAGE_TYPE;
60
    }
61
}
62