Split update info parsing to 2 functions
This commit is contained in:
parent
564ddb209a
commit
4bed14f093
@ -16,7 +16,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
function uupApiVersion() {
|
||||
return '0.6.1-beta';
|
||||
return '0.7.0-beta';
|
||||
}
|
||||
|
||||
function uupApiPrintBrand() {
|
||||
|
@ -26,6 +26,22 @@ function uupUpdateInfo($updateId, $onlyInfo = 0) {
|
||||
|
||||
$info = json_decode($info, true);
|
||||
|
||||
$parsedInfo = uupParseUpdateInfo($info, $onlyInfo);
|
||||
if(isset($parsedInfo['error'])) {
|
||||
return $parsedInfo['error'];
|
||||
}
|
||||
|
||||
return array(
|
||||
'apiVersion' => uupApiVersion(),
|
||||
'info' => $parsedInfo['info'],
|
||||
);
|
||||
}
|
||||
|
||||
function uupParseUpdateInfo($info, $onlyInfo = 0) {
|
||||
if(empty($info)) {
|
||||
return array('error' => 'UPDATE_INFORMATION_NOT_EXISTS');
|
||||
}
|
||||
|
||||
if($onlyInfo) {
|
||||
if(isset($info[$onlyInfo])) {
|
||||
$returnInfo = $info[$onlyInfo];
|
||||
|
Loading…
Reference in New Issue
Block a user