private function pushMiddlewaresInDefinition($alias_namespace, $middlewares_directory, &$default_definitions)
    {
        $middleware_files = get_files($middlewares_directory);
        if (!empty($middleware_files))
        {
            $middlewares = array_map(function($middleware) use($middlewares_directory) {
                $new_middleware = str_replace("{$middlewares_directory}/", "", $middleware);
                return basename(str_replace("/", "\\", $new_middleware), ".php");
            }, $middleware_files);

            $errors = [];

            foreach ($middlewares as $middleware) {
                if ($alias_namespace === "\\")
                {
                    $middleware_definition = $middleware;
                    $middleware_definition_value = get_app_namespace() . "Middlewares\\{$middleware}";
                }
                else
                {
                    $module_name = str_replace("App\\", "", $alias_namespace);

                    $middleware_sub_namespace = str_replace(app_path() . "/{$module_name}/Middlewares", "", $middlewares_directory);
                    $middleware_sub_namespace = str_replace("/", "\\", $middleware_sub_namespace);

                    $middleware_definition = "{$alias_namespace}{$middleware}";
                    $middleware_definition_value = "{$alias_namespace}Middlewares\\{$middleware}";
                }

                if (!array_key_exists("{$middleware_definition}", $default_definitions))
                {
                    $default_definitions["{$middleware_definition}"] = function(ContainerInterface $c) use ($middleware_definition_value)
                    {
                        return new $middleware_definition_value($c);
                    };
                }
                else
                {
                    $errors[] = "{$middleware} is already exist inside of definitions.";
                }
            }

            if (!empty($errors))
            {
                exit("Error: Please fix the ff. before run the application: <li>" . implode("</li><li>", $errors));
            }
        }
        else
        {
            exit("Error: No middleware found in {$middlewares_directory} path.");
        }
    }