Prefer the given option if already set. Otherwise set the value given.

@param array  &$arr   This is modified in place
@param string $option the key in the $arr array
@param mixed  $value  the new value if the option wasn't set already
165759
private function setOptionIfNotSet(&$arr, $option, $value)
    {
        if ($this->isOptionSet($arr, $option)) {
            $arr[$option] = $value;
        }
    }
961468
private function processField($value, array $option)
    {
        if($this->continue) {
            $cell = $this->unescapeEnclosure($value, $option['enclosure']);
            $this->joinCell($this->revert . $cell);
        } else {
            $cell = rtrim($value);
            $cell = $this->unescapeEnclosure($cell, $option['enclosure']);
            $this->setCell($cell);
            $this->col++;
        }
    }
702099
public static function setOptionalValue( Option &$option, $arg )
    {
        if ( !self::isShortCode( $arg ) && !self::isLongCode( $arg ) )
        {
            if ( is_bool( $arg ) )
            {
                $option->value = ( bool )$arg;
            }
            elseif ( is_string( $arg ) )
            {
                $arg = trim( $arg );
            
                $option->value = $arg;
            }
        }
    }
155091
public function setDefaultOption($option, $value)
    {
        if (! array_key_exists($option, $this->options)) {
            throw new UnexpectedValueException("Unexpected MoipClient {$option} option");
        }

        $this->options[$option] = $value;
    }
1211443
public static function set(&$arr, $str_path, $value) {
		$path = explode('.', $str_path);
		static::array_set($arr, $path, $value);
	}
1265924
public function setOption($key, $value=null)
    {
        if (is_array($key)) {
            $opts = static::_parseOptions($key);
            $this->options = array_merge($this->options, $opts);
        } else {
            $options = static::_parseOptions([$key => $value]);
            $this->options = array_merge($this->options, $opts);
        }
        
        return $this;
    }
728378
public function push($option, $value)
	{
		if ( ! is_string($option))
		{
			throw new \InvalidArgumentException('The option value must be a string type.');
		}
		
		$this->heap[$option][] = $value;
	}
720989
public function setOption($option, $value = null)
    {
        if (is_array($option)) { // If it's an array, loop through each option and call this method recursively.
            foreach ($option as $opt => $val) {
                $this->setOption($opt, $val);
            }
            return;
        }

        if (array_key_exists($option, $this->defaults)) { // If it is a default value.
            throw new ProtectedOptionException(sprintf('Unable to set protected option #%u', $option));
        }

        if (curl_setopt($this->handle, $option, $value) === false) {
            throw new CurlErrorException(sprintf('Couldn\'t set option #%u', $option));
        }
    }
1369262
public static function addValue(array &$arr, $key, $value)
    {
        if (isset($arr[$key])) {
            if (!is_array($arr[$key])) {
                $arr[$key] = [$arr[$key]];
            }
            $arr[$key][] = $value;
        }
        else {
            $arr[$key] = $value;
        }
    }
559689
public function setJsonValue(array $value)
    {
        // Removing colons from value.
        $value = str_replace(
            ':',
            '',
            $value
        );

        if (1 === count($value)) {
            $this->setValue(reset($value));
        } else {
            $this->setValue($value);
        }
    }
330647
public function setOption($option, $value) {
        switch ($option) {
            case self::OPT_THREAD_FLAGS:
                $this->setThreadStartFlags($value); break;
            case self::OPT_POOL_SIZE_MIN:
                $this->setPoolSizeMin($value); break;
            case self::OPT_POOL_SIZE_MAX:
                $this->setPoolSizeMax($value); break;
            case self::OPT_TASK_TIMEOUT:
                $this->setTaskTimeout($value); break;
            case self::OPT_IDLE_WORKER_TIMEOUT:
                $this->setIdleWorkerTimeout($value); break;
            case self::OPT_EXEC_LIMIT:
                $this->setExecutionLimit($value); break;
            case self::OPT_IPC_URI:
                $this->setIpcUri($value); break;
            case self::OPT_UNIX_IPC_DIR:
                $this->setUnixIpcSocketDir($value); break;
            default:
                throw new \DomainException(
                    sprintf('Unknown option: %s', $option)
                );
        }

        return $this;
    }
1200989
protected function setOptional($key, $value) {
        if (!$this->has($key))
            $this->set($key, $value);
    }
276467
function setValue($value) {
        $values = (array) $value;
        foreach ($values as $onevalue) {
            if (($this->tags || $this->ajax) &&
                    (!$this->optionExists($onevalue)) &&
                    ($onevalue !== '_qf__force_multiselect_submission')) {
                $this->addOption($onevalue, $onevalue);
            }
        }
        return parent::setValue($value);
    }
1027203
public function configure($option, $value)
    {
        // Dumpy won't let you add any custom config options, only update the existing ones.
        if ( ! array_key_exists($option, $this->config)) {
            // Note: something really weird is going to happen if $option is, say, an array.
            throw new InvalidArgumentException("Invalid option name: {$option}");
        }

        // Note that:
        // 1) the passed value can be of any type and contain anything
        // 2) the option value will be overridden permanently, no way back
        $this->config[$option] = $value;
    }
149356
public function setOptions( array $options )
    {
        foreach ( $this->defaults as $option => $defaults ) {
            $this->values[$option] = ( array_key_exists($defaults['name'], $options) ) ? $options[$option] : $defaults['default'];
        }
    }
973625
public function setOption($option, $value)
    {
        $this->options[$option] = $value;
        curl_setopt($this->resource, $option, $value);

        return $this;
    }
241547
public static function setOption($key = "", $value = "") {
		
		if (empty($key)) {
			return false;
		}
		
		$arrayFinder = new ArrayFinder(self::$store);
		$arrayFinder->set($key, $value);
		self::$store = $arrayFinder->get();
		
	}