Skip to content

Commit

Permalink
Hilariously managed to do ternary operator backwards. Too much time d…
Browse files Browse the repository at this point in the history
…oing it in Python.
  • Loading branch information
LswaN58 committed Jun 5, 2024
1 parent 4bf2e8b commit f8a37ac
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions site/models/APIResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ public function __construct($type, $val, $msg, $status)
}

public static function fromObj($obj) {
$type = $obj->{'type'} ? isset($obj->{'type'}) : null;
$val = json_decode($obj->{'val'}) ? isset($obj->{'val'}) : null;
$msg = $obj->{'msg'} ? isset($obj->{'msg'}) : null;
$status = $obj->{'status'} ? isset($obj->{'status'}) : null;
$type = isset($obj->{'type'}) ? $obj->{'type'} : null;
$val = isset($obj->{'val'}) ? json_decode($obj->{'val'}) : null;
$msg = isset($obj->{'msg'}) ? $obj->{'msg'} : null;
$status = isset($obj->{'status'}) ? $obj->{'status'} : null;
return new static($type, $val, $msg, $status);
}

public static function fromJson($json) {
$obj = json_decode($json);
$type = $obj->{'type'} ? isset($obj->{'type'}) : null;
$val = json_decode($obj->{'val'}) ? isset($obj->{'val'}) : null;
$msg = $obj->{'msg'} ? isset($obj->{'msg'}) : null;
$status = $obj->{'status'} ? isset($obj->{'status'}) : null;
$type = isset($obj->{'type'}) ? $obj->{'type'} : null;
$val = isset($obj->{'val'}) ? json_decode($obj->{'val'}) : null;
$msg = isset($obj->{'msg'}) ? $obj->{'msg'} : null;
$status = isset($obj->{'status'}) ? $obj->{'status'} : null;
return new static($type, $val, $msg, $status);
}

Expand Down

0 comments on commit f8a37ac

Please sign in to comment.