1 | <?php namespace Arcanedev\Composer\Entities\PackageTraits; |
||
13 | trait RequiresTrait |
||
14 | { |
||
15 | /* ------------------------------------------------------------------------------------------------ |
||
16 | | Properties |
||
17 | | ------------------------------------------------------------------------------------------------ |
||
18 | */ |
||
19 | /** @var \Arcanedev\Composer\Utilities\Logger $logger */ |
||
20 | protected $logger; |
||
21 | |||
22 | /** @var \Composer\Package\CompletePackage $package */ |
||
23 | protected $package; |
||
24 | |||
25 | /* ------------------------------------------------------------------------------------------------ |
||
26 | | Main Functions |
||
27 | | ------------------------------------------------------------------------------------------------ |
||
28 | */ |
||
29 | /** |
||
30 | * Merge require into a RootPackage. |
||
31 | * |
||
32 | * @param \Composer\Package\RootPackageInterface $root |
||
33 | * @param \Arcanedev\Composer\Entities\PluginState $state |
||
34 | */ |
||
35 | protected function mergeRequires(RootPackageInterface $root, PluginState $state) |
||
55 | |||
56 | /** |
||
57 | * Merge require-dev into RootPackage. |
||
58 | * |
||
59 | * @param \Composer\Package\RootPackageInterface $root |
||
60 | * @param \Arcanedev\Composer\Entities\PluginState $state |
||
61 | */ |
||
62 | protected function mergeDevRequires(RootPackageInterface $root, PluginState $state) |
||
82 | |||
83 | /* ------------------------------------------------------------------------------------------------ |
||
84 | | Other Functions |
||
85 | | ------------------------------------------------------------------------------------------------ |
||
86 | */ |
||
87 | /** |
||
88 | * Extract and merge stability flags from the given collection of |
||
89 | * requires and merge them into a RootPackage. |
||
90 | * |
||
91 | * @param \Composer\Package\RootPackageInterface $root |
||
92 | * @param \Composer\Package\Link[] $requires |
||
93 | */ |
||
94 | protected function mergeStabilityFlags(RootPackageInterface $root, array $requires) |
||
105 | |||
106 | /** |
||
107 | * Merge two collections of package links and collect duplicates for subsequent processing. |
||
108 | * |
||
109 | * @param \Composer\Package\Link[] $origin Primary collection |
||
110 | * @param array $merge Additional collection |
||
111 | * @param bool $replace Replace existing links ? |
||
112 | * @param array $duplicateLinks Duplicate storage |
||
113 | * |
||
114 | * @return \Composer\Package\Link[] Merged collection |
||
115 | */ |
||
116 | private function mergeLinks(array $origin, array $merge, $replace, array &$duplicateLinks) |
||
132 | |||
133 | /** |
||
134 | * Update Links with a 'self.version' constraint with the root package's version. |
||
135 | * |
||
136 | * @param string $type |
||
137 | * @param array $links |
||
138 | * @param \Composer\Package\RootPackageInterface $root |
||
139 | * |
||
140 | * @return array |
||
141 | */ |
||
142 | abstract protected function replaceSelfVersionDependencies( |
||
145 | |||
146 | /** |
||
147 | * Get a full featured Package from a RootPackageInterface. |
||
148 | * |
||
149 | * @param \Composer\Package\RootPackageInterface|\Composer\Package\RootPackage $root |
||
150 | * @param string $method |
||
151 | * |
||
152 | * @return \Composer\Package\RootPackageInterface|\Composer\Package\RootPackage |
||
153 | */ |
||
154 | abstract protected function unwrapIfNeeded( |
||
157 | } |
||
158 |