Rename Package interfaces to reduce BC issues
parent
8a275336a1
commit
d6de4a0036
@ -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();
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue