Code Duplication    Length = 26-26 lines in 2 locations

src/Commands/RouteTranslationCacheCommand.php 1 location

@@ 59-84 (lines=26) @@
56
    /**
57
     * Cache the routes separately for each locale.
58
     */
59
    protected function cacheRoutesPerLocale()
60
    {
61
        // Store the default routes cache,
62
        // this way the Application will detect that routes are cached.
63
        $allLocales = $this->getSupportedLocales();
64
65
        array_push($allLocales, null);
66
67
        foreach ($allLocales as $locale) {
68
69
            $routes = $this->getFreshApplicationRoutes($locale);
70
71
            if (count($routes) == 0) {
72
                $this->error("Your application doesn't have any routes.");
73
                return;
74
            }
75
76
            foreach ($routes as $route) {
77
                $route->prepareForSerialization();
78
            }
79
80
            $this->files->put(
81
                $this->makeLocaleRoutesPath($locale), $this->buildRouteCacheFile($routes)
82
            );
83
        }
84
    }
85
86
    /**
87
     * Boot a fresh copy of the application and get the routes.

src/Commands/RouteTranslationsCacheCommand.php 1 location

@@ 59-84 (lines=26) @@
56
    /**
57
     * Cache the routes separately for each locale.
58
     */
59
    protected function cacheRoutesPerLocale()
60
    {
61
        // Store the default routes cache,
62
        // this way the Application will detect that routes are cached.
63
        $allLocales = array_keys($this->getSupportedLocales());
64
65
        array_push($allLocales, null);
66
67
        foreach ($allLocales as $locale) {
68
69
            $routes = $this->getFreshApplicationRoutes($locale);
70
71
            if (count($routes) == 0) {
72
                $this->error("Your application doesn't have any routes.");
73
                return;
74
            }
75
76
            foreach ($routes as $route) {
77
                $route->prepareForSerialization();
78
            }
79
80
            $this->files->put(
81
                $this->makeLocaleRoutesPath($locale), $this->buildRouteCacheFile($routes)
82
            );
83
        }
84
    }
85
86
    /**
87
     * Boot a fresh copy of the application and get the routes.