Set an argument's value based on its command line entry.

Argument values are type cast based on the value of $castTo.

@param string|bool $value
344430
public function setValue($value)
    {
        $cast_method = 'castTo' . ucwords($this->castTo);
        $this->values[] = $this->{$cast_method}($value);
    }
270246
public function setValue($value)
    {
        if (\is_string($value)) {
            $this->value = $value;
        } elseif (\is_object($value) && $value instanceof self) {
            $this->value = $value->getValue();
        }

        throw new \InvalidArgumentException('Expected string');
    }
514226
function setValue( $value )
    {
        $this->Value = $value;
        if ( $value instanceof ggWebservicesFault || $value instanceof eZSOAPFault )
        {
            $this->IsFault = true;
            $this->FaultCode = $value->faultCode();
            $this->FaultString = $value->faultString();
        }
        else
        {
            $this->IsFault = false;
        }
    }
215201
public function cast($value)
    {
        if (isset($value) && !is_resource($value)) {
            return $this->dontCast($value);
        }
        
        return $value;
    }
777871
public function setValue($value)
    {
        $hasType = isset($this->_type) && is_string($this->_type);
        $isMultiple = $hasType && strpos($this->_type, '[]') !== false;

        if ($hasType) {
            $value = $this->_castToExpression($value, $this->_type);
        }

        if ($isMultiple) {
            list($value, $this->_valueExpressions) = $this->_collectExpressions($value);
        }

        $this->_isMultiple = $isMultiple;
        $this->_value = $value;
    }
98010
protected function setArgumentValue($argv, $argument, $key, $value)
    {
        // Arguments are given the value true if they only need to
        // be defined on the command line to be set.
        if ($argument->noValue()) {
            $argument->setValue(true);
            return $argv;
        }

        if (is_null($value)) {
            if (count($argv) === 0) {
                return $argv;
            }

            // If the value wasn't previously defined in "key=value"
            // format then define it from the next command argument.
            $nextArgvValue = $argv[$key + 1];
            if ($this->isValidArgumentValue($nextArgvValue)) {
                $argument->setValue($nextArgvValue);
                unset($argv[$key + 1]);
                return $argv;
            }
        }

        $argument->setValue($value);

        return $argv;
    }
488794
public static function set($option, $value)
    {
        if (!array_key_exists($option, self::$conf))
        {
            throw new InvalidArgumentException(sprintf('Unknown option "%s"', $option));
        }

        $expected = gettype(self::$conf[$option]);
        $actual = gettype($value);
        if ($expected != $actual)
        {
            throw new InvalidArgumentException(
                sprintf('Option "%s" has type "%s", but "%s" given',
                    $option, $expected, $actual)
            );
        }

        self::$conf[$option] = $value;
    }
1183006
protected function setValue($value)
    {
        if (!$this->validate($value)) {
            throw new \InvalidArgumentException(sprintf('%s is not a valid value', $value));
        }

        $this->value = $value;
    }
59965
public function setValue($value, $type = null)
    {
        $this->value = $value;
        $this->type  = $type ?: ParameterTypeInferer::inferType($value);
    }
1164945
protected function setValue($value)
    {
        if (is_string($value)) {
            $value = trim($value);
            if ($value !== "") {
                $this->value = $value;
            } else {
                throw new \InvalidArgumentException("Invalid value for argument 'value' given.");
            }
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($value) . "' for argument 'value' given. String expected."
            );
        }

        return $this;
    }
425736
public function setValue($value)
    {
        if ($value === Fallback::VALUE_TRUE) {
            $value = true;
        }

        if ($value === Fallback::VALUE_FALSE) {
            $value = false;
        }

        $this->value = $value;
        return $this;
    }
1077635
protected function setValue($value)
    {
        if (!is_int($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be an integer", static::prototype());
        }
        $this->value = $value;
    }
479320
public function setValue($value, bool $preserveSetStatus = false)
    {
        if (Type::hasOuterArray($this->type) or $this->type === 'array')
        {
            if ( ! $this->isSet())
            {
                $this->value = array();
            }

            $this->value[] = ($this->type !== 'array' ?
                Type::cast($value, $this->type)
                : $value
            );
        }
        else
        {
            $this->value = Type::cast($value, $this->type);
        }

        if ( ! $preserveSetStatus)
        {
            $this->set = true;
        }
    }
1046313
public function setValue($value)
    {
        // special case for boolean values
        if (is_bool($value)) {
            if ($value) {
                $this->_value = "true";
            } else {
                $this->_value = "false";
            }
        } else {
            $this->_value = (string) $value;
        }
    }
1271484
protected function castToBool($value, bool $nullable = true)
    {
        if (null === $value && $nullable) {
            return null;
        }

        return (bool) $value;
    }
244357
protected function cast( &$value, &$error )
    {
        if( $this->process & self::PROCESS_TRIM ) {
            $value = trim( (string) $value );
        }
        if( $this->process & self::PROCESS_UPPERCASE ) {
            $value = strtoupper( $value );
        }
        $value = (string) $value;
        if( $value === '' ) {
            $value = null;
        }
        return true;
    }
133331
public function castValue($value)
    {
        if ($value === 'Off' || $value === '' || $value === 0 || $value === '0' || $value === false) {
            $casted = 0;
        } elseif ($value === 'On' || $value === '1' || $value === 1) {
            $casted = 1;
        } else {
            $casted = $value;
        }

        $casted = $this->castPowers($casted);

        return $casted;
    }