Passed
Push — master ( 632657...4bf89d )
by Andrea
24:52
created

GenerateFormCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 4
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Cdf\PannelloAmministrazioneBundle\Command;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Symfony\Component\Filesystem\Filesystem;
11
use Fi\OsBundle\DependencyInjection\OsFunctions;
12
use Cdf\PannelloAmministrazioneBundle\DependencyInjection\ProjectPath;
13
use Cdf\PannelloAmministrazioneBundle\DependencyInjection\PannelloAmministrazioneUtils;
14
use Doctrine\Common\Persistence\ObjectManager;
15
16
class GenerateFormCommand extends Command
17
{
18
19
    protected $apppaths;
20
    protected $em;
21
    protected $pammutils;
22
    private $generatemplate;
23
    private $kernel;
24
25 1
    protected function configure()
26
    {
27
        $this
28 1
                ->setName('pannelloamministrazione:generateformcrud')
29 1
                ->setDescription('Genera le views per il crud')
30 1
                ->setHelp('Genera le views per il crud, <br/>bi.mwb AppBundle default [--schemaupdate]<br/>')
31 1
                ->addArgument('entityform', InputArgument::REQUIRED, 'Il nome entity del form da creare')
32 1
                ->addOption('generatemplate', InputOption::VALUE_OPTIONAL);
33 1
    }
34
35 1
    public function __construct($kernel, ProjectPath $projectpath, PannelloAmministrazioneUtils $pammutils, ObjectManager $em)
36
    {
37 1
        $this->kernel = $kernel;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
38 1
        $this->apppaths = $projectpath;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
39 1
        $this->pammutils = $pammutils;
40 1
        $this->em = $em;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
41
42
        // you *must* call the parent constructor
43 1
        parent::__construct();
44 1
    }
45
46 1
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48 1
        set_time_limit(0);
49
50 1
        $bundlename = "App";
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
Coding Style Comprehensibility introduced by
The string literal App does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
51 1
        $entityform = $input->getArgument('entityform');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
52 1
        $this->generatemplate = $input->getOption('generatemplate');
53
54 1
        $command = $this->apppaths->getConsole();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
55 1
        $arguments[] = '--env=dev';
0 ignored issues
show
Comprehensibility Best Practice introduced by
$arguments was never initialized. Although not strictly required by PHP, it is generally a good practice to add $arguments = array(); before regardless.
Loading history...
56 1
        $arguments[] = 'make:form';
57 1
        $arguments[] = $entityform . "Type";
0 ignored issues
show
Bug introduced by
Are you sure $entityform of type null|string|string[] can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

57
        $arguments[] = /** @scrutinizer ignore-type */ $entityform . "Type";
Loading history...
Coding Style Comprehensibility introduced by
The string literal Type does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
58 1
        $arguments[] = $entityform;
59 1
        $resultcrud = $this->pammutils->runCommand($command, $arguments);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
60 1
        if ($resultcrud['errcode'] == 0) {
61 1
            $fs = new Filesystem();
62
            //Controller
63 1
            $controlleFile = $this->apppaths->getSrcPath() . '/Controller/' . $entityform . 'Controller.php';
64
65 1
            $formFile = $this->apppaths->getSrcPath() . '/Form/' . $entityform . 'Type.php';
66
67 1
            $lines = file($formFile, FILE_IGNORE_NEW_LINES);
68
69 1
            array_splice($lines, 8, 0, 'use Symfony\Component\Form\Extension\Core\Type\SubmitType;');
0 ignored issues
show
Bug introduced by
It seems like $lines can also be of type false; however, parameter $input of array_splice() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

69
            array_splice(/** @scrutinizer ignore-type */ $lines, 8, 0, 'use Symfony\Component\Form\Extension\Core\Type\SubmitType;');
Loading history...
70
71 1
            array_splice($lines, 14, 0, "        \$submitparms = array("
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal \$submitparms = array( does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
72 1
                    . "'label' => 'Salva','attr' => array(\"class\" => \"btn-outline-primary bisubmit\"));");
73
74 1
            array_splice($lines, 16, 0, "            ->add('submit', SubmitType::class, \$submitparms)");
75
76 1
            array_splice($lines, count($lines) - 3, 0, "            'parametriform' => array()");
77 1
            file_put_contents($formFile, implode("\n", $lines));
78
79 1
            $code = $this->getControllerCode(str_replace('/', '\\', $bundlename), $entityform);
80 1
            $fs->dumpFile($controlleFile, $code);
81 1
            $output->writeln("<info>Creato " . $controlleFile . "</info>");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <info>Creato does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal </info> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
82
83
            //Routing
84 1
            $retmsg = $this->generateFormRouting($entityform);
85
            //Twig template
86 1
            $this->copyTableStructureWiew($entityform);
87
88 1
            $this->generateFormsDefaultTableValues($entityform);
89 1
            $output->writeln("<info>" . $retmsg . "</info>");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <info> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal </info> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
90 1
            return 0;
91
        } else {
92
            $output->writeln("<error>" . $resultcrud['message'] . "</error>");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <error> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal </error> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
93
            return 1;
94
        }
95
    }
96
97 1
    private function generateFormRouting($entityform)
98
    {
99
        //Routing del form
100 1
        $bundlename = 'App';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
101 1
        $fs = new Filesystem();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
102 1
        $routingFile = $this->apppaths->getSrcPath() . '/../config/routes/' . strtolower($entityform) . '.yml';
103
104 1
        $code = $this->getRoutingCode(str_replace('/', '', $bundlename), $entityform);
105 1
        $fs->dumpFile($routingFile, $code);
106
107 1
        $dest = $this->apppaths->getSrcPath() . '/../config/routes.yaml';
108
109 1
        $routingContext = str_replace('/', '', $bundlename) . '_' . $entityform . ':' . "\n" .
110 1
                '  resource: routes/' . strtolower($entityform) . '.yml' . "\n" .
111 1
                '  prefix: /' . $entityform . "\n\n";
112
113
        //Si fa l'append nel file routing del bundle per aggiungerci le rotte della tabella che stiamo gestendo
114 1
        $fh = file_get_contents($dest);
115 1
        if ($fh !== false) {
116 1
            file_put_contents($dest, $routingContext . $fh);
117 1
            $retmsg = 'Routing ' . $dest . " generato automaticamente da pannelloammonistrazionebundle\n\n* * * * CLEAR CACHE * * * *\n";
118
        } else {
119
            $retmsg = 'Impossibile generare il ruoting automaticamente da pannelloammonistrazionebundle\n';
120
        }
121
122 1
        return $retmsg;
123
    }
124
125 1
    private function copyTableStructureWiew($entityform)
126
    {
127 1
        $fs = new Filesystem();
128
        /* $publicfolder = $this->apppaths->getPublicPath();
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
129
130
          if (!$fs->exists($publicfolder . "/js")) {
131
          $fs->mkdir($publicfolder . "/js", 0777);
132
          }
133
134
          if (!$fs->exists($publicfolder . "/css")) {
135
          $fs->mkdir($publicfolder . "/css", 0777);
136
          } */
137
138 1
        $templatetablefolder = $this->apppaths->getTemplatePath() . DIRECTORY_SEPARATOR . $entityform;
139 1
        $crudfolder = $this->kernel->locateResource('@BiCoreBundle')
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
140 1
                . DIRECTORY_SEPARATOR . 'Resources/views/Standard/Crud';
141 1
        $tabellafolder = $this->kernel->locateResource('@BiCoreBundle')
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
142 1
                . DIRECTORY_SEPARATOR . 'Resources/views/Standard/Tabella';
143
144 1
        $fs->mirror($crudfolder, $templatetablefolder . '/Crud');
145 1
        if ($this->generatemplate) {
146
            $fs->mirror($tabellafolder, $templatetablefolder . '/Tabella');
147
        }
148
149
        //$fs->touch($publicfolder . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . $entityform . ".js");
150
        //$fs->touch($publicfolder . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . $entityform . ".css");
151 1
    }
152
153 1
    private function generateFormsDefaultTableValues($entityform)
154
    {
155
        //Si inserisce il record di default nella tabella permessi
156 1
        $ruoloAmm = $this->em->getRepository('BiCoreBundle:Ruoli')->findOneBy(array('superadmin' => true)); //SuperAdmin
157
158 1
        $newPermesso = new \Cdf\BiCoreBundle\Entity\Permessi();
159 1
        $newPermesso->setCrud('crud');
160 1
        $newPermesso->setModulo($entityform);
161 1
        $newPermesso->setRuoli($ruoloAmm);
162 1
        $this->em->persist($newPermesso);
163 1
        $this->em->flush();
164
165 1
        $tabelle = new \Cdf\BiCoreBundle\Entity\Colonnetabelle();
166 1
        $tabelle->setNometabella($entityform);
167 1
        $this->em->persist($tabelle);
168 1
        $this->em->flush();
169 1
    }
170
171 1
    private function getControllerCode($bundlename, $tabella)
172
    {
173
        $codeTemplate = <<<EOF
174 1
<?php
175
namespace [bundle]\Controller;
176
177
use Symfony\Component\HttpFoundation\Request;
178
use Symfony\Component\HttpFoundation\Response;
179
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
180
use Cdf\BiCoreBundle\Controller\FiController;
181
use Cdf\BiCoreBundle\Utils\Tabella\ParametriTabella;
182
use [bundle]\Entity\[tabella];
183
use [bundle]\Form\[tabella]Type;
184
                
185
/**
186
* [tabella] controller.
187
*
188
*/
189
190
class [tabella]Controller extends FiController {
191
192
}
193
EOF;
194 1
        $codebundle = str_replace('[bundle]', $bundlename, $codeTemplate);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
195 1
        $code = str_replace('[tabella]', $tabella, $codebundle);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
196
197 1
        return $code;
198
    }
199
200 1
    private function getRoutingCode($bundlename, $tabella)
201
    {
202
        $codeTemplate = <<<'EOF'
203 1
[tabella]_container:
204
    path:  /
205
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::index' }
206
207
[tabella]_lista:
208
    path:  /lista
209
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::lista' }
210
    options:
211
        expose: true
212
213
[tabella]_indexdettaglio:
214
    path:  /indexDettaglio
215
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::indexDettaglio' }
216
217
[tabella]_new:
218
    path:  /new
219
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::new' }
220
    requirements: { methods: get|post }
221
222
[tabella]_edit:
223
    path:  /{id}/edit
224
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::edit' }
225
226
[tabella]_update:
227
    path:  /{id}/update
228
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::update' }
229
    requirements: { methods: post|put }
230
231
[tabella]_aggiorna:
232
    path:  /{id}/{token}/aggiorna
233
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::aggiorna' }
234
    requirements: { methods: post|put }
235
    options:
236
        expose: true
237
238
[tabella]_delete:
239
    path:  /{id}/{token}/delete
240
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::delete' }
241
    requirements: { methods: post|delete }
242
243
[tabella]_deletemultiple:
244
    path:  /{token}/delete
245
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::delete' }
246
    requirements: { methods: post|delete }
247
248
[tabella]_tabella:
249
    path:  /tabella
250
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::tabella' }
251
    requirements: { methods: post }
252
EOF;
253 1
        $codebundle = str_replace('[bundle]', $bundlename, $codeTemplate);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
254 1
        $code = str_replace('[tabella]', $tabella, $codebundle);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
255
256 1
        return $code;
257
    }
258
}
259