1 | <?php |
||
13 | class Release { |
||
14 | /** |
||
15 | * List of update statuses for dependencies |
||
16 | * |
||
17 | * @var Array |
||
18 | */ |
||
19 | private $update_statuses = array(); |
||
20 | |||
21 | /** |
||
22 | * Sets a logger |
||
23 | */ |
||
24 | public function __construct() { |
||
27 | |||
28 | /** |
||
29 | * Class entry point. Called externally via composer script |
||
30 | */ |
||
31 | public static function run() { |
||
47 | |||
48 | /** |
||
49 | * Handles root package update |
||
50 | * |
||
51 | * @param String $name package name. |
||
52 | */ |
||
53 | public function handle_package_update( $name ) { |
||
65 | |||
66 | /** |
||
67 | * Checks if user requested an update |
||
68 | * |
||
69 | * @param String $name repo name. |
||
70 | * @param String $tag latest released version. |
||
71 | * @param String $diff short diff of unreleased changes. |
||
72 | */ |
||
73 | public function is_update_requested( $name, $tag, $diff ) { |
||
80 | |||
81 | /** |
||
82 | * Loops through provided list of dependencies and tries to update them |
||
83 | * |
||
84 | * @param Array $list list of dependencies. |
||
85 | */ |
||
86 | public function handle_dependencies_updates( $list ) { |
||
96 | |||
97 | /** |
||
98 | * Run an actual package update |
||
99 | * |
||
100 | * @param String $name package name. |
||
101 | * @throws \Exception Invalid provided version. |
||
102 | */ |
||
103 | public function do_dependency_update( $name ) { |
||
126 | |||
127 | /** |
||
128 | * Prompts a polar (Y/N) question to a user, and returns a bool |
||
129 | * |
||
130 | * @param String $prompt question to ask. |
||
131 | * @throws \Exception Invalid response. |
||
132 | */ |
||
133 | public function handle_polar_question( $prompt ) { |
||
144 | |||
145 | |||
146 | /** |
||
147 | * Checks wether a package have some unreleased changes |
||
148 | * |
||
149 | * @param String $name repository name. |
||
150 | */ |
||
151 | public function is_update_possible( $name ) { |
||
180 | |||
181 | /** |
||
182 | * Walks through the dependency tree and builds a list of deps that needs to be updated |
||
183 | * This list is build in order from branch up to root, meaning it is the order that could be used for updating the whole tree in single run |
||
184 | * |
||
185 | * @param Array $object tree node. |
||
186 | */ |
||
187 | public function get_package_dependencies_to_update( $object ) { |
||
206 | } |
||
207 |
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: