Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Manager
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 getInstallPath
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 supports
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * The installer manager class file.
4 *
5 * @package automattic/jetpack-composer-plugin
6 */
7
8namespace Automattic\Jetpack\Composer;
9
10use Composer\Installer\LibraryInstaller;
11use Composer\Package\PackageInterface;
12
13/**
14 * The manager class that is the main agent for the installer plugin.
15 * It handles the installation process by accepting the installed package
16 * and modifying its installation path.
17 * */
18class Manager extends LibraryInstaller {
19
20    /**
21     * Receives a supported package instance and modifies its installation path.
22     *
23     * @param PackageInterface $package the installed package object.
24     * @return string modified installation path.
25     */
26    public function getInstallPath( PackageInterface $package ) {
27        return 'jetpack_vendor/' . $package->getPrettyName();
28    }
29
30    /**
31     * Declares the supported package type by returning true whenever it meets a package
32     * that declares itself as a Jetpack library.
33     *
34     * @param string $package_type a package type string.
35     * @return boolean whether the package is supported.
36     */
37    public function supports( $package_type ) {
38        return 'jetpack-library' === $package_type;
39    }
40}