protected function callHooks(PimpleGate $container)
    {
        if (isset($GLOBALS['TL_HOOKS']['initializeDependencyContainer']) &&
            is_array($GLOBALS['TL_HOOKS']['initializeDependencyContainer'])
        ) {
            foreach ($GLOBALS['TL_HOOKS']['initializeDependencyContainer'] as $callback) {
                if (is_array($callback)) {
                    $class = new \ReflectionClass($callback[0]);
                    if (!$class->hasMethod($callback[1])) {
                        if ($class->hasMethod('__call')) {
                            $method = $class->getMethod('__call');
                            $args   = [$callback[1], $container];
                        } else {
                            throw new \InvalidArgumentException(
                                sprintf('No such Method %s::%s', $callback[0], $callback[1])
                            );
                        }
                    } else {
                        $method = $class->getMethod($callback[1]);
                        $args   = [$container];
                    }
                    $object = null;

                    if (!$method->isStatic()) {
                        $object = $this->getInstanceOf($callback[0]);
                    }

                    $method->invokeArgs($object, $args);
                } else {
                    call_user_func($callback, $container);
                }
            }
        }
    }