Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a289e4f8 authored by Akhil's avatar Akhil 🙂 Committed by Florent VINCENT
Browse files

Set json_decode to output objects explicitly where needed

parent 1772b551
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ class ECloudAccountCreator implements AccountCreator
    public function __construct(string $ecloudUrl)
    {
        $this->ecloudUrl = endsWith($ecloudUrl, "/") ? $ecloudUrl : $ecloudUrl . "/";
        $this->ecloudAccountsApiUrl = $this->ecloudUrl . '/apps/ecloud-accounts/api/';
        $this->ecloudAccountsApiUrl = $this->ecloudUrl . 'apps/ecloud-accounts/api/';
    }

    public function validateData(object $userData): ValidatedData
@@ -76,7 +76,7 @@ class ECloudAccountCreator implements AccountCreator
        curl_setopt($ch, CURLOPT_URL, $this->ecloudAccountsApiUrl . 'set_account_data');
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
        $output = curl_exec($ch);
        $output = json_decode($output);
        $output = json_decode($output, false);
        $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

        $answer = new \stdClass;
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class GitlabAccountCreator implements AccountCreator
        if (!empty($err)) {
            throw new Error($err);
        }
        $res = json_decode($res);
        $res = json_decode($res, false);
        return $res->exists;
    }

@@ -73,7 +73,7 @@ class GitlabAccountCreator implements AccountCreator
            return $return;
        }
        if ($statusCode < 200 || $statusCode >=300) {
            $res = json_decode($res);
            $res = json_decode($res, false);
            $return->message = isset($res->message) ? $res->message : $res->error;
            return $return;
        }
+2 −2
Original line number Diff line number Diff line
@@ -57,10 +57,10 @@ function sendInviteMailWithPHPMail(string $to, string $signupURL, string $lang):
    $from = getenv("SMTP_FROM");
    if (file_exists("/var/www/html/invite_template/$lang.json")) {
        $content = file_get_contents("/var/www/html/invite_template/$lang.json");
        $template = json_decode($content);
        $template = json_decode($content, false);
    } else {
        $content = file_get_contents("/var/www/html/invite_template/en.json");
        $template = json_decode($content);
        $template = json_decode($content, false);
    }
    $subject = $template->subject;
    $headers = ['From' => $from, 'To' => $to, 'Subject' => $subject,
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ class WPAccountCreator implements AccountCreator
            return $return;
        }
        if ($statusCode < 200 || $statusCode >=300) {
            $res = json_decode($res);
            $res = json_decode($res, false);
            $return->message = $res->message;
            return $return;
        }