-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from cweagans/resolver-capabilities
Split out patch resolution into Composer Capabilities
- Loading branch information
Showing
20 changed files
with
769 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace cweagans\Composer\Capability; | ||
|
||
use Composer\Composer; | ||
use Composer\IO\IOInterface; | ||
use Composer\Plugin\Capability\Capability; | ||
use Composer\Plugin\PluginInterface; | ||
|
||
abstract class BaseResolverProvider implements Capability, ResolverProvider | ||
{ | ||
/** | ||
* @var Composer | ||
*/ | ||
protected $composer; | ||
|
||
/** | ||
* @var IOInterface | ||
*/ | ||
protected $io; | ||
|
||
/** | ||
* @var PluginInterface | ||
*/ | ||
protected $plugin; | ||
|
||
/** | ||
* BaseResolverProvider constructor. | ||
* | ||
* Stores values passed by the plugin manager for later use. | ||
* | ||
* @param array $args | ||
* An array of args passed by the plugin manager. | ||
*/ | ||
public function __construct($args) | ||
{ | ||
$this->composer = $args['composer']; | ||
$this->io = $args['io']; | ||
$this->plugin = $args['plugin']; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
abstract public function getResolvers(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace cweagans\Composer\Capability; | ||
|
||
use cweagans\Composer\Resolvers\DependencyPatches; | ||
use cweagans\Composer\Resolvers\PatchesFile; | ||
use cweagans\Composer\Resolvers\RootComposer; | ||
|
||
class CoreResolverProvider extends BaseResolverProvider | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getResolvers() | ||
{ | ||
return [ | ||
new RootComposer($this->composer, $this->io), | ||
new PatchesFile($this->composer, $this->io), | ||
new DependencyPatches($this->composer, $this->io), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace cweagans\Composer\Capability; | ||
|
||
use Composer\Plugin\Capability\Capability; | ||
|
||
/** | ||
* Resolver provider interface. | ||
* | ||
* This capability will receive an array with 'composer' and 'io' keys as | ||
* constructor arguments. It also contains a 'plugin' key containing the | ||
* plugin instance that declared the capability. | ||
*/ | ||
interface ResolverProvider extends Capability | ||
{ | ||
/** | ||
* Retrieves an array of PatchResolvers. | ||
* | ||
* @return \cweagans\Composer\Resolvers\ResolverBase[] | ||
*/ | ||
public function getResolvers(); | ||
} |
Oops, something went wrong.