<commit_before><?php 

class SerwisantOrder
{
  private $token;
  
  private $data_fetched = false;
  private $data;
  
  public function setToken($token)
  {
    $this->token = $token;
  }
  
  private function get()
  {
    if ($this->data_fetched) {
      return;
    }
    
    $this->data_fetched = true;
    
    try {
      $client = new SerwisantHttpClient();
      $client->get("/ca/{$this->token}.json");    
      
      $json = $client->getResponse();
      
      if (trim($json) && ($data = json_decode($json))) {
        $this->data = $data;
      }
    }
    catch (Exception $e) {
    
    }
  }
  
  public function found()
  {
    $this->get();
    return $this->data !== null;
  }
  
  public function __get($prop)
  {
    $this->get();
    return $this->data->{$prop};
  }
}<commit_msg>Problem z nie informowaniem o nieistniejącym zleceniu<commit_after><?php 

class SerwisantOrder
{
  private $token;
  
  private $data_fetched = false;
  private $data;
  private $errors;
  
  public function setToken($token)
  {
    $this->token = $token;
  }
  
  private function get()
  {
    if ($this->data_fetched) {
      return;
    }
    
    $this->data_fetched = true;
    
    try {
      $client = new SerwisantHttpClient();
      $client->get("/ca/{$this->token}.json");    
      
      $json = $client->getResponse();
      
      if (trim($json) && ($data = json_decode($json))) {
        if (isset($data->errors)) {
          $this->errors = $data->errors;
        }
        else {
          $this->data = $data;
        }
      }
    }
    catch (Exception $e) {
      $this->errors = array($e->getMessage());
    }
  }
  
  public function found()
  {
    $this->get();
    return $this->data !== null && $this->errors === null;
  }
  
  public function errors()
  {
    return $this->errors;
  }
  
  public function __get($prop)
  {
    $this->get();
    return $this->data->{$prop};
  }
}
{'fraction_non_alphanumeric': 0.16831683168316833, 'fraction_numerical': 0.0, 'mean_word_length': 2.0476190476190474, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '200417', 'n_tokens_mistral': 678, 'n_tokens_neox': 671, 'n_words': 126}