@param Package $package

@return string
163185
private function version($package)
    {
        $list      = $this->gpm->{'getUpdatable' . ucfirst($package->package_type)}();
        $package   = $list[$package->slug] ?? $package;
        $type      = ucfirst(preg_replace('/s$/', '', $package->package_type));
        $updatable = $this->gpm->{'is' . $type . 'Updatable'}($package->slug);
        $installed = $this->gpm->{'is' . $type . 'Installed'}($package->slug);
        $local     = $this->gpm->{'getInstalled' . $type}($package->slug);

        if (!$installed || !$updatable) {
            $version   = $installed ? $local->version : $package->version;
            return "v<green>{$version}</green>";
        }

        if ($updatable) {
            return "v<red>{$package->version}</red> <cyan>-></cyan> v<green>{$package->available}</green>";
        }

        return '';
    }
108321
public function getDeployInfo($package) {
    $deployInfoFile = $package->getRootDirectory()->getFile('deploy-info.json');

    $deployInfo = new \stdClass;
    if ($deployInfoFile->exists()) {
      $deployInfo = JSONConverter::create()->parseFile($deployInfoFile);
    }

    if (!isset($deployInfo->isStaging)) {
      $deployInfo->isStaging = NULL;
    }

    if (!isset($deployInfo->isDevelopment)) {
      $deployInfo->isDevelopment = NULL;
    }

    if (!isset($deployInfo->isBuilt)) {
      $deployInfo->isBuilt = NULL;
    }

    return $deployInfo;
  }
1264300
public function bind(Package $package = null)
    {
        $package = $package ?: new Package();
        $xml     = $this->xml;

        // Epub version:
        $package->version = (string) $xml['version'];
        
        $this->processMetadataElement($xml->metadata, $package->metadata);
        $this->processManifestElement($xml->manifest, $package->manifest);
        $this->processSpineElement($xml->spine, $package->spine, $package->manifest, $package->navigation);

        if ($xml->guide) {
            $this->processGuideElement($xml->guide, $package->guide);
        }

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

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

        return '';
    }
795321
protected function getPackageInfo($package) {
		
		$org  = "";
		$repo = "";
		$tag  = "master";
		
		if (strpos($package, "#") !== false) {
			list($package,$tag) = explode("#",$package);
		}
		
		if (strpos($package, "/") !== false) {
			list($org,$repo) = explode("/",$package);
		} else {
			Console::writeError("please provide a real path to a package...");
		}
		
		return array($org,$repo,$tag);
		
	}
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;
    }
1237886
private function compactConfig($package)
    {
        $config = (include $this->config);

        array_map(function ($detail, $key) use (&$config) {
            return $config['colors'][$key] = $detail['hex'];
        }, $package, array_keys($package));

        return $config;
    }
1228416
private static function loadPackage(string $package): stdClass {
    $language = new stdClass();
    if (!empty($package)) {
      $filename = null;
      if ($packageData = explode(":", $package)) {
        if (!empty($packageData[0])) {
          $filename .= Lang::$root[$packageData[0]];
        }
        if (!empty($packageData[1])) {
          $filename .= DIRECTORY_SEPARATOR . $packageData[1];
        }
        $pathaname = Lang::selectPackage($filename);
        if (file_exists($pathaname)) {
          $pathaname = Path::replaceOSSeparator($pathaname);
          $decode = json_decode(file_get_contents((new SplFileObject($pathaname, "r"))->getPathname()));
          $language = (JSON_ERROR_NONE == json_last_error()) ? $decode : $language;
        }
      }
    }
    return $language;
  }
43684
public function getManifest($package)
    {
        if (is_array($package['extra'][self::EXTRA_FIELD])) {
            return $package['extra'][self::EXTRA_FIELD];
        } else if (is_string($package['extra'][self::EXTRA_FIELD])) {
            $manifestFile = $this->vendorPath . DIRECTORY_SEPARATOR . $package['name'] . DIRECTORY_SEPARATOR . $package['extra'][self::EXTRA_FIELD];
            if (is_file($manifestFile)) {
                return include($manifestFile);
            }
        }
        return [];
    }
