1 | <?php |
||
14 | class Manifest |
||
15 | { |
||
16 | /** |
||
17 | * The list of updates in the manifest. |
||
18 | * |
||
19 | * @var Update[] |
||
20 | */ |
||
21 | private $updates; |
||
22 | |||
23 | /** |
||
24 | * Sets the list of updates from the manifest. |
||
25 | * |
||
26 | * @param Update[] $updates The updates. |
||
27 | */ |
||
28 | public function __construct(array $updates = array()) |
||
32 | |||
33 | /** |
||
34 | * Finds the most recent update and returns it. |
||
35 | * |
||
36 | * @param Version $version The current version. |
||
37 | * @param boolean $major Lock to major version? |
||
38 | * @param boolean $pre Allow pre-releases? |
||
39 | * |
||
40 | * @return Update The update. |
||
41 | */ |
||
42 | public function findRecent(Version $version, $major = false, $pre = false) |
||
69 | |||
70 | /** |
||
71 | * Returns the list of updates in the manifest. |
||
72 | * |
||
73 | * @return Update[] The updates. |
||
74 | */ |
||
75 | public function getUpdates() |
||
79 | |||
80 | /** |
||
81 | * Loads the manifest from a JSON encoded string. |
||
82 | * |
||
83 | * @param string $json The JSON encoded string. |
||
84 | * |
||
85 | * @return Manifest The manifest. |
||
86 | */ |
||
87 | public static function load($json) |
||
91 | |||
92 | /** |
||
93 | * Loads the manifest from a JSON encoded file. |
||
94 | * |
||
95 | * @param string $file The JSON encoded file. |
||
96 | * |
||
97 | * @return Manifest The manifest. |
||
98 | */ |
||
99 | public static function loadFile($file) |
||
103 | |||
104 | /** |
||
105 | * Validates the data, processes it, and returns a new instance of Manifest. |
||
106 | * |
||
107 | * @param array $decoded The decoded JSON data. |
||
108 | * |
||
109 | * @return Manifest The new instance. |
||
110 | */ |
||
111 | private static function create($decoded) |
||
137 | } |
||
138 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: