code: private function castValue($value)
      {
          if ($value instanceof \SimpleXMLElement) {
              return $this->castToArray((array)$value);
          } 
  
          if (is_array($value)) {
              return $this->castToArray($value);
          }
  
          if (is_numeric($value)) {
              return $value + 0;
          } 
  
          if (is_string($value) && in_array(strtolower($value), array('true', 'yes', 'on', 'false', 'no', 'off'))) {
              return filter_var($value, FILTER_VALIDATE_BOOLEAN);
          }
  
          return $value;
      }
docs: Cast the given $value to an array possible type.
  
  @param mixed $value
  
  @return mixed