1 | <?php |
||
34 | class PackageConverter |
||
35 | { |
||
36 | /** |
||
37 | * The root package of the installation. |
||
38 | * |
||
39 | * @var RootPackageInterface |
||
40 | */ |
||
41 | private $rootPackage; |
||
42 | |||
43 | /** |
||
44 | * Create a new instance. |
||
45 | * |
||
46 | * @param RootPackageInterface $rootPackage The root package of the installation. |
||
47 | */ |
||
48 | public function __construct(RootPackageInterface $rootPackage) |
||
52 | |||
53 | /** |
||
54 | * Create a new instance and return it. |
||
55 | * |
||
56 | * @param RootPackageInterface $rootPackage The root package of the installation. |
||
57 | * |
||
58 | * @return PackageConverter |
||
59 | */ |
||
60 | public static function create(RootPackageInterface $rootPackage) |
||
64 | |||
65 | /** |
||
66 | * Convert a package version into string representation. |
||
67 | * |
||
68 | * @param PackageInterface $package The package to extract the version from. |
||
69 | * |
||
70 | * @param bool $fullReference Flag if the complete reference shall be added or an abbreviated form. |
||
71 | * |
||
72 | * @return string |
||
73 | * |
||
74 | * @throws \RuntimeException If the package is a dev package and does not have valid reference information. |
||
75 | */ |
||
76 | public static function convertPackageVersion(PackageInterface $package, $fullReference = false) |
||
92 | |||
93 | /** |
||
94 | * Convert a package to array information used by json API. |
||
95 | * |
||
96 | * @param PackageInterface $package The package to convert. |
||
97 | * |
||
98 | * @param null|PackageInterface $upgrade The package to show as upgradable to. |
||
99 | * |
||
100 | * @return JsonArray |
||
101 | */ |
||
102 | public function convertPackageToArray(PackageInterface $package, PackageInterface $upgrade = null) |
||
130 | |||
131 | /** |
||
132 | * Convert the information of all packages in a repository to an array used by json API. |
||
133 | * |
||
134 | * @param RepositoryInterface $repository The repository holding the packages to convert. |
||
135 | * |
||
136 | * @param bool $requiredOnly If true, return only the packages added to the root package as require. |
||
137 | * |
||
138 | * @param RepositoryInterface $upgradeList The packages available as upgrades. |
||
|
|||
139 | * |
||
140 | * @return JsonArray |
||
141 | */ |
||
142 | public function convertRepositoryToArray( |
||
167 | |||
168 | /** |
||
169 | * Check if a package is locked. |
||
170 | * |
||
171 | * @param string $packageName The name of the package to test. |
||
172 | * |
||
173 | * @return bool |
||
174 | * |
||
175 | * @see ComposerJson::isLocked() |
||
176 | */ |
||
177 | private function isLocked($packageName) |
||
182 | |||
183 | /** |
||
184 | * Determine the constraint defined for a given package (if required via root project). |
||
185 | * |
||
186 | * @param string $packageName The name of the package to retrieve the constraint for. |
||
187 | * |
||
188 | * @return string|null |
||
189 | */ |
||
190 | private function getConstraint($packageName) |
||
208 | |||
209 | /** |
||
210 | * Convert the data of a complete package to the passed json array. |
||
211 | * |
||
212 | * @param CompletePackageInterface $package The package to process. |
||
213 | * |
||
214 | * @param JsonArray $data The json array to push the data to. |
||
215 | * |
||
216 | * @return void |
||
217 | */ |
||
218 | private function convertCompletePackage(CompletePackageInterface $package, $data) |
||
242 | } |
||
243 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.