Пример #1
0
 /**
  * returns found value.
  * this method returns values that maybe invalid.
  *
  * @param null|string $key
  * @return array|string|bool
  */
 public function get($key = null)
 {
     if (is_null($key)) {
         return $this->found;
     }
     if (array_key_exists($key, $this->found)) {
         return $this->found[$key];
     }
     $rules = array_key_exists($key, $this->rules) ? $this->rules[$key] : $this->ruler->withType('text');
     $found = $this->find($key, $rules);
     $valTO = $this->verify->apply($found, $rules);
     if ($valTO->fails()) {
         $found = $valTO->getValue();
         $message = $valTO->message();
         $this->isError($key, $message, $found);
         if (is_array($found)) {
             $this->_findClean($found, $message);
             return $found;
         }
         return false;
     }
     $this->set($key, $valTO->getValue());
     return $valTO->getValue();
 }