Make the (eventually not) callable base arg of this class callable.

@return callable

@throws ReflectionException
325525
protected function makeCallable()
    {
        if ($this->call instanceof Closure || $this->isFunction()) {
            return $this->call;
        }

        if ($this->isStaticMethod()) {
            return [$this->getCallClass(), $this->getCallMethod()];
        }

        return [$this->getCallInstance(), $this->getCallMethod()];

    }
500171
public function setCode(callable $code) {
        if (!is_callable($code)) {
            throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.');
        }

        if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
            $r = new \ReflectionFunction($code);
            if (null === $r->getClosureThis()) {
                $code = \Closure::bind($code, $this);
            }
        }

        $this->code = $code;

        return $this;
    }
662743
public static function call(callable $callable, $args=null)
    {

        if (!is_array($args)) {
            $args = $args === null ? [] : [$args];
        }

        return static::callFast($callable, static::evaluateArgs($args));

    }
505104
public function value()
    {

        // Get real arguments values from Argument instances
        $arguments = [];
        foreach ($this->arguments as $arg) {
            $arguments[] = $arg->value();
        }
        $this->arguments = $arguments;

        if ($this->value->startsWith('@')) {
            // Service can only be called in a NON-STATIC context
            $arguments = $this->arr($this->arguments)->count() > 0 ? $this->arguments : null;

            return ServiceManager::getInstance()->getService($this->value->val(), $arguments);
        } else {
            // CLASS can be instantiated or called statically
            $value = $this->value->val();
            if (class_exists($value) && !$this->static) {
                $reflection = new \ReflectionClass($value);

                return $reflection->newInstanceArgs($this->arguments);
            } elseif (class_exists($value) && $this->static) {
                // Return class name for static call
                return $this->value->val();
            }
            throw new ServiceManagerException(ServiceManagerException::SERVICE_CLASS_DOES_NOT_EXIST, [$this->value]);
        }
    }
731598
public function callMe()
    {
        $output = $this->dispatchStartEvent();

        /** @var \Brainworxx\Krexx\Service\Reflection\ReflectionClass $ref */
        $ref = $this->parameters[static::PARAM_REF];
        $data = $ref->getData();

        $refProps = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
        $publicProps = array();

        // Adding undeclared public properties to the dump.
        // Those are properties which are not visible with
        // ReflectionProperty::IS_PUBLIC
        // but are in get_object_vars
        //
        // 1. Make a list of all properties
        // 2. Remove those that are listed in
        // ReflectionProperty::IS_PUBLIC
        //
        // What is left are those special properties that were dynamically
        // set during runtime, but were not declared in the class.
        foreach ($refProps as $refProp) {
            $publicProps[$refProp->name] = true;
        }

        // For every not-declared property, we add a another reflection.
        // Those are simply added during runtime
        foreach (array_keys(array_diff_key(get_object_vars($data), $publicProps)) as $key) {
            $refProps[] = new UndeclaredProperty($ref, $key);
        }

        if (empty($refProps) === true) {
            return $output;
        }

        usort($refProps, array($this, 'reflectionSorting'));
        // Adding a HR to reflect that the following stuff are not public
        // properties anymore.
        return $output .
            $this->getReflectionPropertiesData($refProps, $ref) .
            $this->pool->render->renderSingeChildHr();
    }
708819
public function generate()
	{
		$args = func_get_args();
		$useKeyLength = array_shift($args);

		if (!is_bool($useKeyLength)) {
			array_unshift($args, $useKeyLength);
			$useKeyLength = false;
		}

		$callables = call_user_func_array(array($this, 'flattenArguments'), $args);

		$key = $this->keygen($useKeyLength ? $this->length : $this->getAdjustedKeyLength());

		while ($callable = current($callables)) {
			if (is_callable($callable)) {
				$key = call_user_func($callable, $key);
			}
			next($callables);
		}

		return sprintf("%s%s%s", $this->prefix, $key, $this->suffix);
	}
1069905
public static function fromCallable(callable $callable)
    {
        $reflection = Reflection::fromCallable($callable);

        return new self(
                $callable,
                $reflection,
                FunctionSignature::fromReflection($reflection),
                FunctionLocation::fromReflection($reflection),
                FunctionScope::fromReflection($reflection, $callable));
    }
233961
public function make()
    {
        if (($params = $this->canBuild())) {
            $reflectionClass = new \ReflectionClass($this->className);
            $object = $reflectionClass->newInstanceArgs(is_array($params) ? $params : []);
            /**
             * Reset the object by removing default values used for typehinting
             * Then add our dependancies
             */
            $this->resetObject($object);
            foreach ($this->params as $key => $value) {
                $object->with($value, (is_numeric($key) ? null : $key));
            }
            $object->freeze();
            return $object;
        }
        return $this;
    }
