original_string: protected function toScalar($value)
      {
          if (is_scalar($value)) {
              return $value;
          } elseif (null === $value) {
              return 'NULL';
          } else {
              if (is_object($value)) {
                  if (is_callable([$value, '__toString'])) {
                      return (string) $value;
                  } elseif ($value instanceof \DateTimeInterface) {
                      return $value->format('Y-m-d H:i:s');
                  } else {
                      throw new \InvalidArgumentException(sprintf("Cast of class %s is impossible", get_class($value)));
                  }
              } else {
                  throw new \InvalidArgumentException(sprintf("Cast of type %s is impossible", gettype($value)));
              }
          }
      }
code: protected function toScalar($value)
      {
          if (is_scalar($value)) {
              return $value;
          } elseif (null === $value) {
              return 'NULL';
          } else {
              if (is_object($value)) {
                  if (is_callable([$value, '__toString'])) {
                      return (string) $value;
                  } elseif ($value instanceof \DateTimeInterface) {
                      return $value->format('Y-m-d H:i:s');
                  } else {
                      throw new \InvalidArgumentException(sprintf("Cast of class %s is impossible", get_class($value)));
                  }
              } else {
                  throw new \InvalidArgumentException(sprintf("Cast of type %s is impossible", gettype($value)));
              }
          }
      }
code_tokens: protected function toScalar ( $ value ) { if ( is_scalar ( $ value ) ) { return $ value ; } elseif ( null === $ value ) { return 'NULL' ; } else { if ( is_object ( $ value ) ) { if ( is_callable ( [ $ value , '__toString' ] ) ) { return ( string ) $ value ; } elseif ( $ value instanceof \ DateTimeInterface ) { return $ value -> format ( 'Y-m-d H:i:s' ) ; } else { throw new \ InvalidArgumentException ( sprintf ( "Cast of class %s is impossible" , get_class ( $ value ) ) ) ; } } else { throw new \ InvalidArgumentException ( sprintf ( "Cast of type %s is impossible" , gettype ( $ value ) ) ) ; } } }
docstring: Attempt to convert non-scalar values.
  
  @param $value
  @return string
docstring_tokens: Attempt to convert non - scalar values .