src/Google/AdsApi/AdManager/Util/v201805/Pql.php
public static function createValue($value)
    {
        if ($value instanceof Value) {
            return $value;
        } elseif (is_bool($value)) {
            return new BooleanValue($value);
        } elseif (is_float($value) || is_int($value)) {
            return new NumberValue(strval($value));
        } elseif (is_string($value)) {
            return new TextValue($value);
        } elseif ($value instanceof AdManagerDateTime) {
            return new DateTimeValue($value);
        } elseif ($value instanceof Date) {
            return new DateValue($value);
        } elseif (is_array($value)) {
            $values = [];
            foreach ($value as $valueEntry) {
                $values[] = self::createValue($valueEntry);
            }
            $setValue = new SetValue();
            $setValue->setValues($values);

            return $setValue;
        } elseif ($value instanceof Targeting) {
            return new TargetingValue($value);
        } else {
            throw new InvalidArgumentException(
                sprintf(
                    'Unsupported value type [%s]',
                    is_object($value) ? get_class($value) : gettype($value)
                )
            );
        }
    }
public static function createValue($value)
    {
        if ($value instanceof Value) {
            return $value;
        } elseif (is_bool($value)) {
            return new BooleanValue($value);
        } elseif (is_float($value) || is_int($value)) {
            return new NumberValue(strval($value));
        } elseif (is_string($value)) {
            return new TextValue($value);
        } elseif ($value instanceof AdManagerDateTime) {
            return new DateTimeValue($value);
        } elseif ($value instanceof Date) {
            return new DateValue($value);
        } elseif (is_array($value)) {
            $values = [];
            foreach ($value as $valueEntry) {
                $values[] = self::createValue($valueEntry);
            }
            $setValue = new SetValue();
            $setValue->setValues($values);

            return $setValue;
        } elseif ($value instanceof Targeting) {
            return new TargetingValue($value);
        } else {
            throw new InvalidArgumentException(
                sprintf(
                    'Unsupported value type [%s]',
                    is_object($value) ? get_class($value) : gettype($value)
                )
            );
        }
    }
public static function createValue ( $ value ) { if ( $ value instanceof Value ) { return $ value ; } elseif ( is_bool ( $ value ) ) { return new BooleanValue ( $ value ) ; } elseif ( is_float ( $ value ) || is_int ( $ value ) ) { return new NumberValue ( strval ( $ value ) ) ; } elseif ( is_string ( $ value ) ) { return new TextValue ( $ value ) ; } elseif ( $ value instanceof AdManagerDateTime ) { return new DateTimeValue ( $ value ) ; } elseif ( $ value instanceof Date ) { return new DateValue ( $ value ) ; } elseif ( is_array ( $ value ) ) { $ values = [ ] ; foreach ( $ value as $ valueEntry ) { $ values [ ] = self :: createValue ( $ valueEntry ) ; } $ setValue = new SetValue ( ) ; $ setValue -> setValues ( $ values ) ; return $ setValue ; } elseif ( $ value instanceof Targeting ) { return new TargetingValue ( $ value ) ; } else { throw new InvalidArgumentException ( sprintf ( 'Unsupported value type [%s]' , is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ) ) ; } }
Creates a PQL `Value` from the specified value.

For example:
- A `TextValue` for a value of type `string`.
- A `BooleanValue` for type `bool`.
- A `NumberValue` for type `float` or `int`.
- A `DateTimeValue` for type Ad Manager `DateTime`
- A `DateValue` for type Ad Manager `Date`
- A `SetValue` for type `array`.

If the specified value is already a PQL `Value`, the value is returned.

@param mixed $value the value to convert to a PQL value
@return Value a PQL value of the appropriate type
@throws InvalidArgumentException if value cannot be converted
Creates a PQL Value from the specified value .