# code-snippets/trunk/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php

Code Snippets, version trunk. 34 lines.

- Page: https://pluginprobe.com/plugins/code-snippets/trunk/code/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php
- Raw: https://pluginprobe.com/plugins/code-snippets/trunk/raw/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php
- Modified: 2025-02-14T05:52:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-snippets/trunk/code/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php#L10-L20`.

```php
<?php

namespace Composer\Installers;

use Composer\Package\PackageInterface;

class SilverStripeInstaller extends BaseInstaller
{
    /** @var array<string, string> */
    protected $locations = array(
        'module' => '{$name}/',
        'theme'  => 'themes/{$name}/',
    );

    /**
     * Return the install path based on package type.
     *
     * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
     * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
     */
    public function getInstallPath(PackageInterface $package, string $frameworkType = ''): string
    {
        if (
            $package->getName() == 'silverstripe/framework'
            && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
            && version_compare($package->getVersion(), '2.999.999') < 0
        ) {
            return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
        }

        return parent::getInstallPath($package, $frameworkType);
    }
}

```
