Code Duplication    Length = 13-17 lines in 3 locations

src/allejo/stakx/Compiler.php 3 locations

@@ 164-177 (lines=14) @@
161
     *
162
     * @since 0.1.1
163
     */
164
    private function compileDynamicPageViews(&$pageView)
165
    {
166
        $contentItems = $pageView->getContentItems();
167
        $template = $this->createTwigTemplate($pageView);
168
169
        foreach ($contentItems as &$contentItem)
170
        {
171
            $targetFile = $contentItem->getTargetFile();
172
            $output = $this->renderDynamicPageView($template, $pageView, $contentItem);
173
174
            $this->output->notice('Writing file: {file}', array('file' => $targetFile));
175
            $this->folder->writeFile($targetFile, $output);
176
        }
177
    }
178
179
    /**
180
     * Write the compiled output for a repeater PageView.
@@ 186-202 (lines=17) @@
183
     *
184
     * @since 0.1.1
185
     */
186
    private function compileRepeaterPageViews(&$pageView)
187
    {
188
        $pageView->rewindPermalink();
189
190
        $template = $this->createTwigTemplate($pageView);
191
        $permalinks = $pageView->getRepeaterPermalinks();
192
193
        foreach ($permalinks as $permalink)
194
        {
195
            $pageView->bumpPermalink();
196
            $targetFile = $pageView->getTargetFile();
197
            $output = $this->renderRepeaterPageView($template, $pageView, $permalink);
198
199
            $this->output->notice('Writing repeater file: {file}', array('file' => $targetFile));
200
            $this->folder->writeFile($targetFile, $output);
201
        }
202
    }
203
204
    /**
205
     * @deprecated
@@ 211-223 (lines=13) @@
208
     *
209
     * @param ContentItem $contentItem
210
     */
211
    public function compileContentItem(&$contentItem)
212
    {
213
        $pageView = $contentItem->getPageView();
214
        $template = $this->createTwigTemplate($pageView);
215
216
        $contentItem->evaluateFrontMatter($pageView->getFrontMatter(false));
217
218
        $targetFile = $contentItem->getTargetFile();
219
        $output = $this->renderDynamicPageView($template, $pageView, $contentItem);
220
221
        $this->output->notice('Writing file: {file}', array('file' => $targetFile));
222
        $this->folder->writeFile($targetFile, $output);
223
    }
224
225
    ///
226
    // Redirect handling