#!/usr/bin/env php $error['message']])); } }); if ($memoryAlloc = getenv('DEPENDABOT_TEST_MEMORY_ALLOCATION')) { str_repeat('*', memoryInBytes($memoryAlloc)); } try { switch ($request['function']) { case 'update': $updatedFiles = Updater::update($request['args']); fwrite(STDOUT, json_encode(['result' => $updatedFiles])); error_clear_last(); break; case 'get_latest_resolvable_version': $latestVersion = UpdateChecker::getLatestResolvableVersion($request['args']); fwrite(STDOUT, json_encode(['result' => $latestVersion])); error_clear_last(); break; case 'get_content_hash': $content_hash = Hasher::getContentHash($request['args']); fwrite(STDOUT, json_encode(['result' => $content_hash])); error_clear_last(); break; default: fwrite(STDOUT, json_encode(['error' => "Invalid function {$request['function']}"])); exit(1); } } catch (\Exception $e) { fwrite(STDOUT, json_encode(['error' => $e->getMessage()])); error_clear_last(); exit(1); }