@@ -116,16 +116,16 @@ public function getModpack($modpack)
116116 $uri = 'modpack/'.$modpack.'?k=';
117117 $response = $this->handle($uri);
118118
119- if (array_key_exists('error', $response) || array_key_exists('status', $response))
120- {
121- if ($response['error'] == 'Modpack does not exist' || $response['status'] == '404') {
119+ if (array_key_exists('error', $response) || array_key_exists('status', $response)) {
120+ if (($response['error'] ?? null) == 'Modpack does not exist' || ($response['status'] ?? null) == '404') {
122121 throw new ResourceException('Modpack does not exist', 404);
123- } else if ($response['error'] == 'You are not authorized to view this modpack.' || $response['status'] == '401') {
122+ }
123+ if (($response['error'] ?? null) == 'You are not authorized to view this modpack.' || ($response['status'] ?? null) == '401') {
124124 throw new UnauthorizedException('You are not authorized to view this modpack.', 401);
125- } else {
126- throw new ResourceException('Got an unexpected response from Solder', 500);
127125 }
126+ throw new ResourceException('Got an unexpected response from Solder', 500);
128127 }
128+
129129 return new Modpack($response);
130130 }
131131
@@ -134,15 +134,14 @@ public function getBuild($modpack, $build)
134134 $uri = 'modpack/'.$modpack.'/'.$build.'?include=mods&k=';
135135 $response = $this->handle($uri);
136136
137- if (array_key_exists('error', $response) || array_key_exists('status', $response))
138- {
139- if ($response['error'] == 'Build does not exist' || $response['status'] == '404') {
137+ if (array_key_exists('error', $response) || array_key_exists('status', $response)) {
138+ if (($response['error'] ?? null) == 'Build does not exist' || ($response['status'] ?? null) == '404') {
140139 throw new ResourceException('Build does not exist', 404);
141- } else if ($response['error'] == 'You are not authorized to view this build.' || $response['status'] == '401') {
140+ }
141+ if (($response['error'] ?? null) == 'You are not authorized to view this build.' || ($response['status'] ?? null) == '401') {
142142 throw new UnauthorizedException('You are not authorized to view this build.', 401);
143- } else {
144- throw new ResourceException('Got an unexpected response from Solder', 500);
145143 }
144+ throw new ResourceException('Got an unexpected response from Solder', 500);
146145 }
147146
148147 return new Build($response);
0 commit comments