Resolve the given parameter binding.

@param  string  $key
@param  string  $value
@param  array  $callbackParameters
@return mixed
336448
protected function resolveBinding($key, $value, $callbackParameters)
    {
        $newValue = $this->resolveExplicitBindingIfPossible($key, $value);

        return $newValue === $value ? $this->resolveImplicitBindingIfPossible(
            $key, $value, $callbackParameters
        ) : $newValue;
    }
1062797
public static function apply($key, $callback, $default = NULL) {
		$value = self::get ( $key, $default );
		if (is_string ( $callback ) && function_exists ( $callback )) {
			$value = call_user_func ( $callback, $value );
		} elseif (is_callable ( $callback )) {
			$value = $callback ( $value );
		} else {
			return $value;
		}
		return self::set ( $key, $value );
	}
586983
public function bindParams($name, $value=null) {
        
        if (is_array($name)) {
            foreach ($name as $k=>$v) {
                $this->binds[':'.$k]  =   $v;
            }
        } elseif ($value) {
            $this->binds[':'.$name] = $value;
        }
        
        return $this;
    }
1252935
private function parseParameter(string $key, string $value, &$params): string
    {
        if (isset($params[$key])) {
            $par = $params[$key];
            unset($params[$key]);

            $value = $value ? $value . '_' . $par : $par;
        }

        return static::makeParam($key, $value);
    }
1295270
public function resolve($key) {
        if (!array_key_exists($key, $this->bindings)) {
            throw new InvalidArgumentException("{$key} is not bound.");
        }

        $binding = $this->bindings[$key];
        $value = $binding['value'];

        // singleton
        if ($value instanceof Closure) {
            return $value($this);
        }

        // anonymous object
        if (is_null($value) && class_exists('\\' . $key)) {
            return $this->make($key);
        }

        // labeled object
        if (is_string($value) && class_exists('\\' . $value)) {
            return $this->make($value);
        }

        return $value;
    }
130680
public static function callback($key = null, $callback)
    {
        // Get parameters for callback
        $callbackParams = func_get_args();
        unset($callbackParams[0], $callbackParams[1]);
        $callbackParams = array_values($callbackParams);

        // Get key if no key is given
        if (is_null($key)) {
            if (is_string($callback)) {
                $key = $callback;
            } elseif (is_array($callback)) {
                $keyArr = [];
                foreach ($callback as $k => $v) {
                    if (is_string($v)) {
                        $keyArr[] = $v;
                    } elseif (is_object($v)) {
                        $keyArr[] = get_class($v);
                    }
                }

                $key = implode('', $keyArr);
                if (count($keyArr) > 1) {
                    $method = array_pop($keyArr);
                    $key    = implode('/', $keyArr);
                    $key    .= '::' . $method;
                }

                unset($keyArr, $method);
            } elseif (is_object($callback) && $callback instanceof \Closure) {
                $key = 'closure';
            }
            $key = 'callback: ' . $key;
        }

        // Set default return value
        $returnValue = true;

        // Set error handler, to convert errors to exceptions
        set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) {
            throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
        });

        try {
            // Start output buffer to capture any output
            ob_start();

            // Start profiler
            self::start($key);

            // Execute callback, and get result
            $callbackResult = call_user_func_array($callback, $callbackParams);

            // Stop profiler
            self::stop($key);

            // Get and clean output buffer
            $callbackOutput = ob_get_clean();
        } catch (\ErrorException $callbackException) {
            // Stop and clean output buffer
            ob_end_clean();

            // Show error message
            self::output('Invalid callback sent to Timer::callback: ' . str_replace('callback: ', '', $key));

            // Clear the item from the collection
            unset(self::$collection[$key]);

            // Clear callback result and output
            unset($callbackResult, $callbackOutput);

            // Set return value to false
            $returnValue = false;
        }

        // Restore error handler
        restore_error_handler();

        // Return result, output or true
        return (isset($callbackResult) ? $callbackResult : (!empty($callbackOutput) ? $callbackOutput : $returnValue));
    }
471434
private function bind($key, $value, $bindDataType)
    {
        $this->sqlQuery->bindValue($key, $value, $bindDataType);
    }
