Passed
Push — master ( 2debaa...20fcb2 )
by Andrea
19:50 queued 15:53
created

GenerateFormCommand   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 218
Duplicated Lines 0 %

Test Coverage

Coverage 95.96%

Importance

Changes 0
Metric Value
eloc 160
dl 0
loc 218
ccs 95
cts 99
cp 0.9596
rs 10
c 0
b 0
f 0
wmc 12

7 Methods

Rating   Name   Duplication   Size   Complexity  
A generateFormsDefaultTableValues() 0 17 1
A getControllerCode() 0 27 1
A configure() 0 8 1
A generateFormRouting() 0 26 2
A copyTableStructureWiew() 0 22 4
A getRoutingCode() 0 49 1
A execute() 0 50 2
1
<?php
2
3
namespace Cdf\PannelloAmministrazioneBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
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 Symfony\Component\Finder\Finder;
12
use Fi\OsBundle\DependencyInjection\OsFunctions;
13
14
class GenerateFormCommand extends ContainerAwareCommand
15
{
16
17
    protected $apppaths;
18
    protected $genhelper;
19
    protected $pammutils;
20
    private $generatemplate;
21
22 3
    protected function configure()
23
    {
24
        $this
25 3
                ->setName('pannelloamministrazione:generateformcrud')
26 3
                ->setDescription('Genera le views per il crud')
27 3
                ->setHelp('Genera le views per il crud, <br/>bi.mwb AppBundle default [--schemaupdate]<br/>')
28 3
                ->addArgument('entityform', InputArgument::REQUIRED, 'Il nome entity del form da creare')
29 3
                ->addOption('generatemplate', InputOption::VALUE_OPTIONAL);
30 3
    }
31 1
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33 1
        set_time_limit(0);
34 1
        $this->apppaths = $this->getContainer()->get("pannelloamministrazione.projectpath");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal pannelloamministrazione.projectpath 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...
35 1
        $pammutils = $this->getContainer()->get("pannelloamministrazione.utils");
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 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 pannelloamministrazione.utils 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...
36
37 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...
38 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...
39 1
        $this->generatemplate = $input->getOption('generatemplate');
40
41 1
        $phpPath = OsFunctions::getPHPExecutableFromPath();
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...
42 1
        $command = $phpPath . ' ' . $this->apppaths->getConsole() . ' --env=dev make:form ';
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...
43 1
        $resultcrud = $pammutils->runCommand($command . $entityform . "Type" . " " . $entityform);
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

43
        $resultcrud = $pammutils->runCommand($command . /** @scrutinizer ignore-type */ $entityform . "Type" . " " . $entityform);
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...
Coding Style Comprehensibility introduced by
The string literal 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...
44 1
        if ($resultcrud['errcode'] == 0) {
45 1
            $fs = new Filesystem();
46
            //Controller
47 1
            $controlleFile = $this->apppaths->getSrcPath() . '/Controller/' . $entityform . 'Controller.php';
48
49 1
            $formFile = $this->apppaths->getSrcPath() . '/Form/' . $entityform . 'Type.php';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 22 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...
50 1
            $line_i_am_looking_for = 8;
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...
51 1
            $lines = file($formFile, FILE_IGNORE_NEW_LINES);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 25 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
            $lines[$line_i_am_looking_for] = 'use Symfony\Component\Form\Extension\Core\Type\SubmitType;';
53 1
            file_put_contents($formFile, implode("\n", $lines));
0 ignored issues
show
Bug introduced by
It seems like $lines can also be of type false; however, parameter $pieces of implode() 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

53
            file_put_contents($formFile, implode("\n", /** @scrutinizer ignore-type */ $lines));
Loading history...
54
55 1
            $line_i_am_looking_for = 12;
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...
56 1
            $lines = file($formFile, FILE_IGNORE_NEW_LINES);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 25 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...
57 1
            $lines[$line_i_am_looking_for] = "        {\$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...
58
                    . "'label' => 'Salva','attr' => array(\"class\" => \"btn-outline-primary bisubmit\"));";
59 1
            file_put_contents($formFile, implode("\n", $lines));
60
61 1
            $line_i_am_looking_for = 13;
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...
62 1
            $lines = file($formFile, FILE_IGNORE_NEW_LINES);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 25 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...
63 1
            $lines[$line_i_am_looking_for] = "        \$builder->add('submit', SubmitType::class, \$submitparms)";
64 1
            file_put_contents($formFile, implode("\n", $lines));
65
66 1
            $code = $this->getControllerCode(str_replace('/', '\\', $bundlename), $entityform);
67 1
            $fs->dumpFile($controlleFile, $code);
68 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...
69
70
            //Routing
71 1
            $retmsg = $this->generateFormRouting($entityform);
72
            //Twig template
73 1
            $this->copyTableStructureWiew($entityform);
74
75 1
            $this->generateFormsDefaultTableValues($entityform);
76 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...
77 1
            return 0;
78
        } else {
79
            $output->writeln("<error>" . $resultcrud['errmsg'] . "</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...
80
            return 1;
81
        }
82
    }
83 1
    private function generateFormRouting($entityform)
84
    {
85
        //Routing del form
86 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...
87 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...
88 1
        $routingFile = $this->apppaths->getSrcPath() . '/../config/routes/' . strtolower($entityform) . '.yml';
89
90 1
        $code = $this->getRoutingCode(str_replace('/', '', $bundlename), $entityform);
91 1
        $fs->dumpFile($routingFile, $code);
92
93 1
        $dest = $this->apppaths->getSrcPath() . '/../config/routes.yaml';
94
95 1
        $routingContext = str_replace('/', '', $bundlename) . '_' . $entityform . ':' . "\n" .
96 1
                '  resource: routes/' . strtolower($entityform) . '.yml' . "\n" .
97 1
                '  prefix: /' . $entityform . "\n\n";
98
99
        //Si fa l'append nel file routing del bundle per aggiungerci le rotte della tabella che stiamo gestendo
100 1
        $fh = file_get_contents($dest);
101 1
        if ($fh !== false) {
102 1
            file_put_contents($dest, $routingContext . $fh);
103 1
            $retmsg = 'Routing ' . $dest . " generato automaticamente da pannelloammonistrazionebundle\n\n* * * * CLEAR CACHE * * * *\n";
104
        } else {
105
            $retmsg = 'Impossibile generare il ruoting automaticamente da pannelloammonistrazionebundle\n';
106
        }
107
108 1
        return $retmsg;
109
    }
110 1
    private function copyTableStructureWiew($entityform)
111
    {
112 1
        $fs = new Filesystem();
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...
113 1
        $publicfolder = $this->apppaths->getPublicPath();
114
115 1
        if (!$fs->exists($publicfolder . "/js")) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal /js 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...
116 1
            $fs->mkdir($publicfolder . "/js", 0777);
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal /js 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...
117
        }
118
119 1
        if (!$fs->exists($publicfolder . "/css")) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal /css 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...
120 1
            $fs->mkdir($publicfolder . "/css", 0777);
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal /css 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...
121
        }
