ManaPHP\Di::set PHP Method

set() public method

Registers a service in the services container
public set ( string $name, mixed $definition, boolean $shared = false, array $aliases = [] ) : static
$name string
$definition mixed
$shared boolean
$aliases array
return static
    public function set($name, $definition, $shared = false, $aliases = [])
    {
        foreach ($aliases as $alias) {
            $this->_aliases[$alias] = $name;
        }
        if ($shared && is_string($definition)) {
            $this->_services[$name] = $definition;
        } else {
            $this->_services[$name] = [$definition, $shared];
        }
        return $this;
    }