title: FatalThrowableError - Call to a member function getStatusCode() on null
body: <p>help?</p>
  
  <p>The last time I tested this, it was working but for some reason, when I tested it now, it gives me back this error?</p>
  
  <p>I call my function using this:</p>
  
  <pre><code>public function createPayment($uid,$api_uid,$limit)
  {
          $api = new CallFunction();
          $result = $api-&gt;pay($uid,$api_uid,$limit);
  }
  </code></pre>
  
  <p>This is my CallFunction script:</p>
  
  <pre><code> public  function pay(string $userid, string $apiuid, int $limiteos)
      {
         $client = null;
  
         $api_key = "api_key";
         $url = "http://www.payment.com/payment/order";
  
          $client = new Client();
          try
          {
  
              $data = ['method'=&gt;'create', 'user_id' =&gt; $userid, 'api_uid' =&gt; $apiuid, 'limit_eos_count' =&gt; $limiteos, 'api_key' =&gt; $api_key];
              $response = $client-&gt;post($url, ['query' =&gt; $data]);
              $result = json_decode($response-&gt;getBody()-&gt;getContents());
              return $result;
             // $this-&gt;accessToken = $result-&gt;access_token;
          }
          catch (RequestException $e)
          {
             // var_dump($e);
              $response = $this-&gt;StatusCodeHandling($e);
              return 0;
            //  echo "error";
          }
      }
  </code></pre>
  
  <p>The error points to this part of the code:</p>
  
  <pre><code>$response = $this-&gt;StatusCodeHandling($e);
  </code></pre>
  
  <p>My part of my StatusCodeHandling is this:</p>
  
  <pre><code>public function StatusCodeHandling($e)
      {
          if ($e-&gt;getResponse()-&gt;getStatusCode() == '400')
          {
          $this-&gt;prepare_access_token();
          }
          elseif ($e-&gt;getResponse()-&gt;getStatusCode() == '422')
          {
      }
  </code></pre>
  
  <p>And error shows me this line:</p>
  
  <pre><code>if ($e-&gt;getResponse()-&gt;getStatusCode() == '400')
  </code></pre>
  
  <p>Im having a hardtime debugging right now. It was working a few days ago?? Any heads up where I went wrong would be much appreciated!</p>