ListBuilderTemplate::getTemplatesToGenerate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Admingenerator\GeneratorBundle\Builder\Admin;
4
5
/**
6
 * This builder generates php for lists actions.
7
 *
8
 * @author cedric Lombardot
9
 */
10
class ListBuilderTemplate extends ListBuilder
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $filtersMode = null;
16
17
    /**
18
     * @var string
19
     */
20
    protected $defaultFiltersVisibility = null;
21
22
    /**
23
     * @var string
24
     */
25
    protected $filtersModalSize = null;
26
27
    /**
28
     * Retrieve the filters mode parameter defined into the
29
     * YAML generator file under the list builder.
30
     *
31
     * @return string
32
     */
33
    public function getFiltersMode()
34
    {
35
        if (null === $this->filtersMode) {
36
            $this->filtersMode = $this->getGenerator()->getFromYaml('builders.list.params.filtersMode', 'default');
37
        }
38
39
        return $this->filtersMode;
40
    }
41
42
    public function getDefaultFiltersVisibility()
43
    {
44
        if (null === $this->defaultFiltersVisibility) {
45
            $this->defaultFiltersVisibility = $this->getGenerator()->getFromYaml('builders.list.params.defaultFiltersVisibility', 'expanded');
46
        }
47
48
        return $this->defaultFiltersVisibility;
49
    }
50
51
    public function getFiltersModalSize()
52
    {
53
        if (null === $this->filtersModalSize) {
54
            $this->filtersModalSize = $this->getGenerator()->getFromYaml('builders.list.params.filtersModalSize', 'medium');
55
        }
56
57
        return $this->filtersModalSize;
58
    }
59
60
    /**
61
     * (non-PHPdoc).
62
     *
63
     * @see \Admingenerator\GeneratorBundle\Builder\BaseBuilder::getTemplatesToGenerate()
64
     */
65 View Code Duplication
    public function getTemplatesToGenerate()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
    {
67
        return parent::getTemplatesToGenerate() + array(
68
            'ListBuilderTemplate'.self::TWIG_EXTENSION => 'Resources/views/'.$this->getBaseGeneratorName().'List/index.html.twig',
69
            'List/FiltersBuilderTemplate'.self::TWIG_EXTENSION => 'Resources/views/'.$this->getBaseGeneratorName().'List/filters.html.twig',
70
            'List/ResultsBuilderTemplate'.self::TWIG_EXTENSION => 'Resources/views/'.$this->getBaseGeneratorName().'List/results.html.twig',
71
            'List/RowBuilderTemplate'.self::TWIG_EXTENSION => 'Resources/views/'.$this->getBaseGeneratorName().'List/row.html.twig',
72
        );
73
    }
74
}
75