1 | <?php |
||
11 | class PackagistService |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @var Composer\Composer |
||
16 | */ |
||
17 | private $composer; |
||
18 | |||
19 | /** |
||
20 | * @var Composer\Repository\RepositoryInterface |
||
21 | */ |
||
22 | private $repository; |
||
23 | |||
24 | public function __construct() |
||
29 | |||
30 | /** |
||
31 | * @return Composer\Composer |
||
32 | */ |
||
33 | public function getComposer() |
||
37 | |||
38 | /** |
||
39 | * Gets all SilverStripe packages. |
||
40 | * |
||
41 | * @return Packagist\Api\Package[] |
||
42 | */ |
||
43 | public function getPackages() |
||
62 | |||
63 | /** |
||
64 | * Gets all SilverStripe packages, grouped by package name. |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function getGroupedPackages() |
||
84 | |||
85 | /** |
||
86 | * Gets detailed information for a package. |
||
87 | * |
||
88 | * @param string $name |
||
89 | * @return array |
||
90 | */ |
||
91 | public function getPackageDetails($name) |
||
95 | |||
96 | /** |
||
97 | * Gets all versions of a package by name. |
||
98 | * |
||
99 | * @param $name |
||
100 | * @return \Composer\Package\PackageInterface[] |
||
101 | */ |
||
102 | public function getPackageVersions($name) |
||
115 | } |
||
116 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: