Get the stub for a ServiceProvider.

@param  \Fly\Workbench\Package  $package
@param  bool    $plain
@return string
768342
protected function getProviderStub(Package $package, $plain)
	{
		return $this->formatPackageStub($package, $this->getProviderFile($plain));
	}
1206147
protected function extractName(PackageInterface $package)
    {
        $extraData = $package->getExtra();

        if (!array_key_exists('ladybug_name', $extraData)) {
            throw new \InvalidArgumentException(
                'Unable to install theme/plugin, ladybug addons must '
                    .'include the name in the extra field of composer.json'
            );
        }

        return $extraData['ladybug_name'];
    }
595585
protected function getNativePackage($vendor, $package)
    {
        $packages = $this->compileOptions->getPackages();
        $vendorPackage = "{$vendor}:{$package}";

        if (isset($packages[$vendorPackage])) {
            return $packages[$vendorPackage];
        }

        if (isset($packages[$vendor])) {
            return $packages[$vendor];
        }

        return null;
    }
1105723
public function getInstallPath(PackageInterface $package)
	{
		$prefix = mb_substr($package->getPrettyName(), 0, 23);
		if ('myadmin/template-' !== $prefix) {
			throw new \InvalidArgumentException(
				'Unable to install template, myadmin templates '
				.'should always start their package name with '
				.'"myadmin/template-"'
			);
		}
		return 'data/templates/'.mb_substr($package->getPrettyName(), 23);
	}
79497
public function getDestinationPath($package)
    {
        $packages = $this->config->getPackages();

        $namespace = isset($packages[$package]) ? $packages[$package] : null;

        if (is_null($namespace)) {
            throw new \InvalidArgumentException("Configuration not found.");
        }

        return $this->publishPath .str_replace('/', DS, "/Packages/{$namespace}");
    }
41632
public function specials($package, Version $version)
    {
        $specials = $this->searchProvides($package);
        if ($specials) {
            $this->providesJsonDetected = true;
        } else {
            $this->providesJsonDetected = false;
            $specials = $this->searchReflect($package, $version);
        }
        if (count($specials['providers']) === 0 && count($specials['aliases']) === 0) {
            return false;
        }
        return $specials;
    }
213916
private function installPath($package) {
    if (isset($this->paths['package'][$package['package']]['path'])){

      return $this->paths['package'][$package['package']]['path'];
    } elseif (isset($this->paths['vendor'][$package['vendor']]['path'])){

      return $this->paths['vendor'][$package['vendor']]['path'];
    } elseif (isset($this->paths['type'][$package['type']]['path'])){

      return $this->paths['type'][$package['type']]['path'];
    } else {
      return false;
    }
  }
972622
protected static function getVersionForPackage(string $package): string
    {
        try {
            $shortVersion = PrettyVersions::getVersion($package)
                ->getShortVersion()
            ;

            // Removes the ".x-dev" part which is inserted during development
            if ('.x-dev' === \mb_substr($shortVersion, -6)) {
                $shortVersion = \mb_substr($shortVersion, 0, -6).'-dev';
            }

            return $shortVersion;
        } catch (\OutOfBoundsException $exception) {
            return '0.0.0-alpha';
        }
    }
1235836
private function loadPackageRuleSet(Package $package)
    {
        $ruleSet = new RuleSet();
        $key = $package->generatePackageKey();

        if ($this->cache->has($key)) {
            $ruleSet = $this->cache->getCachedRuleSet($key);
        } elseif (is_dir($path = $package->getPackagePath(self::PACKAGE_PATH))) {
            $ruleSet = $this->traverser->traverse($path);
            $this->cache->cacheRuleSet($key, $ruleSet);
        } else {
            // there is no vendor package in the given path
        }

        return $ruleSet;
    }
1211591
protected function require(string $package): InstallerContract
    {
        $this->task(
            'Require package via composer',
            function () use ($package) {
                return $this->composer->require($package);
            }
        );

        return $this;
    }
879664
public static function view($package)
    {
        $settings = static::get($package);

        if ($settings and array_key_exists('view', $settings)) {
            return view($settings['view']);
        }

        return '';
    }
742359
protected function getSourceStandards(PackageInterface $package)
    {
        $basePath = $this->getInstallPath($package);

        return $this->findStandards($basePath);
    }
227227
protected function checkGitignore($package)
    {
        $gitFolder = getcwd() . DS . '.git' . DS;

        if (!file_exists($gitFolder)) {
            return;
        }

        $gitignoreFile = getcwd() . DS . '.gitignore';
        $required = [
            '/.vagrant/',
            '/puphpet/files/dot/',
            '/puphpet/puppet/',
            '/puphpet/ruby/',
            '/puphpet/shell/',
            '/puphpet/vagrant/',
            '/puphpet/config-custom.yaml',
            '/Vagrantfile',
        ];

        touch($gitignoreFile);
        $lines = file($gitignoreFile, FILE_IGNORE_NEW_LINES);

        foreach ($required as $entry) {
            if (!in_array($entry, $lines, true)) {
                $lines[] = $entry;
            }
        }

        file_put_contents($gitignoreFile, implode(PHP_EOL, $lines) . PHP_EOL);
    }
427181
public static function getInstalledVersion($package)
    {
        $composer = ComposerInformation::getLock();

        $data = ArrayHelper::query($composer['packages'], ['name' => $package]);

        if (isset($data[0]['version'])) {
            return $data[0]['version'];
        }

        return null;
    }
420149
public function getInstallPath(PackageInterface $package)
    {
        $prettyName = $package->getPrettyName();
        DebugPrinter::log(
            'Getting install path for `%s` package',
            array($prettyName,)
        );
        if (isset($this->installDirCache[$prettyName])) {
            return $this->installDirCache[$prettyName];
        }
        $installDir = null;
        if ($this->composer->getPackage()) {
            $rootExtra = $this->composer->getPackage()->getExtra();
            if (!empty($rootExtra['opencart-install-dir'])) {
                $installDir = $rootExtra['opencart-install-dir'];
            }
        }
        if (!$installDir) {
            $extra = $package->getExtra();
            if (!empty($extra['opencart-install-dir'])) {
                $installDir = $extra['opencart-install-dir'];
            }
        }
        if (is_array($installDir)) {
            if (isset($installDir[$prettyName])) {
                $this->installDirCache[$prettyName] = $installDir[$prettyName];
                return $installDir[$prettyName];
            }
            $this->installDirCache[$prettyName] = $this->defaultInstallDir;
            return $this->defaultInstallDir;
        }
        $installDir = $installDir ? $installDir : $this->defaultInstallDir;
        DebugPrinter::log(
            'Computed install dir for package `%s`: `%s`',
            array($prettyName, $installDir,)
        );
        $this->installDirCache[$prettyName] = $installDir;
        return $installDir;
    }
313000
protected function getDownloadUrl(array $package): string
    {
        $downloadUrl = parent::getDownloadUrl($package);

        $downloadUrl = str_replace('releases/download', 'raw', $downloadUrl);

        return $downloadUrl.'/builds/'.basename(Phar::running());
    }
153437
protected function iterateDependencies(Package $package, $dev = false)
    {
        $deps = $dev ? $package->getDevRequires() : $package->getRequires();
        foreach (array_keys($deps) as $target) {
            if (isset($this->plainList[$target]) && empty($this->orderedList[$target])) {
                $this->iteratePackage($this->plainList[$target]);
            }
        }
    }