Airship\Engine\Continuum\Updaters\Gadget::updateJSON PHP Method

updateJSON() public method

Update the version identifier stored in the gadgets.json file
public updateJSON ( UpdateInfo $info, array $metaData = [] )
$info UpdateInfo
$metaData array
    public function updateJSON(UpdateInfo $info, array $metaData = [])
    {
        if (!empty($metaData['cabin'])) {
            $gadgetConfigFile = ROOT . '/Cabin/' . $metaData['cabin'] . '/config/gadgets.json';
        } else {
            $gadgetConfigFile = ROOT . '/config/gadgets.json';
        }
        $gadgetConfig = \Airship\loadJSON($gadgetConfigFile);
        foreach ($gadgetConfig as $i => $gadget) {
            if ($gadget['supplier'] === $info->getSupplierName()) {
                if ($gadget['name'] === $info->getPackageName()) {
                    $gadgetConfig[$i]['version'] = $info->getVersion();
                    break;
                }
            }
        }
        \Airship\saveJSON($gadgetConfigFile, $gadgetConfig);
    }