311332
protected function getPackageReplacementTokens(PackageInterface $package)
    {
        $vars = array(
          '{$type}' => $package->getType(),
        );

        $prettyName = $package->getPrettyName();
        if (strpos($prettyName, '/') !== false) {
            $pieces = explode('/', $prettyName);
            $vars['{$vendor}'] = $pieces[0];
            $vars['{$name}'] = $pieces[1];

        } else {
            $vars['{$vendor}'] = '';
            $vars['{$name}'] = $prettyName;
        }

        return $vars;
    }
1022259
public function getInstallPath(PackageInterface $package)
    {
        $type = $package->getType();
        if (substr($type, 0, strlen(self::NAME)) !== self::NAME) {
            throw new InvalidArgumentException(
                'Sorry the package type of this package is not yet supported.'
            );
        }

        $subPackageType = substr($type, strlen(self::NAME) + 1);

        $prettyName = $package->getPrettyName();
        if (strpos($prettyName, '/') !== false) {
            list($vendor, $name) = explode('/', $prettyName);
        } else {
            $vendor = '';
            $name = $prettyName;
        }

        $extra = $package->getExtra();
        if (!empty($extra['installer-name'])) {
            $name = $extra['installer-name'];
        }

        $availableVars = compact('name', 'vendor', 'type');

        if ($this->composer->getPackage()) {
            $extra = $this->composer->getPackage()->getExtra();
            if (!empty($extra['installer-paths'])) {
                $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
                if (!empty($customPath)) {
                    return $this->templatePath($customPath, $availableVars);
                }
            }
        }

        $locations = self::LOCATIONS;
        if (!isset($locations[$subPackageType])) {
            throw new InvalidArgumentException(sprintf('Sub-package type "%s" is not supported', $type));
        }

        return $this->templatePath($locations[$subPackageType], $availableVars);
    }
1130313
private function getPackageName(PackageInterface $package)
    {
        if (is_array($package->getExtra()) && isset($package->getExtra()['installer-name'])) {
            return $package->getExtra()['installer-name'];
        }

        $name = explode('/', $package->getPrettyName());
        $packageName = $name[1];

        if (count(explode('-', $packageName)) < 2) {
            throw new Exception('Bundle names should be like "vendor/NAME-bundle"');
        }

        $packageName = str_replace('-bundle', '', $packageName);

        return str_replace(' ', '', ucwords(str_replace('-', ' ', $packageName)));
    }
218368
public function subscribeTo($package)
    {
        if (!$this->hasSubscription(false)) {
            $this->_mixer->subscription = $this->getService('repos:subscriptions.subscription')
            ->getEntity(array(
                'data' => array(
                    'package' => $package,
                  ),
            ));
            $this->_mixer->verified = 1;
        }

        return $this->_mixer->subscription;
    }
1271423
public function getForPackage($package, $key, $default = null)
    {
        if (empty($this->packagesConfiguration[$package])) {
            return $default;
        }
        return Arr::get($this->packagesConfiguration[$package], $key, $default);
    }
312834
protected function isDrupalPackage($package)
    {
        if (isset($package) && $package instanceof PackageInterface && strstr($package->getName(), 'drupal/')) {
            return true;
        }
        return false;
    }
607389
protected function translateFieldName(string $field, string $package): string
	{
		// Return custom field name if we have one

		if($this->i18n->has(($i18nKey = $package . 'validate.overrides.fieldnames.' . $field)))
		{
			return $this->i18n->get($i18nKey);
		}

		// Return field a more human friendly field name

		return str_replace('_', ' ', $field);
	}
768342
protected function getProviderStub(Package $package, $plain)
	{
		return $this->formatPackageStub($package, $this->getProviderFile($plain));
	}