122
123 1
        $templatetablefolder = $this->apppaths->getTemplatePath() . DIRECTORY_SEPARATOR . $entityform;
124 1
        $crudfolder = $this->getContainer()->get('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...
125 1
                . DIRECTORY_SEPARATOR . 'Resources/views/Standard/Crud';
126 1
        $tabellafolder = $this->getContainer()->get('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...
127 1
                . DIRECTORY_SEPARATOR . 'Resources/views/Standard/Tabella';
128
129 1
        $fs->mirror($crudfolder, $templatetablefolder . '/Crud');
130 1
        if ($this->generatemplate) {
131
            $fs->mirror($tabellafolder, $templatetablefolder . '/Tabella');
132
        }
133
134
        //$fs->touch($publicfolder . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . $entityform . ".js");
135
        //$fs->touch($publicfolder . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . $entityform . ".css");
136 1
    }
137 1
    private function generateFormsDefaultTableValues($entityform)
138
    {
139
        //Si inserisce il record di default nella tabella permessi
140 1
        $em = $this->getContainer()->get('doctrine')->getManager();
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...
141 1
        $ruoloAmm = $em->getRepository('BiCoreBundle:Ruoli')->findOneBy(array('superadmin' => true)); //SuperAdmin
142
143 1
        $newPermesso = new \Cdf\BiCoreBundle\Entity\Permessi();
144 1
        $newPermesso->setCrud('crud');
145 1
        $newPermesso->setModulo($entityform);
146 1
        $newPermesso->setRuoli($ruoloAmm);
147 1
        $em->persist($newPermesso);
148 1
        $em->flush();
149
150 1
        $tabelle = new \Cdf\BiCoreBundle\Entity\Colonnetabelle();
151 1
        $tabelle->setNometabella($entityform);
152 1
        $em->persist($tabelle);
153 1
        $em->flush();
154 1
    }
155 1
    private function getControllerCode($bundlename, $tabella)
156
    {
157
        $codeTemplate = <<<EOF
158 1
<?php
159
namespace [bundle]\Controller;
160
161
use Symfony\Component\HttpFoundation\Request;
162
use Symfony\Component\HttpFoundation\Response;
163
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
164
use Cdf\BiCoreBundle\Controller\FiController;
165
use Cdf\BiCoreBundle\Utils\Tabella\ParametriTabella;
166
use [bundle]\Entity\[tabella];
167
use [bundle]\Form\[tabella]Type;
168
                
169
/**
170
* [tabella] controller.
171
*
172
*/
173
174
class [tabella]Controller extends FiController {
175
176
}
177
EOF;
178 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...
179 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...
180
181 1
        return $code;
182
    }
183 1
    private function getRoutingCode($bundlename, $tabella)
184
    {
185
        $codeTemplate = <<<'EOF'
186 1
[tabella]_container:
187
    path:  /
188
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::index' }
189
190
[tabella]_indexdettaglio:
191
    path:  /indexDettaglio
192
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::indexDettaglio' }
193
194
[tabella]_new:
195
    path:  /new
196
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::new' }
197
    requirements: { methods: get|post }
198
199
[tabella]_edit:
200
    path:  /{id}/edit
201
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::edit' }
202
203
[tabella]_update:
204
    path:  /{id}/update
205
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::update' }
206
    requirements: { methods: post|put }
207
208
[tabella]_aggiorna:
209
    path:  /aggiorna
210
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::aggiorna' }
211
    requirements: { methods: post|put }
212
213
[tabella]_delete:
214
    path:  /{id}/delete
215
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::delete' }
216
    requirements: { methods: post|delete }
217
218
[tabella]_deletemultiple:
219
    path:  /delete
220
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::delete' }
221
    requirements: { methods: post|delete }
222
223
[tabella]_tabella:
224
    path:  /tabella
225
    defaults: { _controller: '[bundle]\Controller\[tabella]Controller::tabella' }
226
    requirements: { methods: post }
227
EOF;
228 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...
229 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...
230
231 1
        return $code;
232
    }
233
}
234