public function module($module)
    {
        if (is_object($module)) {
            if (!($module instanceof ModuleInterface)) {
                $moduleType = get_class($module);

                throw new InvalidArgumentException("Given module object '$moduleType' does not implement 'Depend\\Abstraction\\ModuleInterface'");
            }

            $module->register($this);

            return $this;
        }

        if (!class_exists((string) $module)) {
            throw new InvalidArgumentException("Given class name '$module' could not be found");
        }

        return $this->module(new $module);
    }
public function module($module)
    {
        if (is_object($module)) {
            if (!($module instanceof ModuleInterface)) {
                $moduleType = get_class($module);

                throw new InvalidArgumentException("Given module object '$moduleType' does not implement 'Depend\\Abstraction\\ModuleInterface'");
            }

            $module->register($this);

            return $this;
        }

        if (!class_exists((string) $module)) {
            throw new InvalidArgumentException("Given class name '$module' could not be found");
        }

        return $this->module(new $module);
    }
public function module ( $ module ) { if ( is_object ( $ module ) ) { if ( ! ( $ module instanceof ModuleInterface ) ) { $ moduleType = get_class ( $ module ) ; throw new InvalidArgumentException ( "Given module object '$moduleType' does not implement 'Depend\\Abstraction\\ModuleInterface'" ) ; } $ module -> register ( $ this ) ; return $ this ; } if ( ! class_exists ( ( string ) $ module ) ) { throw new InvalidArgumentException ( "Given class name '$module' could not be found" ) ; } return $ this -> module ( new $ module ) ; }
Register a module object or class to register it's own dependencies.

@param ModuleInterface|string $module

@return $this
@throws Exception\InvalidArgumentException
Register a module object or class to register it s own dependencies .