original_string: protected function castValue($value)
      {
          if (is_null($value)) {
              return $value;
          }
  
          if ($this->isElementOfDate() && $this->isDateCastable()) {
              return $this->fromDateTime($value);
          }
  
          switch ($this->getCast()) {
              case 'int':
              case 'integer':
                  return (int) $value;
              case 'real':
              case 'float':
              case 'double':
                  return (float) $value;
              case 'string':
                  return (string) $value;
              case 'bool':
              case 'boolean':
                  return (bool) $value;
              case 'object':
                  return $this->fromJson($value, true);
              case 'array':
              case 'json':
                  return $this->fromJson($value);
              case 'collection':
                  return new Collection($this->fromJson($value));
              case 'comma':
                  return $this->fromCommaSeparated($value);
              default:
                  return $value;
          }
      }
code: protected function castValue($value)
      {
          if (is_null($value)) {
              return $value;
          }
  
          if ($this->isElementOfDate() && $this->isDateCastable()) {
              return $this->fromDateTime($value);
          }
  
          switch ($this->getCast()) {
              case 'int':
              case 'integer':
                  return (int) $value;
              case 'real':
              case 'float':
              case 'double':
                  return (float) $value;
              case 'string':
                  return (string) $value;
              case 'bool':
              case 'boolean':
                  return (bool) $value;
              case 'object':
                  return $this->fromJson($value, true);
              case 'array':
              case 'json':
                  return $this->fromJson($value);
              case 'collection':
                  return new Collection($this->fromJson($value));
              case 'comma':
                  return $this->fromCommaSeparated($value);
              default:
                  return $value;
          }
      }
code_tokens: protected function castValue ( $ value ) { if ( is_null ( $ value ) ) { return $ value ; } if ( $ this -> isElementOfDate ( ) && $ this -> isDateCastable ( ) ) { return $ this -> fromDateTime ( $ value ) ; } switch ( $ this -> getCast ( ) ) { case 'int' : case 'integer' : return ( int ) $ value ; case 'real' : case 'float' : case 'double' : return ( float ) $ value ; case 'string' : return ( string ) $ value ; case 'bool' : case 'boolean' : return ( bool ) $ value ; case 'object' : return $ this -> fromJson ( $ value , true ) ; case 'array' : case 'json' : return $ this -> fromJson ( $ value ) ; case 'collection' : return new Collection ( $ this -> fromJson ( $ value ) ) ; case 'comma' : return $ this -> fromCommaSeparated ( $ value ) ; default : return $ value ; } }
docstring: Cast a value to a native PHP type.
  
  @param $value
  @return array
docstring_tokens: Cast a value to a native PHP type .