Kahlan\Box\Box::_service PHP Method

_service() protected method

Process a shared definition.
protected _service ( string $name, mixed $definition, array $params ) : mixed
$name string The name of the definition.
$definition mixed A definition.
$params array Parameters to pass to the definition.
return mixed
    protected function _service($name, $definition, $params)
    {
        if ($definition instanceof Closure) {
            $type = 'singleton';
            $definition = call_user_func_array($definition, $params);
            $this->_definitions[$name] = compact('definition', 'type');
        }
        return $definition;
    }