code: public function getRules()
      {
          if ($this->rules !== null) {
              return $this->rules;
          }
  
          $query = (new Query())->from($this->ruleTable);
  
          $rules = [];
          foreach ($query->all($this->db) as $row) {
              $data = $row['data'];
              if (is_resource($data)) {
                  $data = stream_get_contents($data);
              }
              $rules[$row['name']] = unserialize($data);
          }
  
          return $rules;
      }
docs: {@inheritdoc}