1226959
public static function table($table, $value, $key = 'id', \Closure $whereCallback = null, $connection = null)
    {
        $query = DB::connection($connection)
                   ->table($table)
                   ->select("{$value} as label", "{$key} as value");

        if ($whereCallback) {
            $query->where($whereCallback);
        }

        return $query->get();
    }
448654
public function getById($callbackId, array $queryParams = [])
    {
        $response = $this->api->callbacks()->getById($callbackId, $queryParams);

        return new CallbackResponse($response);
    }
1323784
protected function setParameter($key, $value)
    {
        if (is_array($value) && isset($value['value'])) {
            $value = $value['value'];
        }

        $this->parameters->set($key, $value);

        return $this;
    }
550071
public function setParam($key, $value = null)
    {
        if (!$this->hasParam($key)) {
            throw new \InvalidArgumentException(sprintf('Cannot set %s as parameter cause this key does not exist.', $key));
        }

        if (is_object($value)) {
            throw new \InvalidArgumentException('Parameter\'s value cannot be type of object.');
        }

        $currentValue = $this->getParamValue($key);
        if (
            (null !== $value && null !== $currentValue)
            && (
                gettype($value) !== gettype($currentValue)
                && (
                    !(is_string($value) || is_integer($value))
                    || !(is_string($currentValue) || is_integer($currentValue))
                )
            )
        ) {
            throw new \InvalidArgumentException(sprintf(
                'Cannot replace %s\'s value, %s expected and %s given.',
                $key,
                gettype($currentValue),
                gettype($value)
            ));
        }

        if (null === $value) {
            unset($this->_parameters[$key]);
        } else {
            $this->_parameters[$key] = ['value' => $value];
        }

        return $this->getContentInstance();
    }
220506
public function model( $key, $class, Closure $callback = null )
	{
		$this->bind( $key, function ( $value ) use ( $class, $callback )
		{
			if ( is_null( $value ) )
				return null;

			// For model binders, we will attempt to retrieve the models using the first
			// method on the model instance. If we cannot retrieve the models we'll
			// throw a not found exception otherwise we will return the instance.
			$instance = UniversalBuilder::resolve( $class );

			if ( $model = $instance->where( $instance->getRouteKeyName(), $value )->first() )
				return $model;

			// If a callback was supplied to the method we will call that to determine
			// what we should do when the model is not found. This just gives these
			// developer a little greater flexibility to decide what will happen.
			if ( $callback instanceof Closure )
				return call_user_func( $callback, $value );

			throw new NotFoundHttpException;
		} );
	}
525897
public function withQueryParameter($key, $value)
    {
        $query = $this->getUri()->getQuery();
        parse_str($query, $params);
        $params[$key] = $value;

        return new self(
            $this->getMethod(),
            $this->getUri()->withQuery(http_build_query($params)),
            $this->getHeaders(),
            $this->getBody(),
            $this->getProtocolVersion(),
            $this->getRetries(),
            $this->getOptions(),
            $this->getServiceKey(),
            $this->getRequestKey()
        );
    }
193393
public static function tap($value, $callback = null)
	{
		if(is_null($callback))
		{
			return new HigherOrderTapProxy($value);
		}
		$callback($value);
		return $value;
	}
1097121
private function convert($value, $type, array $options, array $convertCallbacks)
    {
        if (null === $value) {
            return ParameterModel::TYPE_STRING === $type ? '' : null;
        }
        if (!isset($convertCallbacks[$type])) {
            return $value;
        }

        $callback = $convertCallbacks[$type];

        return is_string($callback) ? $callback($value) : $callback($value, $options);
    }
264721
public function withKey($key, $value, callable $callable)
    {
        $initialValue = $this->get($key);
        try {
            $this->set($key, $value);

            return $callable();
        } finally {
            $this->set($key, $initialValue);
        }
    }
1167565
public function unless($value, $callback, $default = null)
    {
        if (! $value) {
            return $callback($this, $value) ?: $this;
        } elseif ($default) {
            return $default($this, $value) ?: $this;
        }

        return $this;
    }