src/Services/MenuCaller.php
protected function execute()
    {
        $this->resetHeaders();
        $this->resetStaticCache();

        // Move to drupal root where the index.php is
        $current_dir = getcwd();
        chdir(DRUPAL_ROOT);

        $value = '';
        ob_start(function ($str) use (&$value) {
            $value .= $str;
        });
        $buffer = menu_execute_active_handler($this->path, false);
        ob_end_clean();

        $status = 200;
        if ($buffer === MENU_NOT_FOUND) {
            $status = 404;
            $value = '';
            ob_start(function ($str) use (&$value) {
                $value .= $str;
            });
            drupal_not_found();
            ob_end_clean();
        } elseif ($buffer === MENU_ACCESS_DENIED) {
            $status = 403;
            $value = '';
            ob_start(function ($str) use (&$value) {
                $value .= $str;
            });
            drupal_access_denied();
            ob_end_clean();
        } elseif (empty($value)) {
            $value = drupal_render_page($buffer);
        }

        // Go back to the test directory
        chdir($current_dir);

        return [
            $status,
            $value,
            drupal_get_http_header(),
        ];
    }
protected function execute()
    {
        $this->resetHeaders();
        $this->resetStaticCache();

        // Move to drupal root where the index.php is
        $current_dir = getcwd();
        chdir(DRUPAL_ROOT);

        $value = '';
        ob_start(function ($str) use (&$value) {
            $value .= $str;
        });
        $buffer = menu_execute_active_handler($this->path, false);
        ob_end_clean();

        $status = 200;
        if ($buffer === MENU_NOT_FOUND) {
            $status = 404;
            $value = '';
            ob_start(function ($str) use (&$value) {
                $value .= $str;
            });
            drupal_not_found();
            ob_end_clean();
        } elseif ($buffer === MENU_ACCESS_DENIED) {
            $status = 403;
            $value = '';
            ob_start(function ($str) use (&$value) {
                $value .= $str;
            });
            drupal_access_denied();
            ob_end_clean();
        } elseif (empty($value)) {
            $value = drupal_render_page($buffer);
        }

        // Go back to the test directory
        chdir($current_dir);

        return [
            $status,
            $value,
            drupal_get_http_header(),
        ];
    }
Execute the menu handler and construct the response.

@return array