Code Duplication    Length = 23-23 lines in 2 locations

src/Core/Cache/StandardCacheWarmer.php 2 locations

@@ 162-184 (lines=23) @@
159
     * @param RenderingContextInterface $renderingContext
160
     * @return FluidCacheWarmupResult
161
     */
162
    protected function warmupPartialRootPaths(RenderingContextInterface $renderingContext)
163
    {
164
        $result = new FluidCacheWarmupResult();
165
        $paths = $renderingContext->getTemplatePaths();
166
        foreach ($this->formats as $format) {
167
            $formatCutoffPoint = - (strlen($format) + 1);
168
            foreach ($paths->getPartialRootPaths() as $partialRootPath) {
169
                $limitedPaths = clone $paths;
170
                $limitedPaths->setPartialRootPaths([$partialRootPath]);
171
                $pathCutoffPoint = strlen($partialRootPath);
172
                foreach ($limitedPaths->resolveAvailablePartialFiles($format) as $partialFile) {
173
                    $paths->setFormat($format);
174
                    $state = $this->warmSingleFile(
175
                        $partialFile,
176
                        $paths->getPartialIdentifier(substr($partialFile, $pathCutoffPoint, $formatCutoffPoint)),
177
                        $renderingContext
178
                    );
179
                    $result->add($state, $partialFile);
180
                }
181
            }
182
        }
183
        return $result;
184
    }
185
186
    /**
187
     * Warm up _layoutRootPaths_ of the provided RenderingContext's
@@ 199-221 (lines=23) @@
196
     * @param RenderingContextInterface $renderingContext
197
     * @return FluidCacheWarmupResult
198
     */
199
    protected function warmupLayoutRootPaths(RenderingContextInterface $renderingContext)
200
    {
201
        $result = new FluidCacheWarmupResult();
202
        $paths = $renderingContext->getTemplatePaths();
203
        foreach ($this->formats as $format) {
204
            $formatCutoffPoint = - (strlen($format) + 1);
205
            foreach ($paths->getLayoutRootPaths() as $layoutRootPath) {
206
                $limitedPaths = clone $paths;
207
                $limitedPaths->setLayoutRootPaths([$layoutRootPath]);
208
                $pathCutoffPoint = strlen($layoutRootPath);
209
                foreach ($limitedPaths->resolveAvailableLayoutFiles($format) as $layoutFile) {
210
                    $paths->setFormat($format);
211
                    $state = $this->warmSingleFile(
212
                        $layoutFile,
213
                        $paths->getLayoutIdentifier(substr($layoutFile, $pathCutoffPoint, $formatCutoffPoint)),
214
                        $renderingContext
215
                    );
216
                    $result->add($state, $layoutFile);
217
                }
218
            }
219
        }
220
        return $result;
221
    }
222
223
    /**
224
     * Detect all available controller names in provided TemplateRootPaths