896874
public function invoke(Callable $callable)
	{
		$reflection = $this->reflectCallable($callable);

		$args = [];

		foreach($reflection->getParameters() as $param) {
			$type = $param->getClass()->getName();

			if (in_array($type, $this->resolving)) {
				throw new \LogicException("Recursive dependency: $type is currently instatiating.");
			}

			$args[] = ($param->allowsNull() && !isset($this[$type])) ? null : $this[$type];
		}

		return call_user_func_array($callable, $args);
	}
1312782
public static function createFromCallable(callable $callback): \ReflectionFunctionAbstract
    {
        if (\is_array($callback)) {
            return new \ReflectionMethod($callback[0], $callback[1]);
        }

        if (\is_object($callback)) {
            return new \ReflectionMethod($callback, '__invoke');
        }

        return new \eflectionFunction($callback);
    }
199431
private function createReflection(callable $callable)
    {
        if (is_string($callable) && strpos($callable, '::')) {
            $callable = explode('::', $callable);
        }

        if (is_array($callable)) {
            return new ReflectionMethod($callable[0], $callable[1]);
        }

        if (is_object($callable) && method_exists($callable, '__invoke')) {
            return new ReflectionMethod($callable, '__invoke');
        }

        return new ReflectionFunction($callable);
    }
1357232
protected function doValidate()
    {
        if ($this->argumentTypes === false) {
            throw new CallableFunctionValidatorException('Variable $argumentTypes must be defined.');
        }

        $argumentCount = count($this->argumentTypes);

        $reflectionFunction = new \ReflectionFunction($this->callableFunction);
        $reflectionParams = $reflectionFunction->getParameters();

        // Checking argument count.
        if (count($reflectionParams) != $argumentCount) {
            throw new CallableFunctionValidatorException(sprintf(
                'There is not sufficient argument count (required %s arguments).', $argumentCount
            ));
        }

        // Checking argument types.
        foreach ($this->argumentTypes as $k => $type) {
            if (!array_key_exists('type', $type)) {
                throw new \InvalidArgumentException('Key "type" must be defined.');
            }

            $parameter = $reflectionParams[$k];
            $class = $parameter->getClass();

            if ($type['type'] !== null) {
                if ($class === null || $type['type'] !== $class->getName()) {
                    throw new CallableFunctionValidatorException(sprintf(
                        'Argument %s must be type of "%s".', $k, $type['type']
                    ));
                }
            }

            if (array_key_exists('array', $type) && $type['array'] === true) {
                if ($class !== null) {
                    throw new CallableFunctionValidatorException(sprintf('Argument %s must be type of null.', $k));
                }

                if (!$parameter->isArray()) {
                    throw new CallableFunctionValidatorException(sprintf('Argument %s must be an array.', $k));
                }
            }
        }
    }
1118107
public function isCallable()
    {
        if ($this->isCallable === null) {
            $this->isCallable = is_callable($this->native, false);
        }
        return $this->isCallable;
    }
821898
public function call()
    {
        $args = func_get_args();
        $service = array_shift($args);
        if (!is_array($service)) {
            throw new \RuntimeException("Expected an array");
        }
        if (!is_callable($service[0])) {
            throw new \InvalidArgumentException("Can not use service '{$service[0]}' as a function, it is not callable");
        }

        // if the service needs the container, it is specified in the decl() call as the second param:
        if ($service[1]) {
            array_unshift($args, $this);
        }
        return call_user_func_array($service[0], $args);
    }
1348216
final public function makeArrayGetterCallable()
    {
        $getters = [];

        foreach ($this->parts as $part) {
            $getters[] = $part->createArrayGetterCallable();
        }

        return function (array $objects) use ($getters) {
            $results = $objects;

            foreach ($getters as $getter) {
                $results = $getter($results);
            }

            return $results;
        };
    }
913768
public function build(): EvaluateOnCallFrameRequest
	{
		$instance = new EvaluateOnCallFrameRequest();
		if ($this->callFrameId === null) {
			throw new BuilderException('Property [callFrameId] is required.');
		}
		$instance->callFrameId = $this->callFrameId;
		if ($this->expression === null) {
			throw new BuilderException('Property [expression] is required.');
		}
		$instance->expression = $this->expression;
		$instance->objectGroup = $this->objectGroup;
		$instance->includeCommandLineAPI = $this->includeCommandLineAPI;
		$instance->silent = $this->silent;
		$instance->returnByValue = $this->returnByValue;
		$instance->generatePreview = $this->generatePreview;
		$instance->throwOnSideEffect = $this->throwOnSideEffect;
		$instance->timeout = $this->timeout;
		return $instance;
	}
180249
protected function getLoggerCallable()
    {
        if (!is_callable($this->loggerCallable)) {
            $loggerCallable = $this->getOption('logger_callable');

            if (is_callable($loggerCallable)) {
                $this->loggerCallable = $loggerCallable;
            }
        }

        return $this->loggerCallable;
    }