Rename Package interfaces to reduce BC issues
parent
8a275336a1
commit
d6de4a0036
|
@ -17,7 +17,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\CompletePackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Factory;
|
||||
|
||||
|
@ -117,11 +117,11 @@ EOT
|
|||
/**
|
||||
* tries to find a token within the name/keywords/description
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @param CompletePackageInterface $package
|
||||
* @param string $token
|
||||
* @return boolean
|
||||
*/
|
||||
private function matchPackage(PackageInterface $package, $token)
|
||||
private function matchPackage(CompletePackageInterface $package, $token)
|
||||
{
|
||||
$score = 0;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Command;
|
|||
|
||||
use Composer\Composer;
|
||||
use Composer\Factory;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\CompletePackageInterface;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -133,7 +133,7 @@ EOT
|
|||
* finds a package by name and version if provided
|
||||
*
|
||||
* @param InputInterface $input
|
||||
* @return PackageInterface
|
||||
* @return CompletePackageInterface
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function getPackage(InputInterface $input, OutputInterface $output, RepositoryInterface $installedRepo, RepositoryInterface $repos)
|
||||
|
@ -164,7 +164,7 @@ EOT
|
|||
/**
|
||||
* prints package meta data
|
||||
*/
|
||||
protected function printMeta(InputInterface $input, OutputInterface $output, PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $repos)
|
||||
protected function printMeta(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $repos)
|
||||
{
|
||||
$output->writeln('<info>name</info> : ' . $package->getPrettyName());
|
||||
$output->writeln('<info>descrip.</info> : ' . $package->getDescription());
|
||||
|
@ -206,7 +206,7 @@ EOT
|
|||
/**
|
||||
* prints all available versions of this package and highlights the installed one if any
|
||||
*/
|
||||
protected function printVersions(InputInterface $input, OutputInterface $output, PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $repos)
|
||||
protected function printVersions(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $repos)
|
||||
{
|
||||
if ($input->getArgument('version')) {
|
||||
$output->writeln('<info>version</info> : ' . $package->getPrettyVersion());
|
||||
|
@ -237,7 +237,7 @@ EOT
|
|||
*
|
||||
* @param string $linkType
|
||||
*/
|
||||
protected function printLinks(InputInterface $input, OutputInterface $output, PackageInterface $package, $linkType, $title = null)
|
||||
protected function printLinks(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, $linkType, $title = null)
|
||||
{
|
||||
$title = $title ?: $linkType;
|
||||
if ($links = $package->{'get'.ucfirst($linkType)}()) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Package\Locker;
|
||||
use Composer\Repository\RepositoryManager;
|
||||
use Composer\Installer\InstallationManager;
|
||||
|
@ -27,7 +27,7 @@ class Composer
|
|||
const VERSION = '@package_version@';
|
||||
|
||||
/**
|
||||
* @var Package\PackageInterface
|
||||
* @var Package\RootPackageInterface
|
||||
*/
|
||||
private $package;
|
||||
|
||||
|
@ -57,16 +57,16 @@ class Composer
|
|||
private $config;
|
||||
|
||||
/**
|
||||
* @param Package\PackageInterface $package
|
||||
* @param Package\RootPackageInterface $package
|
||||
* @return void
|
||||
*/
|
||||
public function setPackage(PackageInterface $package)
|
||||
public function setPackage(RootPackageInterface $package)
|
||||
{
|
||||
$this->package = $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Package\PackageInterface
|
||||
* @return Package\RootPackageInterface
|
||||
*/
|
||||
public function getPackage()
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ use Composer\Package\Link;
|
|||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\Locker;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\InstalledArrayRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
|
@ -55,7 +56,7 @@ class Installer
|
|||
protected $config;
|
||||
|
||||
/**
|
||||
* @var PackageInterface
|
||||
* @var RootPackageInterface
|
||||
*/
|
||||
protected $package;
|
||||
|
||||
|
@ -112,7 +113,7 @@ class Installer
|
|||
*
|
||||
* @param IOInterface $io
|
||||
* @param Config $config
|
||||
* @param PackageInterface $package
|
||||
* @param RootPackageInterface $package
|
||||
* @param DownloadManager $downloadManager
|
||||
* @param RepositoryManager $repositoryManager
|
||||
* @param Locker $locker
|
||||
|
@ -120,7 +121,7 @@ class Installer
|
|||
* @param EventDispatcher $eventDispatcher
|
||||
* @param AutoloadGenerator $autoloadGenerator
|
||||
*/
|
||||
public function __construct(IOInterface $io, Config $config, PackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
|
||||
public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
|
||||
{
|
||||
$this->io = $io;
|
||||
$this->config = $config;
|
||||
|
|
|
@ -18,7 +18,7 @@ use Composer\Package\Version\VersionParser;
|
|||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
class AliasPackage extends BasePackage
|
||||
class AliasPackage extends BasePackage implements CompletePackageInterface
|
||||
{
|
||||
protected $version;
|
||||
protected $prettyVersion;
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
* Package containing additional metadata that is not used by the solver
|
||||
*
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class CompletePackage extends Package implements CompletePackageInterface
|
||||
{
|
||||
protected $repositories;
|
||||
protected $license = array();
|
||||
protected $keywords;
|
||||
protected $authors;
|
||||
protected $description;
|
||||
protected $homepage;
|
||||
protected $scripts = array();
|
||||
protected $support = array();
|
||||
|
||||
/**
|
||||
* @param array $scripts
|
||||
*/
|
||||
public function setScripts(array $scripts)
|
||||
{
|
||||
$this->scripts = $scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getScripts()
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repositories
|
||||
*
|
||||
* @param string $repositories
|
||||
*/
|
||||
public function setRepositories($repositories)
|
||||
{
|
||||
$this->repositories = $repositories;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getRepositories()
|
||||
{
|
||||
return $this->repositories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the license
|
||||
*
|
||||
* @param array $license
|
||||
*/
|
||||
public function setLicense(array $license)
|
||||
{
|
||||
$this->license = $license;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLicense()
|
||||
{
|
||||
return $this->license;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the keywords
|
||||
*
|
||||
* @param array $keywords
|
||||
*/
|
||||
public function setKeywords(array $keywords)
|
||||
{
|
||||
$this->keywords = $keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getKeywords()
|
||||
{
|
||||
return $this->keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authors
|
||||
*
|
||||
* @param array $authors
|
||||
*/
|
||||
public function setAuthors(array $authors)
|
||||
{
|
||||
$this->authors = $authors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAuthors()
|
||||
{
|
||||
return $this->authors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the description
|
||||
*
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the homepage
|
||||
*
|
||||
* @param string $homepage
|
||||
*/
|
||||
public function setHomepage($homepage)
|
||||
{
|
||||
$this->homepage = $homepage;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getHomepage()
|
||||
{
|
||||
return $this->homepage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the support information
|
||||
*
|
||||
* @param array $support
|
||||
*/
|
||||
public function setSupport(array $support)
|
||||
{
|
||||
$this->support = $support;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSupport()
|
||||
{
|
||||
return $this->support;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Package;
|
||||
|
||||
/**
|
||||
* Defines package metadata that is not necessarily needed for solving and installing packages
|
||||
*
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
interface CompletePackageInterface extends PackageInterface
|
||||
{
|
||||
/**
|
||||
* Returns the scripts of this package
|
||||
*
|
||||
* @return array array('script name' => array('listeners'))
|
||||
*/
|
||||
public function getScripts();
|
||||
|
||||
/**
|
||||
* Returns an array of repositories
|
||||
*
|
||||
* {"<type>": {<config key/values>}}
|
||||
*
|
||||
* @return array Repositories
|
||||
*/
|
||||
public function getRepositories();
|
||||
|
||||
/**
|
||||
* Returns the package license, e.g. MIT, BSD, GPL
|
||||
*
|
||||
* @return array The package licenses
|
||||
*/
|
||||
public function getLicense();
|
||||
|
||||
/**
|
||||
* Returns an array of keywords relating to the package
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getKeywords();
|
||||
|
||||
/**
|
||||
* Returns the package description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription();
|
||||
|
||||
/**
|
||||
* Returns the package homepage
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHomepage();
|
||||
|
||||
/**
|
||||
* Returns an array of authors of the package
|
||||
*
|
||||
* Each item can contain name/homepage/email keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAuthors();
|
||||
|
||||
/**
|
||||
* Returns the support information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSupport();
|
||||
}
|
|
@ -1,297 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
|
||||
/**
|
||||
* Defines the essential information a package has that is used during solving/installation
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
interface CorePackageInterface
|
||||
{
|
||||
/**
|
||||
* Returns the package's name without version info, thus not a unique identifier
|
||||
*
|
||||
* @return string package name
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Returns the package's pretty (i.e. with proper case) name
|
||||
*
|
||||
* @return string package name
|
||||
*/
|
||||
public function getPrettyName();
|
||||
|
||||
/**
|
||||
* Returns a set of names that could refer to this package
|
||||
*
|
||||
* No version or release type information should be included in any of the
|
||||
* names. Provided or replaced package names need to be returned as well.
|
||||
*
|
||||
* @return array An array of strings referring to this package
|
||||
*/
|
||||
public function getNames();
|
||||
|
||||
/**
|
||||
* Allows the solver to set an id for this package to refer to it.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId($id);
|
||||
|
||||
/**
|
||||
* Retrieves the package's id set through setId
|
||||
*
|
||||
* @return int The previously set package id
|
||||
*/
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* Returns whether the package is a development virtual package or a concrete one
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDev();
|
||||
|
||||
/**
|
||||
* Returns the package type, e.g. library
|
||||
*
|
||||
* @return string The package type
|
||||
*/
|
||||
public function getType();
|
||||
|
||||
/**
|
||||
* Returns the package targetDir property
|
||||
*
|
||||
* @return string The package targetDir
|
||||
*/
|
||||
public function getTargetDir();
|
||||
|
||||
/**
|
||||
* Returns the package extra data
|
||||
*
|
||||
* @return array The package extra data
|
||||
*/
|
||||
public function getExtra();
|
||||
|
||||
/**
|
||||
* Sets source from which this package was installed (source/dist).
|
||||
*
|
||||
* @param string $type source/dist
|
||||
*/
|
||||
public function setInstallationSource($type);
|
||||
|
||||
/**
|
||||
* Returns source from which this package was installed (source/dist).
|
||||
*
|
||||
* @param string $type source/dist
|
||||
*/
|
||||
public function getInstallationSource();
|
||||
|
||||
/**
|
||||
* Returns the repository type of this package, e.g. git, svn
|
||||
*
|
||||
* @return string The repository type
|
||||
*/
|
||||
public function getSourceType();
|
||||
|
||||
/**
|
||||
* Returns the repository url of this package, e.g. git://github.com/naderman/composer.git
|
||||
*
|
||||
* @return string The repository url
|
||||
*/
|
||||
public function getSourceUrl();
|
||||
|
||||
/**
|
||||
* Returns the repository reference of this package, e.g. master, 1.0.0 or a commit hash for git
|
||||
*
|
||||
* @return string The repository reference
|
||||
*/
|
||||
public function getSourceReference();
|
||||
|
||||
/**
|
||||
* Returns the type of the distribution archive of this version, e.g. zip, tarball
|
||||
*
|
||||
* @return string The repository type
|
||||
*/
|
||||
public function getDistType();
|
||||
|
||||
/**
|
||||
* Returns the url of the distribution archive of this version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDistUrl();
|
||||
|
||||
/**
|
||||
* Returns the reference of the distribution archive of this version, e.g. master, 1.0.0 or a commit hash for git
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDistReference();
|
||||
|
||||
/**
|
||||
* Returns the sha1 checksum for the distribution archive of this version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDistSha1Checksum();
|
||||
|
||||
/**
|
||||
* Returns the version of this package
|
||||
*
|
||||
* @return string version
|
||||
*/
|
||||
public function getVersion();
|
||||
|
||||
/**
|
||||
* Returns the pretty (i.e. non-normalized) version string of this package
|
||||
*
|
||||
* @return string version
|
||||
*/
|
||||
public function getPrettyVersion();
|
||||
|
||||
/**
|
||||
* Returns the stability of this package: one of (dev, alpha, beta, RC, stable)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStability();
|
||||
|
||||
/**
|
||||
* Returns a set of links to packages which need to be installed before
|
||||
* this package can be installed
|
||||
*
|
||||
* @return array An array of package links defining required packages
|
||||
*/
|
||||
public function getRequires();
|
||||
|
||||
/**
|
||||
* Returns a set of links to packages which must not be installed at the
|
||||
* same time as this package
|
||||
*
|
||||
* @return array An array of package links defining conflicting packages
|
||||
*/
|
||||
public function getConflicts();
|
||||
|
||||
/**
|
||||
* Returns a set of links to virtual packages that are provided through
|
||||
* this package
|
||||
*
|
||||
* @return array An array of package links defining provided packages
|
||||
*/
|
||||
public function getProvides();
|
||||
|
||||
/**
|
||||
* Returns a set of links to packages which can alternatively be
|
||||
* satisfied by installing this package
|
||||
*
|
||||
* @return array An array of package links defining replaced packages
|
||||
*/
|
||||
public function getReplaces();
|
||||
|
||||
/**
|
||||
* Returns a set of links to packages which are required to develop
|
||||
* this package. These are installed if in dev mode.
|
||||
*
|
||||
* @return array An array of package links defining packages required for development
|
||||
*/
|
||||
public function getDevRequires();
|
||||
|
||||
/**
|
||||
* Returns a set of package names and reasons why they are useful in
|
||||
* combination with this package.
|
||||
*
|
||||
* @return array An array of package suggestions with descriptions
|
||||
*/
|
||||
public function getSuggests();
|
||||
|
||||
/**
|
||||
* Returns an associative array of autoloading rules
|
||||
*
|
||||
* {"<type>": {"<namespace": "<directory>"}}
|
||||
*
|
||||
* Type is either "psr-0" or "pear". Namespaces are mapped to directories
|
||||
* for autoloading using the type specified.
|
||||
*
|
||||
* @return array Mapping of autoloading rules
|
||||
*/
|
||||
public function getAutoload();
|
||||
|
||||
/**
|
||||
* Returns a list of directories which should get added to PHP's
|
||||
* include path.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getIncludePaths();
|
||||
|
||||
/**
|
||||
* Stores a reference to the repository that owns the package
|
||||
*
|
||||
* @param RepositoryInterface $repository
|
||||
*/
|
||||
public function setRepository(RepositoryInterface $repository);
|
||||
|
||||
/**
|
||||
* Returns a reference to the repository that owns the package
|
||||
*
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
public function getRepository();
|
||||
|
||||
/**
|
||||
* Returns the package binaries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBinaries();
|
||||
|
||||
/**
|
||||
* Returns a version this package should be aliased to
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAlias();
|
||||
|
||||
/**
|
||||
* Returns a non-normalized version this package should be aliased to
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrettyAlias();
|
||||
|
||||
/**
|
||||
* Returns package unique name, constructed from name and version.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUniqueName();
|
||||
|
||||
/**
|
||||
* Converts the package into a readable and unique string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* Converts the package into a pretty readable string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrettyString();
|
||||
}
|
|
@ -14,6 +14,7 @@ namespace Composer\Package\Dumper;
|
|||
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\CompletePackageInterface;
|
||||
|
||||
/**
|
||||
* @author Konstantin Kudryashiv <ever.zet@gmail.com>
|
||||
|
@ -25,19 +26,11 @@ class ArrayDumper
|
|||
{
|
||||
$keys = array(
|
||||
'binaries' => 'bin',
|
||||
'scripts',
|
||||
'type',
|
||||
'extra',
|
||||
'installationSource' => 'installation-source',
|
||||
'license',
|
||||
'authors',
|
||||
'description',
|
||||
'homepage',
|
||||
'keywords',
|
||||
'autoload',
|
||||
'repositories',
|
||||
'includePaths' => 'include-path',
|
||||
'support',
|
||||
);
|
||||
|
||||
$data = array();
|
||||
|
@ -49,10 +42,6 @@ class ArrayDumper
|
|||
$data['target-dir'] = $package->getTargetDir();
|
||||
}
|
||||
|
||||
if ($package->getReleaseDate()) {
|
||||
$data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
if ($package->getSourceType()) {
|
||||
$data['source']['type'] = $package->getSourceType();
|
||||
$data['source']['url'] = $package->getSourceUrl();
|
||||
|
@ -78,6 +67,32 @@ class ArrayDumper
|
|||
$data['suggest'] = $packages;
|
||||
}
|
||||
|
||||
if ($package->getReleaseDate()) {
|
||||
$data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
$data = $this->dumpValues($package, $keys, $data);
|
||||
|
||||
if ($package instanceof CompletePackageInterface) {
|
||||
$keys = array(
|
||||
'scripts',
|
||||
'license',
|
||||
'authors',
|
||||
'description',
|
||||
'homepage',
|
||||
'keywords',
|
||||
'repositories',
|
||||
'support',
|
||||
);
|
||||
|
||||
$data = $this->dumpValues($package, $keys, $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function dumpValues(PackageInterface $package, array $keys, array $data)
|
||||
{
|
||||
foreach ($keys as $method => $key) {
|
||||
if (is_numeric($method)) {
|
||||
$method = $key;
|
||||
|
|
|
@ -31,7 +31,7 @@ class ArrayLoader implements LoaderInterface
|
|||
$this->versionParser = $parser;
|
||||
}
|
||||
|
||||
public function load(array $config)
|
||||
public function load(array $config, $class = 'Composer\Package\CompletePackage')
|
||||
{
|
||||
if (!isset($config['name'])) {
|
||||
throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
|
||||
|
@ -46,7 +46,7 @@ class ArrayLoader implements LoaderInterface
|
|||
} else {
|
||||
$version = $this->versionParser->normalize($config['version']);
|
||||
}
|
||||
$package = new Package\MemoryPackage($config['name'], $version, $config['version']);
|
||||
$package = new $class($config['name'], $version, $config['version']);
|
||||
$package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
|
||||
|
||||
if (isset($config['target-dir'])) {
|
||||
|
@ -67,42 +67,6 @@ class ArrayLoader implements LoaderInterface
|
|||
$package->setBinaries($config['bin']);
|
||||
}
|
||||
|
||||
if (isset($config['scripts']) && is_array($config['scripts'])) {
|
||||
foreach ($config['scripts'] as $event => $listeners) {
|
||||
$config['scripts'][$event]= (array) $listeners;
|
||||
}
|
||||
$package->setScripts($config['scripts']);
|
||||
}
|
||||
|
||||
if (!empty($config['description']) && is_string($config['description'])) {
|
||||
$package->setDescription($config['description']);
|
||||
}
|
||||
|
||||
if (!empty($config['homepage']) && is_string($config['homepage'])) {
|
||||
$package->setHomepage($config['homepage']);
|
||||
}
|
||||
|
||||
if (!empty($config['keywords']) && is_array($config['keywords'])) {
|
||||
$package->setKeywords($config['keywords']);
|
||||
}
|
||||
|
||||
if (!empty($config['license'])) {
|
||||
$package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
|
||||
}
|
||||
|
||||
if (!empty($config['time'])) {
|
||||
try {
|
||||
$date = new \DateTime($config['time']);
|
||||
$date->setTimezone(new \DateTimeZone('UTC'));
|
||||
$package->setReleaseDate($date);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($config['authors']) && is_array($config['authors'])) {
|
||||
$package->setAuthors($config['authors']);
|
||||
}
|
||||
|
||||
if (isset($config['installation-source'])) {
|
||||
$package->setInstallationSource($config['installation-source']);
|
||||
}
|
||||
|
@ -165,8 +129,46 @@ class ArrayLoader implements LoaderInterface
|
|||
$package->setIncludePaths($config['include-path']);
|
||||
}
|
||||
|
||||
if (isset($config['support'])) {
|
||||
$package->setSupport($config['support']);
|
||||
if (!empty($config['time'])) {
|
||||
try {
|
||||
$date = new \DateTime($config['time']);
|
||||
$date->setTimezone(new \DateTimeZone('UTC'));
|
||||
$package->setReleaseDate($date);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($package instanceof Package\CompletePackageInterface) {
|
||||
if (isset($config['scripts']) && is_array($config['scripts'])) {
|
||||
foreach ($config['scripts'] as $event => $listeners) {
|
||||
$config['scripts'][$event]= (array) $listeners;
|
||||
}
|
||||
$package->setScripts($config['scripts']);
|
||||
}
|
||||
|
||||
if (!empty($config['description']) && is_string($config['description'])) {
|
||||
$package->setDescription($config['description']);
|
||||
}
|
||||
|
||||
if (!empty($config['homepage']) && is_string($config['homepage'])) {
|
||||
$package->setHomepage($config['homepage']);
|
||||
}
|
||||
|
||||
if (!empty($config['keywords']) && is_array($config['keywords'])) {
|
||||
$package->setKeywords($config['keywords']);
|
||||
}
|
||||
|
||||
if (!empty($config['license'])) {
|
||||
$package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
|
||||
}
|
||||
|
||||
if (!empty($config['authors']) && is_array($config['authors'])) {
|
||||
$package->setAuthors($config['authors']);
|
||||
}
|
||||
|
||||
if (isset($config['support'])) {
|
||||
$package->setSupport($config['support']);
|
||||
}
|
||||
}
|
||||
|
||||
return $package;
|
||||
|
|
|
@ -23,7 +23,8 @@ interface LoaderInterface
|
|||
* Converts a package from an array to a real instance
|
||||
*
|
||||
* @param array $package Package config
|
||||
* @param string $class Package class to use
|
||||
* @return \Composer\Package\PackageInterface
|
||||
*/
|
||||
public function load(array $package);
|
||||
public function load(array $package, $class = 'Composer\Package\CompletePackage');
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class RootPackageLoader extends ArrayLoader
|
|||
parent::__construct($parser);
|
||||
}
|
||||
|
||||
public function load(array $config)
|
||||
public function load(array $config, $class = 'Composer\Package\RootPackage')
|
||||
{
|
||||
if (!isset($config['name'])) {
|
||||
$config['name'] = '__root__';
|
||||
|
@ -62,7 +62,7 @@ class RootPackageLoader extends ArrayLoader
|
|||
$version = $config['version'];
|
||||
}
|
||||
|
||||
$package = parent::load($config);
|
||||
$package = parent::load($config, $class);
|
||||
|
||||
$aliases = array();
|
||||
$stabilityFlags = array();
|
||||
|
|
|
@ -36,7 +36,7 @@ class ValidatingArrayLoader implements LoaderInterface
|
|||
$this->versionParser = $parser;
|
||||
}
|
||||
|
||||
public function load(array $config)
|
||||
public function load(array $config, $class = 'Composer\Package\CompletePackage')
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
|
@ -168,7 +168,7 @@ class ValidatingArrayLoader implements LoaderInterface
|
|||
throw new \Exception(implode("\n", $this->errors));
|
||||
}
|
||||
|
||||
$package = $this->loader->load($this->config);
|
||||
$package = $this->loader->load($this->config, $class);
|
||||
$this->errors = array();
|
||||
$this->config = null;
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ namespace Composer\Package;
|
|||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
* A package with setters for all members to create it dynamically in memory
|
||||
* Core package definitions that are needed to resolve dependencies and install packages
|
||||
*
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class MemoryPackage extends BasePackage
|
||||
class Package extends BasePackage
|
||||
{
|
||||
protected $type;
|
||||
protected $targetDir;
|
||||
|
@ -33,24 +33,14 @@ class MemoryPackage extends BasePackage
|
|||
protected $distSha1Checksum;
|
||||
protected $version;
|
||||
protected $prettyVersion;
|
||||
protected $repositories;
|
||||
protected $license = array();
|
||||
protected $releaseDate;
|
||||
protected $keywords;
|
||||
protected $authors;
|
||||
protected $description;
|
||||
protected $homepage;
|
||||
protected $extra = array();
|
||||
protected $binaries = array();
|
||||
protected $scripts = array();
|
||||
protected $aliases = array();
|
||||
protected $alias;
|
||||
protected $prettyAlias;
|
||||
protected $dev;
|
||||
|
||||
protected $minimumStability = 'stable';
|
||||
protected $stabilityFlags = array();
|
||||
protected $references = array();
|
||||
protected $stability;
|
||||
|
||||
protected $requires = array();
|
||||
protected $conflicts = array();
|
||||
|
@ -60,7 +50,6 @@ class MemoryPackage extends BasePackage
|
|||
protected $suggests = array();
|
||||
protected $autoload = array();
|
||||
protected $includePaths = array();
|
||||
protected $support = array();
|
||||
|
||||
/**
|
||||
* Creates a new in memory package.
|
||||
|
@ -160,22 +149,6 @@ class MemoryPackage extends BasePackage
|
|||
return $this->binaries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $scripts
|
||||
*/
|
||||
public function setScripts(array $scripts)
|
||||
{
|
||||
$this->scripts = $scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getScripts()
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aliases
|
||||
*/
|
||||
|
@ -352,24 +325,6 @@ class MemoryPackage extends BasePackage
|
|||
return $this->distSha1Checksum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repositories
|
||||
*
|
||||
* @param string $repositories
|
||||
*/
|
||||
public function setRepositories($repositories)
|
||||
{
|
||||
$this->repositories = $repositories;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getRepositories()
|
||||
{
|
||||
return $this->repositories;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -387,21 +342,21 @@ class MemoryPackage extends BasePackage
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the license
|
||||
* Set the releaseDate
|
||||
*
|
||||
* @param array $license
|
||||
* @param DateTime $releaseDate
|
||||
*/
|
||||
public function setLicense(array $license)
|
||||
public function setReleaseDate(\DateTime $releaseDate)
|
||||
{
|
||||
$this->license = $license;
|
||||
$this->releaseDate = $releaseDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLicense()
|
||||
public function getReleaseDate()
|
||||
{
|
||||
return $this->license;
|
||||
return $this->releaseDate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -512,150 +467,6 @@ class MemoryPackage extends BasePackage
|
|||
return $this->suggests;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the releaseDate
|
||||
*
|
||||
* @param DateTime $releaseDate
|
||||
*/
|
||||
public function setReleaseDate(\DateTime $releaseDate)
|
||||
{
|
||||
$this->releaseDate = $releaseDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReleaseDate()
|
||||
{
|
||||
return $this->releaseDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the keywords
|
||||
*
|
||||
* @param array $keywords
|
||||
*/
|
||||
public function setKeywords(array $keywords)
|
||||
{
|
||||
$this->keywords = $keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getKeywords()
|
||||
{
|
||||
return $this->keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authors
|
||||
*
|
||||
* @param array $authors
|
||||
*/
|
||||
public function setAuthors(array $authors)
|
||||
{
|
||||
$this->authors = $authors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAuthors()
|
||||
{
|
||||
return $this->authors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the description
|
||||
*
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the homepage
|
||||
*
|
||||
* @param string $homepage
|
||||
*/
|
||||
public function setHomepage($homepage)
|
||||
{
|
||||
$this->homepage = $homepage;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getHomepage()
|
||||
{
|
||||
return $this->homepage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the minimumStability
|
||||
*
|
||||
* @param string $minimumStability
|
||||
*/
|
||||
public function setMinimumStability($minimumStability)
|
||||
{
|
||||
$this->minimumStability = $minimumStability;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getMinimumStability()
|
||||
{
|
||||
return $this->minimumStability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the stabilityFlags
|
||||
*
|
||||
* @param array $stabilityFlags
|
||||
*/
|
||||
public function setStabilityFlags(array $stabilityFlags)
|
||||
{
|
||||
$this->stabilityFlags = $stabilityFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getStabilityFlags()
|
||||
{
|
||||
return $this->stabilityFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the references
|
||||
*
|
||||
* @param array $references
|
||||
*/
|
||||
public function setReferences(array $references)
|
||||
{
|
||||
$this->references = $references;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReferences()
|
||||
{
|
||||
return $this->references;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the autoload mapping
|
||||
*
|
||||
|
@ -691,22 +502,4 @@ class MemoryPackage extends BasePackage
|
|||
{
|
||||
return $this->includePaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the support information
|
||||
*
|
||||
* @param array $support
|
||||
*/
|
||||
public function setSupport(array $support)
|
||||
{
|
||||
$this->support = $support;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSupport()
|
||||
{
|
||||
return $this->support;
|
||||
}
|
||||
}
|
|
@ -12,35 +12,157 @@
|
|||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
|
||||
/**
|
||||
* Defines package metadata that is not necessarily needed for solving and installing packages
|
||||
* Defines the essential information a package has that is used during solving/installation
|
||||
*
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
interface PackageInterface extends CorePackageInterface
|
||||
interface PackageInterface
|
||||
{
|
||||
/**
|
||||
* Returns the scripts of this package
|
||||
* Returns the package's name without version info, thus not a unique identifier
|
||||
*
|
||||
* @return array array('script name' => array('listeners'))
|
||||
* @return string package name
|
||||
*/
|
||||
public function getScripts();
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Returns an array of repositories
|
||||
* Returns the package's pretty (i.e. with proper case) name
|
||||
*
|
||||
* {"<type>": {<config key/values>}}
|
||||
*
|
||||
* @return array Repositories
|
||||
* @return string package name
|
||||
*/
|
||||
public function getRepositories();
|
||||
public function getPrettyName();
|
||||
|
||||
/**
|
||||
* Returns the package license, e.g. MIT, BSD, GPL
|
||||
* Returns a set of names that could refer to this package
|
||||
*
|
||||
* @return array The package licenses
|
||||
* No version or release type information should be included in any of the
|
||||
* names. Provided or replaced package names need to be returned as well.
|
||||
*
|
||||
* @return array An array of strings referring to this package
|
||||
*/
|
||||
public function getLicense();
|
||||
public function getNames();
|
||||
|
||||
/**
|
||||
* Allows the solver to set an id for this package to refer to it.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId($id);
|
||||
|
||||
/**
|
||||
* Retrieves the package's id set through setId
|
||||
*
|
||||
* @return int The previously set package id
|
||||
*/
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* Returns whether the package is a development virtual package or a concrete one
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDev();
|
||||
|
||||
/**
|
||||
* Returns the package type, e.g. library
|
||||
*
|
||||
* @return string The package type
|
||||
*/
|
||||
public function getType();
|
||||
|
||||
/**
|
||||
* Returns the package targetDir property
|
||||
*
|
||||
* @return string The package targetDir
|
||||
*/
|
||||
public function getTargetDir();
|
||||
|
||||
/**
|
||||
* Returns the package extra data
|
||||
*
|
||||
* @return array The package extra data
|
||||
*/
|
||||
public function getExtra();
|
||||
|
||||
/**
|
||||
* Sets source from which this package was installed (source/dist).
|
||||
*
|
||||
* @param string $type source/dist
|
||||
*/
|
||||
public function setInstallationSource($type);
|
||||
|
||||
/**
|
||||
* Returns source from which this package was installed (source/dist).
|
||||
*
|
||||
* @param string $type source/dist
|
||||
*/
|
||||
public function getInstallationSource();
|
||||
|
||||
/**
|
||||
* Returns the repository type of this package, e.g. git, svn
|
||||
*
|
||||
* @return string The repository type
|
||||
*/
|
||||
public function getSourceType();
|
||||
|
||||
/**
|
||||
* Returns the repository url of this package, e.g. git://github.com/naderman/composer.git
|
||||
*
|
||||
* @return string The repository url
|
||||
*/
|
||||
public function getSourceUrl();
|
||||
|
||||
/**
|
||||
* Returns the repository reference of this package, e.g. master, 1.0.0 or a commit hash for git
|
||||
*
|
||||
* @return string The repository reference
|
||||
*/
|
||||
public function getSourceReference();
|
||||
|
||||
/**
|
||||
* Returns the type of the distribution archive of this version, e.g. zip, tarball
|
||||
*
|
||||
* @return string The repository type
|
||||
*/
|
||||
public function getDistType();
|
||||
|
||||
/**
|
||||
* Returns the url of the distribution archive of this version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDistUrl();
|
||||
|
||||
/**
|
||||
* Returns the reference of the distribution archive of this version, e.g. master, 1.0.0 or a commit hash for git
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDistReference();
|
||||
|
||||
/**
|
||||
* Returns the sha1 checksum for the distribution archive of this version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDistSha1Checksum();
|
||||
|
||||
/**
|
||||
* Returns the version of this package
|
||||
*
|
||||
* @return string version
|
||||
*/
|
||||
public function getVersion();
|
||||
|
||||
/**
|
||||
* Returns the pretty (i.e. non-normalized) version string of this package
|
||||
*
|
||||
* @return string version
|
||||
*/
|
||||
public function getPrettyVersion();
|
||||
|
||||
/**
|
||||
* Returns the release date of the package
|
||||
|
@ -50,39 +172,133 @@ interface PackageInterface extends CorePackageInterface
|
|||
public function getReleaseDate();
|
||||
|
||||
/**
|
||||
* Returns an array of keywords relating to the package
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getKeywords();
|
||||
|
||||
/**
|
||||
* Returns the package description
|
||||
* Returns the stability of this package: one of (dev, alpha, beta, RC, stable)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription();
|
||||
public function getStability();
|
||||
|
||||
/**
|
||||
* Returns the package homepage
|
||||
* Returns a set of links to packages which need to be installed before
|
||||
* this package can be installed
|
||||
*
|
||||
* @return array An array of package links defining required packages
|
||||
*/
|
||||
public function getRequires();
|
||||
|
||||
/**
|
||||
* Returns a set of links to packages which must not be installed at the
|
||||
* same time as this package
|
||||
*
|
||||
* @return array An array of package links defining conflicting packages
|
||||
*/
|
||||
public function getConflicts();
|
||||
|
||||
/**
|
||||
* Returns a set of links to virtual packages that are provided through
|
||||
* this package
|
||||
*
|
||||
* @return array An array of package links defining provided packages
|
||||
*/
|
||||
public function getProvides();
|
||||
|
||||
/**
|
||||
* Returns a set of links to packages which can alternatively be
|
||||
* satisfied by installing this package
|
||||
*
|
||||
* @return array An array of package links defining replaced packages
|
||||
*/
|
||||
public function getReplaces();
|
||||
|
||||
/**
|
||||
* Returns a set of links to packages which are required to develop
|
||||
* this package. These are installed if in dev mode.
|
||||
*
|
||||
* @return array An array of package links defining packages required for development
|
||||
*/
|
||||
public function getDevRequires();
|
||||
|
||||
/**
|
||||
* Returns a set of package names and reasons why they are useful in
|
||||
* combination with this package.
|
||||
*
|
||||
* @return array An array of package suggestions with descriptions
|
||||
*/
|
||||
public function getSuggests();
|
||||
|
||||
/**
|
||||
* Returns an associative array of autoloading rules
|
||||
*
|
||||
* {"<type>": {"<namespace": "<directory>"}}
|
||||
*
|
||||
* Type is either "psr-0" or "pear". Namespaces are mapped to directories
|
||||
* for autoloading using the type specified.
|
||||
*
|
||||
* @return array Mapping of autoloading rules
|
||||
*/
|
||||
public function getAutoload();
|
||||
|
||||
/**
|
||||
* Returns a list of directories which should get added to PHP's
|
||||
* include path.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getIncludePaths();
|
||||
|
||||
/**
|
||||
* Stores a reference to the repository that owns the package
|
||||
*
|
||||
* @param RepositoryInterface $repository
|
||||
*/
|
||||
public function setRepository(RepositoryInterface $repository);
|
||||
|
||||
/**
|
||||
* Returns a reference to the repository that owns the package
|
||||
*
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
public function getRepository();
|
||||
|
||||
/**
|
||||
* Returns the package binaries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBinaries();
|
||||
|
||||
/**
|
||||
* Returns a version this package should be aliased to
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHomepage();
|
||||
public function getAlias();
|
||||
|
||||
/**
|
||||
* Returns an array of authors of the package
|
||||
* Returns a non-normalized version this package should be aliased to
|
||||
*
|
||||
* Each item can contain name/homepage/email keys
|
||||
*
|
||||
* @return array
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthors();
|
||||
public function getPrettyAlias();
|
||||
|
||||
/**
|
||||
* Returns the support information
|
||||
* Returns package unique name, constructed from name and version.
|
||||
*
|
||||
* @return array
|
||||
* @return string
|
||||
*/
|
||||
public function getSupport();
|
||||
public function getUniqueName();
|
||||
|
||||
/**
|
||||
* Converts the package into a readable and unique string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* Converts the package into a pretty readable string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrettyString();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Package;
|
||||
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
* The root package represents the project's composer.json and contains additional metadata
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
class RootPackage extends CompletePackage implements RootPackageInterface
|
||||
{
|
||||
protected $minimumStability = 'stable';
|
||||
protected $stabilityFlags = array();
|
||||
protected $references = array();
|
||||
|
||||
/**
|
||||
* Set the minimumStability
|
||||
*
|
||||
* @param string $minimumStability
|
||||
*/
|
||||
public function setMinimumStability($minimumStability)
|
||||
{
|
||||
$this->minimumStability = $minimumStability;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getMinimumStability()
|
||||
{
|
||||
return $this->minimumStability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the stabilityFlags
|
||||
*
|
||||
* @param array $stabilityFlags
|
||||
*/
|
||||
public function setStabilityFlags(array $stabilityFlags)
|
||||
{
|
||||
$this->stabilityFlags = $stabilityFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getStabilityFlags()
|
||||
{
|
||||
return $this->stabilityFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the references
|
||||
*
|
||||
* @param array $references
|
||||
*/
|
||||
public function setReferences(array $references)
|
||||
{
|
||||
$this->references = $references;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReferences()
|
||||
{
|
||||
return $this->references;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ namespace Composer\Package;
|
|||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
interface RootPackageInterface extends PackageInterface
|
||||
interface RootPackageInterface extends CompletePackageInterface
|
||||
{
|
||||
/**
|
||||
* Returns the minimum stability of the package
|
||||
|
|
|
@ -127,7 +127,7 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
|
|||
*/
|
||||
public function loadPackage(array $data)
|
||||
{
|
||||
$package = $this->loader->load($data['raw']);
|
||||
$package = $this->loader->load($data['raw'], 'Composer\Package\Package');
|
||||
$package->setRepository($this);
|
||||
|
||||
return $package;
|
||||
|
@ -154,7 +154,7 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
|
|||
$repoData = $this->loadDataFromServer();
|
||||
|
||||
foreach ($repoData as $package) {
|
||||
$this->addPackage($this->loader->load($package));
|
||||
$this->addPackage($this->loader->load($package, 'Composer\Package\Package'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ use Composer\Util\RemoteFilesystem;
|
|||
/**
|
||||
* PEAR Channel package reader.
|
||||
*
|
||||
* Reads channel packages info from and builds MemoryPackage's
|
||||
* Reads channel packages info from and builds Package's
|
||||
*
|
||||
* @author Alexey Prilipko <palex@farpost.com>
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Repository;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Repository\Pear\ChannelReader;
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Repository\Pear\ChannelInfo;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
|
@ -81,10 +81,10 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Builds MemoryPackages from PEAR package definition data.
|
||||
* Builds CompletePackages from PEAR package definition data.
|
||||
*
|
||||
* @param ChannelInfo $channelInfo
|
||||
* @return MemoryPackage
|
||||
* @return CompletePackage
|
||||
*/
|
||||
private function buildComposerPackages(ChannelInfo $channelInfo, VersionParser $versionParser)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ class PearRepository extends ArrayRepository
|
|||
}
|
||||
}
|
||||
|
||||
$package = new MemoryPackage($composerPackageName, $normalizedVersion, $version);
|
||||
$package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
|
||||
$package->setType('pear-library');
|
||||
$package->setDescription($packageDefinition->getDescription());
|
||||
$package->setDistType('file');
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ class PlatformRepository extends ArrayRepository
|
|||
$version = $versionParser->normalize($prettyVersion);
|
||||
}
|
||||
|
||||
$php = new MemoryPackage('php', $version, $prettyVersion);
|
||||
$php = new CompletePackage('php', $version, $prettyVersion);
|
||||
$php->setDescription('The PHP interpreter');
|
||||
parent::addPackage($php);
|
||||
|
||||
|
@ -55,7 +55,7 @@ class PlatformRepository extends ArrayRepository
|
|||
$version = $versionParser->normalize($prettyVersion);
|
||||
}
|
||||
|
||||
$ext = new MemoryPackage('ext-'.$name, $version, $prettyVersion);
|
||||
$ext = new CompletePackage('ext-'.$name, $version, $prettyVersion);
|
||||
$ext->setDescription('The '.$name.' PHP extension');
|
||||
parent::addPackage($ext);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class PlatformRepository extends ArrayRepository
|
|||
continue;
|
||||
}
|
||||
|
||||
$lib = new MemoryPackage('lib-'.$name, $version, $prettyVersion);
|
||||
$lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
|
||||
$lib->setDescription('The '.$name.' PHP library');
|
||||
parent::addPackage($lib);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Test\Autoload;
|
|||
use Composer\Autoload\AutoloadGenerator;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class AutoloadGeneratorTest extends TestCase
|
||||
|
@ -76,7 +76,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testMainPackageAutoloading()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$package->setAutoload(array(
|
||||
'psr-0' => array('Main' => 'src/', 'Lala' => array('src/', 'lib/')),
|
||||
'classmap' => array('composersrc/'),
|
||||
|
@ -101,7 +101,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
{
|
||||
$this->vendorDir = $this->workingDir;
|
||||
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$package->setAutoload(array(
|
||||
'psr-0' => array('Main' => 'src/', 'Lala' => 'src/'),
|
||||
'classmap' => array('composersrc/'),
|
||||
|
@ -124,7 +124,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testMainPackageAutoloadingAlternativeVendorDir()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$package->setAutoload(array(
|
||||
'psr-0' => array('Main' => 'src/', 'Lala' => 'src/'),
|
||||
'classmap' => array('composersrc/'),
|
||||
|
@ -147,7 +147,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testMainPackageAutoloadingWithTargetDir()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$package->setAutoload(array(
|
||||
'psr-0' => array('Main\\Foo' => '', 'Main\\Bar' => ''),
|
||||
));
|
||||
|
@ -166,11 +166,11 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testVendorsAutoloading()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
|
||||
$packages = array();
|
||||
$packages[] = $a = new MemoryPackage('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new MemoryPackage('b/b', '1.0', '1.0');
|
||||
$packages[] = $a = new Package('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new Package('b/b', '1.0', '1.0');
|
||||
$packages[] = $c = new AliasPackage($b, '1.2', '1.2');
|
||||
$a->setAutoload(array('psr-0' => array('A' => 'src/', 'A\\B' => 'lib/')));
|
||||
$b->setAutoload(array('psr-0' => array('B\\Sub\\Name' => 'src/')));
|
||||
|
@ -191,11 +191,11 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testVendorsClassMapAutoloading()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
|
||||
$packages = array();
|
||||
$packages[] = $a = new MemoryPackage('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new MemoryPackage('b/b', '1.0', '1.0');
|
||||
$packages[] = $a = new Package('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new Package('b/b', '1.0', '1.0');
|
||||
$a->setAutoload(array('classmap' => array('src/')));
|
||||
$b->setAutoload(array('classmap' => array('src/', 'lib/')));
|
||||
|
||||
|
@ -226,12 +226,12 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testClassMapAutoloadingEmptyDirAndExactFile()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
|
||||
$packages = array();
|
||||
$packages[] = $a = new MemoryPackage('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new MemoryPackage('b/b', '1.0', '1.0');
|
||||
$packages[] = $c = new MemoryPackage('c/c', '1.0', '1.0');
|
||||
$packages[] = $a = new Package('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new Package('b/b', '1.0', '1.0');
|
||||
$packages[] = $c = new Package('c/c', '1.0', '1.0');
|
||||
$a->setAutoload(array('classmap' => array('')));
|
||||
$b->setAutoload(array('classmap' => array('test.php')));
|
||||
$c->setAutoload(array('classmap' => array('./')));
|
||||
|
@ -263,12 +263,12 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testFilesAutoloadGeneration()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$package->setAutoload(array('files' => array('root.php')));
|
||||
|
||||
$packages = array();
|
||||
$packages[] = $a = new MemoryPackage('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new MemoryPackage('b/b', '1.0', '1.0');
|
||||
$packages[] = $a = new Package('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new Package('b/b', '1.0', '1.0');
|
||||
$a->setAutoload(array('files' => array('test.php')));
|
||||
$b->setAutoload(array('files' => array('test2.php')));
|
||||
|
||||
|
@ -297,12 +297,12 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
public function testOverrideVendorsAutoloading()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$package->setAutoload(array('psr-0' => array('A\\B' => $this->workingDir.'/lib')));
|
||||
|
||||
$packages = array();
|
||||
$packages[] = $a = new MemoryPackage('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new MemoryPackage('b/b', '1.0', '1.0');
|
||||
$packages[] = $a = new Package('a/a', '1.0', '1.0');
|
||||
$packages[] = $b = new Package('b/b', '1.0', '1.0');
|
||||
$a->setAutoload(array('psr-0' => array('A' => 'src/', 'A\\B' => 'lib/')));
|
||||
$b->setAutoload(array('psr-0' => array('B\\Sub\\Name' => 'src/')));
|
||||
|
||||
|
@ -356,16 +356,16 @@ EOF;
|
|||
|
||||
public function testIncludePathFileGeneration()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$packages = array();
|
||||
|
||||
$a = new MemoryPackage("a/a", "1.0", "1.0");
|
||||
$a = new Package("a/a", "1.0", "1.0");
|
||||
$a->setIncludePaths(array("lib/"));
|
||||
|
||||
$b = new MemoryPackage("b/b", "1.0", "1.0");
|
||||
$b = new Package("b/b", "1.0", "1.0");
|
||||
$b->setIncludePaths(array("library"));
|
||||
|
||||
$c = new MemoryPackage("c", "1.0", "1.0");
|
||||
$c = new Package("c", "1.0", "1.0");
|
||||
$c->setIncludePaths(array("library"));
|
||||
|
||||
$packages[] = $a;
|
||||
|
@ -393,10 +393,10 @@ EOF;
|
|||
|
||||
public function testIncludePathsArePrependedInAutoloadFile()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$packages = array();
|
||||
|
||||
$a = new MemoryPackage("a/a", "1.0", "1.0");
|
||||
$a = new Package("a/a", "1.0", "1.0");
|
||||
$a->setIncludePaths(array("lib/"));
|
||||
|
||||
$packages[] = $a;
|
||||
|
@ -426,10 +426,10 @@ EOF;
|
|||
|
||||
public function testIncludePathFileWithoutPathsIsSkipped()
|
||||
{
|
||||
$package = new MemoryPackage('a', '1.0', '1.0');
|
||||
$package = new Package('a', '1.0', '1.0');
|
||||
$packages = array();
|
||||
|
||||
$a = new MemoryPackage("a/a", "1.0", "1.0");
|
||||
$a = new Package("a/a", "1.0", "1.0");
|
||||
$packages[] = $a;
|
||||
|
||||
$this->repository->expects($this->once())
|
||||
|
|
|
@ -18,7 +18,7 @@ class ComposerTest extends TestCase
|
|||
public function testSetGetPackage()
|
||||
{
|
||||
$composer = new Composer();
|
||||
$package = $this->getMock('Composer\Package\PackageInterface');
|
||||
$package = $this->getMock('Composer\Package\RootPackageInterface');
|
||||
$composer->setPackage($package);
|
||||
|
||||
$this->assertSame($package, $composer->getPackage());
|
||||
|
|
|
@ -235,7 +235,7 @@ class LibraryInstallerTest extends TestCase
|
|||
|
||||
protected function createPackageMock()
|
||||
{
|
||||
return $this->getMockBuilder('Composer\Package\MemoryPackage')
|
||||
return $this->getMockBuilder('Composer\Package\Package')
|
||||
->setConstructorArgs(array(md5(rand()), '1.0.0.0', '1.0.0'))
|
||||
->getMock();
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class MetapackageInstallerTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
private function createPackageMock()
|
||||
{
|
||||
return $this->getMockBuilder('Composer\Package\MemoryPackage')
|
||||
return $this->getMockBuilder('Composer\Package\Package')
|
||||
->setConstructorArgs(array(md5(rand()), '1.0.0.0', '1.0.0'))
|
||||
->getMock();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ use Composer\Config;
|
|||
use Composer\Json\JsonFile;
|
||||
use Composer\Repository\ArrayRepository;
|
||||
use Composer\Repository\RepositoryManager;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\Locker;
|
||||
use Composer\Test\Mock\FactoryMock;
|
||||
|
@ -32,7 +32,7 @@ class InstallerTest extends TestCase
|
|||
/**
|
||||
* @dataProvider provideInstaller
|
||||
*/
|
||||
public function testInstaller(PackageInterface $rootPackage, $repositories, array $options)
|
||||
public function testInstaller(RootPackageInterface $rootPackage, $repositories, array $options)
|
||||
{
|
||||
$io = $this->getMock('Composer\IO\IOInterface');
|
||||
|
||||
|
@ -80,7 +80,7 @@ class InstallerTest extends TestCase
|
|||
// when A requires B and B requires A, and A is a non-published root package
|
||||
// the install of B should succeed
|
||||
|
||||
$a = $this->getPackage('A', '1.0.0');
|
||||
$a = $this->getPackage('A', '1.0.0', 'Composer\Package\RootPackage');
|
||||
$a->setRequires(array(
|
||||
new Link('A', 'B', $this->getVersionConstraint('=', '1.0.0')),
|
||||
));
|
||||
|
@ -100,7 +100,7 @@ class InstallerTest extends TestCase
|
|||
// #480: when A requires B and B requires A, and A is a published root package
|
||||
// only B should be installed, as A is the root
|
||||
|
||||
$a = $this->getPackage('A', '1.0.0');
|
||||
$a = $this->getPackage('A', '1.0.0', 'Composer\Package\RootPackage');
|
||||
$a->setRequires(array(
|
||||
new Link('A', 'B', $this->getVersionConstraint('=', '1.0.0')),
|
||||
));
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
namespace Composer\Test\Package;
|
||||
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class MemoryPackageTest extends TestCase
|
||||
class CompletePackageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Memory package naming, versioning, and marshalling semantics provider
|
||||
|
@ -38,11 +38,11 @@ class MemoryPackageTest extends TestCase
|
|||
* Tests memory package naming semantics
|
||||
* @dataProvider providerVersioningSchemes
|
||||
*/
|
||||
public function testMemoryPackageHasExpectedNamingSemantics($name, $version)
|
||||
public function testPackageHasExpectedNamingSemantics($name, $version)
|
||||
{
|
||||
$versionParser = new VersionParser();
|
||||
$normVersion = $versionParser->normalize($version);
|
||||
$package = new MemoryPackage($name, $normVersion, $version);
|
||||
$package = new Package($name, $normVersion, $version);
|
||||
$this->assertEquals(strtolower($name), $package->getName());
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,11 @@ class MemoryPackageTest extends TestCase
|
|||
* Tests memory package versioning semantics
|
||||
* @dataProvider providerVersioningSchemes
|
||||
*/
|
||||
public function testMemoryPackageHasExpectedVersioningSemantics($name, $version)
|
||||
public function testPackageHasExpectedVersioningSemantics($name, $version)
|
||||
{
|
||||
$versionParser = new VersionParser();
|
||||
$normVersion = $versionParser->normalize($version);
|
||||
$package = new MemoryPackage($name, $normVersion, $version);
|
||||
$package = new Package($name, $normVersion, $version);
|
||||
$this->assertEquals($version, $package->getPrettyVersion());
|
||||
$this->assertEquals($normVersion, $package->getVersion());
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ class MemoryPackageTest extends TestCase
|
|||
* Tests memory package marshalling/serialization semantics
|
||||
* @dataProvider providerVersioningSchemes
|
||||
*/
|
||||
public function testMemoryPackageHasExpectedMarshallingSemantics($name, $version)
|
||||
public function testPackageHasExpectedMarshallingSemantics($name, $version)
|
||||
{
|
||||
$versionParser = new VersionParser();
|
||||
$normVersion = $versionParser->normalize($version);
|
||||
$package = new MemoryPackage($name, $normVersion, $version);
|
||||
$package = new Package($name, $normVersion, $version);
|
||||
$this->assertEquals(strtolower($name).'-'.$normVersion, (string) $package);
|
||||
}
|
||||
|
|
@ -23,14 +23,14 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
private $dumper;
|
||||
/**
|
||||
* @var \Composer\Package\PackageInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
* @var \Composer\Package\CompletePackageInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
private $package;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->dumper = new ArrayDumper();
|
||||
$this->package = $this->getMock('Composer\Package\PackageInterface');
|
||||
$this->package = $this->getMock('Composer\Package\CompletePackageInterface');
|
||||
}
|
||||
|
||||
public function testRequiredInformation()
|
||||
|
|
|
@ -16,7 +16,7 @@ use Composer\Test\TestCase;
|
|||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Test\Mock\RemoteFilesystemMock;
|
||||
|
||||
class ChannelReaderTest extends TestCase
|
||||
|
@ -117,7 +117,7 @@ class ChannelReaderTest extends TestCase
|
|||
|
||||
$packages = $ref->invoke($reader, $channelInfo, new VersionParser());
|
||||
|
||||
$expectedPackage = new MemoryPackage('pear-test.loc/sample', '1.0.0.1' , '1.0.0.1');
|
||||
$expectedPackage = new CompletePackage('pear-test.loc/sample', '1.0.0.1' , '1.0.0.1');
|
||||
$expectedPackage->setType('pear-library');
|
||||
$expectedPackage->setDistType('file');
|
||||
$expectedPackage->setDescription('description');
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test;
|
||||
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Util\Filesystem;
|
||||
|
@ -43,11 +43,11 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
|
|||
return $constraint;
|
||||
}
|
||||
|
||||
protected function getPackage($name, $version)
|
||||
protected function getPackage($name, $version, $class = 'Composer\Package\Package')
|
||||
{
|
||||
$normVersion = self::getVersionParser()->normalize($version);
|
||||
|
||||
return new MemoryPackage($name, $normVersion, $version);
|
||||
return new $class($name, $normVersion, $version);
|
||||
}
|
||||
|
||||
protected function getAliasPackage($package, $version)
|
||||
|
|
Loading…
Reference in New Issue