From f8a37ac03de9eeaf4f21f36d42cceb4e4ad71939 Mon Sep 17 00:00:00 2001 From: Luke Swanson Date: Tue, 4 Jun 2024 23:44:05 -0500 Subject: [PATCH] Hilariously managed to do ternary operator backwards. Too much time doing it in Python. --- site/models/APIResponse.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/site/models/APIResponse.php b/site/models/APIResponse.php index d6aed1e..f08a2d1 100644 --- a/site/models/APIResponse.php +++ b/site/models/APIResponse.php @@ -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); }