1 | <?php |
||
10 | class PackagistService |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var Composer\Composer |
||
15 | */ |
||
16 | private $composer; |
||
17 | |||
18 | /** |
||
19 | * @var Composer\Repository\RepositoryInterface |
||
20 | */ |
||
21 | private $repository; |
||
22 | |||
23 | public function __construct() |
||
28 | |||
29 | /** |
||
30 | * @return Composer\Composer |
||
31 | */ |
||
32 | public function getComposer() |
||
36 | |||
37 | /** |
||
38 | * Gets all SilverStripe packages. |
||
39 | * |
||
40 | * @return Packagist\Api\Package[] |
||
41 | */ |
||
42 | public function getPackages() |
||
61 | |||
62 | /** |
||
63 | * Gets all SilverStripe packages, grouped by package name. |
||
64 | * |
||
65 | * @return array |
||
66 | */ |
||
67 | public function getGroupedPackages() |
||
83 | |||
84 | /** |
||
85 | * Gets detailed information for a package. |
||
86 | * |
||
87 | * @param string $name |
||
88 | * @return array |
||
89 | */ |
||
90 | public function getPackageDetails($name) |
||
94 | |||
95 | /** |
||
96 | * Gets all versions of a package by name. |
||
97 | * |
||
98 | * @param $name |
||
99 | * @return \Composer\Package\PackageInterface[] |
||
100 | */ |
||
101 | public function getPackageVersions($name) |
||
114 | } |
||
115 |
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: