ClassGeneratorTest::compareFileGenerated()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 4
1
<?php
2
3
namespace Yoghi\Bundle\MaddaBundle\Generator;
4
5
/*
6
 * This file is part of the MADDA project.
7
 *
8
 * (c) Stefano Tamagnini <>
9
 *
10
 * This source file is subject to the GPLv3 license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13
14
use Yoghi\Bundle\MaddaBundleTest\Utils\AbstractCommonLogTest;
15
use Yoghi\Bundle\MaddaBundleTest\Utils\FileCompare;
16
use Yoghi\Bundle\MaddaBundleTest\Utils\PhpunitFatalErrorHandling;
17
use Yoghi\Bundle\MaddaBundleTest\Utils\VfsAdapter;
18
19
/**
20
 * @author Stefano Tamagnini <>
21
 */
22
class ClassGeneratorTest extends \PHPUnit_Framework_TestCase
23
{
24
    use AbstractCommonLogTest;
25
    use FileCompare;
26
    use PhpunitFatalErrorHandling;
27
28 View Code Duplication
    public function testEmptyClassGenerator()
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...
29
    {
30
        $namespace = 'TestNamespace';
31
        $className = 'EmptyClass';
32
        $gClassgen = new ClassGenerator($namespace, $className);
33
        $gClassgen->setLogger($this->logger);
34
        $config = new ClassConfig();
35
        $properties = []; // 'fields', 'extend', 'implements'
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% 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...
36
        $typesReferenceArray = []; //dipendenza dei field da altre classi
37
        $typesDescArray = []; //descrizione delle classi da cui dipendono i field
38
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
39
        // $actual = $gClassgen->toString();
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% 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...
40
        // $expected = file_get_contents(__DIR__.'/../Resources/php/EmptyClass.php');
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
41
        // $this->assertSame($actual, $expected, 'Classe EmptyClass invalid');
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% 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...
42
        $resourcesDir = __DIR__.'/../Resources/php';
43
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
44
    }
45
46 View Code Duplication
    public function testFirstClassGenerator()
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...
47
    {
48
        $namespace = 'TestNamespace';
49
        $className = 'FirstClass';
50
        $gClassgen = new ClassGenerator($namespace, $className);
51
        $gClassgen->setLogger($this->logger);
52
        $config = new ClassConfig();
53
        $properties = [
54
            'extend' => 'ExtendClass',
55
            'implements' => 'IClass',
56
        ];
57
        $typesReferenceArray = [];
58
        $typesDescArray = [];
59
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
60
        // $actual = $gClassgenClassgen->toString();
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% 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...
61
        // $expected = file_get_contents(__DIR__.'/../Resources/php/FirstClass.php');
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
62
        // $this->assertSame($expected, $actual, 'Classe FirstClass invalid');
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% 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...
63
        $resourcesDir = __DIR__.'/../Resources/php';
64
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
65
    }
66
67
    public function testTraitsGenerator()
68
    {
69
        $namespace = 'TestNamespace';
70
        $className = 'TraitsTestClass';
71
        $gClassgen = new ClassGenerator($namespace, $className);
72
        $gClassgen->setLogger($this->logger);
73
        $config = new ClassConfig();
74
        $properties = [
75
            'extend' => 'ExtendClass',
76
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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
            'traits' => 'TraitsClass',
78
        ];
79
        $typesReferenceArray = [
80
            'TraitsClass' => 'TraitNamespace',
81
        ];
82
        $typesDescArray = [];
83
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
84
        $resourcesDir = __DIR__.'/../Resources/php';
85
86
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
87
    }
88
89
    public function testMultiTraitsGenerator()
90
    {
91
        $namespace = 'TestNamespace';
92
        $className = 'MultiTraitsTestClass';
93
        $gClassgenClassgen = new ClassGenerator($namespace, $className);
94
        $gClassgenClassgen->setLogger($this->logger);
95
        $config = new ClassConfig();
96
        $properties = [
97
            'extend' => 'ExtendClass',
98
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
99
            'traits' => ['TraitsClass', 'TraitsClass2'],
100
        ];
101
        $typesReferenceArray = [
102
            'TraitsClass' => 'TraitNamespace',
103
            'TraitsClass2' => 'TestNamespace',
104
        ];
105
        $typesDescArray = [];
106
        $gClassgenClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
107
        $resourcesDir = __DIR__.'/../Resources/php';
108
109
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgenClassgen);
110
    }
111
112 View Code Duplication
    public function testImplementsClassWithNamespaceGenerator()
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...
113
    {
114
        $namespace = 'TestNamespace';
115
        $className = 'ImplementsClassWithNamespace';
116
        $gClassgenClassgen = new ClassGenerator($namespace, $className);
117
        $gClassgenClassgen->setLogger($this->logger);
118
        $config = new ClassConfig();
119
        $properties = [
120
            'extend' => 'ExtendClass',
121
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
122
        ];
123
        $typesReferenceArray = [];
124
        $typesDescArray = [];
125
        $gClassgenClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
126
        $resourcesDir = __DIR__.'/../Resources/php';
127
128
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgenClassgen);
129
    }
130
131 View Code Duplication
    public function testMultiImplementsClassWithNamespaceGenerator()
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...
132
    {
133
        $namespace = 'TestNamespace';
134
        $className = 'MultiImplementsClassWithNamespace';
135
        $gClassgenClassgen = new ClassGenerator($namespace, $className);
136
        $gClassgenClassgen->setLogger($this->logger);
137
        $config = new ClassConfig();
138
        $properties = [
139
            'extend' => 'ExtendClass',
140
            'implements' => [
141
            "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
142
            "NS\IClass2",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass2 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...
143
            ],
144
        ];
145
        $typesReferenceArray = [];
146
        $typesDescArray = [];
147
        $gClassgenClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
148
        $resourcesDir = __DIR__.'/../Resources/php';
149
150
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgenClassgen);
151
    }
152
153 View Code Duplication
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethod()
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...
154
    {
155
        $namespace = 'TestNamespace';
156
        $className = 'ImplementsClassWithNamespaceAndField';
157
        $gClassgen = new ClassGenerator($namespace, $className);
158
        $gClassgen->setLogger($this->logger);
159
        $config = new ClassConfig();
160
        $config->haveConstructor = true;
161
        $properties = [
162
            'extend' => 'ExtendClass',
163
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
164
            'fields' => [
165
            'prova' => [
166
                'primitive' => 'int',
167
                'description' => 'identificativo univoco della sessione',
168
            ],
169
            ],
170
        ];
171
        $typesReferenceArray = [];
172
        $typesDescArray = [];
173
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
174
        $resourcesDir = __DIR__.'/../Resources/php';
175
176
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
177
    }
178
179 View Code Duplication
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodStatic()
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...
180
    {
181
        $namespace = 'TestNamespace';
182
        $className = 'ImplementsClassWithNamespaceAndFieldStatic';
183
        $gClassgen = new ClassGenerator($namespace, $className);
184
        $gClassgen->setLogger($this->logger);
185
        $config = new ClassConfig();
186
        $config->haveConstructor = true;
187
        $properties = [
188
            'extend' => 'ExtendClass',
189
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
190
            'fields' => [
191
            'prova' => [
192
                'primitive' => 'int',
193
                'description' => 'identificativo univoco della sessione',
194
                'static' => true,
195
            ],
196
            ],
197
        ];
198
        $typesReferenceArray = [];
199
        $typesDescArray = [];
200
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
201
        $resourcesDir = __DIR__.'/../Resources/php';
202
203
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
204
    }
205
206
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependency()
207
    {
208
        $namespace = 'TestNamespace';
209
        $className = 'ICWNAFWD';
210
        $gClassgen = new ClassGenerator($namespace, $className);
211
        $gClassgen->setLogger($this->logger);
212
        $config = new ClassConfig();
213
        $config->haveConstructor = true;
214
        $properties = [
215
            'extend' => 'ExtendClass',
216
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
217
            'fields' => [
218
            'prova' => [
219
                'primitive' => 'int',
220
                'description' => 'session unique identifier',
221
            ],
222
            'dependency' => [
223
                'class' => 'ClassDep',
224
            ],
225
            ],
226
        ];
227
        $typesReferenceArray = [
228
            'ClassDep' => 'NamespaceDep',
229
        ];
230
        $typesDescArray = [
231
            'ClassDep' => 'comment ClassDep',
232
        ];
233
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
234
        $resourcesDir = __DIR__.'/../Resources/php';
235
236
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
237
    }
238
239
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependencyAutoInizialize()
240
    {
241
        $namespace = 'TestNamespace';
242
        $className = 'ICWNAFWDA';
243
        $gClassgen = new ClassGenerator($namespace, $className);
244
        $gClassgen->setLogger($this->logger);
245
        $config = new ClassConfig();
246
        $config->haveConstructor = true;
247
        $properties = [
248
            'extend' => 'ExtendClass',
249
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
250
            'fields' => [
251
            'prova' => [
252
                'primitive' => 'int',
253
                'description' => 'session unique identifier',
254
                'autoinizialize' => true,
255
                'default' => 0,
256
            ],
257
            'dependency' => [
258
                'class' => 'ClassDep',
259
            ],
260
            ],
261
        ];
262
        $typesReferenceArray = [
263
            'ClassDep' => 'NamespaceDep',
264
        ];
265
        $typesDescArray = [
266
            'ClassDep' => 'comment ClassDep',
267
        ];
268
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
269
        $resourcesDir = __DIR__.'/../Resources/php';
270
271
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
272
    }
273
274
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependencyAutoInizializeClass()
275
    {
276
        $namespace = 'TestNamespace';
277
        $className = 'ICWNAFWDAC';
278
        $gClassgen = new ClassGenerator($namespace, $className);
279
        $gClassgen->setLogger($this->logger);
280
        $config = new ClassConfig();
281
        $config->haveConstructor = true;
282
        $properties = [
283
            'extend' => 'ExtendClass',
284
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
285
            'fields' => [
286
            'prova' => [
287
                'primitive' => 'int',
288
                'description' => 'session unique identifier',
289
            ],
290
            'dependency' => [
291
                'class' => 'ClassDep',
292
                'autoinizialize' => true,
293
                'default' => 'new ClassDep();',
294
            ],
295
            ],
296
        ];
297
        $typesReferenceArray = [
298
            'ClassDep' => 'NamespaceDep',
299
        ];
300
        $typesDescArray = [
301
            'ClassDep' => 'comment ClassDep',
302
        ];
303
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
304
        $resourcesDir = __DIR__.'/../Resources/php';
305
306
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
307
    }
308
309
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependencyAutoInizializeClassWithGetter()
310
    {
311
        $namespace = 'TestNamespace';
312
        $className = 'ICWNAFWDACG';
313
        $gClassgen = new ClassGenerator($namespace, $className);
314
        $gClassgen->setLogger($this->logger);
315
        $config = new ClassConfig();
316
        $config->haveConstructor = true;
317
        $properties = [
318
            'extend' => 'ExtendClass',
319
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
320
            'fields' => [
321
            'prova' => [
322
                'primitive' => 'int',
323
                'description' => 'session unique identifier',
324
                'getter' => true,
325
            ],
326
            'dependency' => [
327
                'class' => 'ClassDep',
328
                'autoinizialize' => true,
329
                'default' => 'new ClassDep()',
330
            ],
331
            ],
332
        ];
333
        $typesReferenceArray = [];
334
        $typesDescArray = [
335
            'ClassDep' => 'comment ClassDep',
336
        ];
337
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
338
        $resourcesDir = __DIR__.'/../Resources/php';
339
340
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
341
    }
342
343 View Code Duplication
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependencyAutoInizializeClassWithGetterAll()
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...
344
    {
345
        $namespace = 'TestNamespace';
346
        $className = 'ICWNAFWDACGA';
347
        $gClassgen = new ClassGenerator($namespace, $className);
348
        $gClassgen->setLogger($this->logger);
349
        $config = new ClassConfig();
350
        $config->haveConstructor = true;
351
        $config->haveGetter = true;
352
        $properties = [
353
            'extend' => 'ExtendClass',
354
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
355
            'fields' => [
356
            'prova' => [
357
                'primitive' => 'int',
358
                'description' => 'session unique identifier',
359
            ],
360
            'dependency' => [
361
                'class' => 'ClassDep',
362
                'autoinizialize' => true,
363
                'default' => 'new ClassDep()',
364
            ],
365
            ],
366
        ];
367
        $typesReferenceArray = [
368
            'ClassDep' => 'NamespaceDep',
369
        ];
370
        $typesDescArray = [
371
            'ClassDep' => 'comment ClassDep',
372
        ];
373
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
374
        $resourcesDir = __DIR__.'/../Resources/php';
375
376
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
377
    }
378
379 View Code Duplication
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependencyAutoInizializeClassWithGetterAndSetterAll()
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...
380
    {
381
        $namespace = 'TestNamespace';
382
        $className = 'ICWNAFWDACGSA';
383
        $gClassgen = new ClassGenerator($namespace, $className);
384
        $gClassgen->setLogger($this->logger);
385
        $config = new ClassConfig();
386
        $config->haveConstructor = true;
387
        $config->haveGetter = true;
388
        $config->haveSetter = true;
389
        $properties = [
390
            'extend' => 'ExtendClass',
391
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
392
            'fields' => [
393
            'prova' => [
394
                'primitive' => 'int',
395
                'description' => 'session unique identifier',
396
            ],
397
            'dependency' => [
398
                'class' => 'ClassDep',
399
                'autoinizialize' => false,
400
                'default' => 'new ClassDep()',
401
            ],
402
            ],
403
        ];
404
        $typesReferenceArray = [
405
            'ClassDep' => 'NamespaceDep',
406
        ];
407
        $typesDescArray = [
408
            'ClassDep' => 'comment ClassDep',
409
        ];
410
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
411
        $resourcesDir = __DIR__.'/../Resources/php';
412
413
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
414
    }
415
416
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependencyAutoInizializeClassWithGetterAndSetterAllStaticExplicit()
417
    {
418
        $namespace = 'TestNamespace';
419
        $className = 'ICWNAFWDACGSAS';
420
        $gClassgen = new ClassGenerator($namespace, $className);
421
        $gClassgen->setLogger($this->logger);
422
        $config = new ClassConfig();
423
        $config->haveConstructor = true;
424
        $properties = [
425
            'extend' => 'ExtendClass',
426
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
427
            'fields' => [
428
            'prova' => [
429
                'primitive' => 'int',
430
                'description' => 'session unique identifier',
431
                'static' => true,
432
                'getter' => true,
433
                'setter' => true,
434
            ],
435
            'dependency' => [
436
                'class' => 'ClassDep',
437
                'autoinizialize' => true,
438
                'default' => 'new ClassDep()',
439
                'static' => true,
440
                'getter' => true,
441
                'setter' => true,
442
            ],
443
            ],
444
        ];
445
        $typesReferenceArray = [
446
            'ClassDep' => 'NamespaceDep',
447
        ];
448
        $typesDescArray = [
449
            'ClassDep' => 'comment ClassDep',
450
        ];
451
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
452
        $resourcesDir = __DIR__.'/../Resources/php';
453
454
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
455
    }
456
457 View Code Duplication
    public function testImplementsClassWithNamespaceAndFieldGeneratorMethodWithDependencyAutoInizializeClassWithGetterAndSetterAllStatic()
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...
458
    {
459
        $namespace = 'TestNamespace';
460
        $className = 'ICWNAFWDACGSAS';
461
        $gClassgen = new ClassGenerator($namespace, $className);
462
        $gClassgen->setLogger($this->logger);
463
        $config = new ClassConfig();
464
        $config->haveConstructor = true;
465
        $config->haveGetter = true;
466
        $config->haveSetter = true;
467
        $properties = [
468
            'extend' => 'ExtendClass',
469
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
470
            'fields' => [
471
            'prova' => [
472
                'primitive' => 'int',
473
                'description' => 'session unique identifier',
474
                'static' => true,
475
            ],
476
            'dependency' => [
477
                'class' => 'ClassDep',
478
                'autoinizialize' => true,
479
                'default' => 'new ClassDep()',
480
                'static' => true,
481
            ],
482
            ],
483
        ];
484
        $typesReferenceArray = [
485
            'ClassDep' => 'NamespaceDep',
486
        ];
487
        $typesDescArray = [
488
            'ClassDep' => 'comment ClassDep',
489
        ];
490
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
491
        $resourcesDir = __DIR__.'/../Resources/php';
492
493
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
494
    }
495
496 View Code Duplication
    public function testSameNamespaceClassDependency()
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...
497
    {
498
        $namespace = 'TestNamespace';
499
        $className = 'SNCD';
500
        $gClassgen = new ClassGenerator($namespace, $className);
501
        $gClassgen->setLogger($this->logger);
502
        $config = new ClassConfig();
503
        $config->haveConstructor = true;
504
        $config->haveGetter = true;
505
        $config->haveSetter = true;
506
        $properties = [
507
            'extend' => 'ExtendClass',
508
            'implements' => "NS\IClass",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal NS\IClass 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...
509
            'fields' => [
510
            'prova' => [
511
                'primitive' => 'int',
512
                'autoinizialize' => true,
513
                'default' => 0,
514
                'description' => 'session unique identifier',
515
            ],
516
            'dependency' => [
517
                'class' => 'ClassDep',
518
                'autoinizialize' => true,
519
                'default' => 'new ClassDep()',
520
            ],
521
            ],
522
        ];
523
        $typesReferenceArray = [
524
            'ClassDep' => 'TestNamespace',
525
        ];
526
        $typesDescArray = [
527
            'ClassDep' => 'comment ClassDep',
528
        ];
529
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
530
        $resourcesDir = __DIR__.'/../Resources/php';
531
532
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
533
    }
534
535
    public function testEnum()
536
    {
537
        $namespace = 'TestNamespace';
538
        $className = 'EnumTest';
539
        $gClassgen = new ClassGenerator($namespace, $className);
540
        $gClassgen->setLogger($this->logger);
541
        $config = new ClassConfig();
542
        $config->isEnum = true;
543
        $properties = [
544
            'fields' => [
545
            'name' => [
546
                'primitive' => 'string',
547
                'description' => 'nome esplicativo della enum',
548
                'getter' => true,
549
            ],
550
            ],
551
        ];
552
        $typesReferenceArray = [];
553
        $typesDescArray = [];
554
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
555
        $resourcesDir = __DIR__.'/../Resources/php';
556
557
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
558
    }
559
560 View Code Duplication
    public function testSingleton()
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...
561
    {
562
        $namespace = 'TestNamespace';
563
        $className = 'SingletonClass';
564
        $gClassgen = new ClassGenerator($namespace, $className);
565
        $gClassgen->setLogger($this->logger);
566
        $config = new ClassConfig();
567
        $config->isSingleton = true;
568
        $properties = [];
569
        $typesReferenceArray = [];
570
        $typesDescArray = [];
571
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
572
        $resourcesDir = __DIR__.'/../Resources/php';
573
574
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
575
    }
576
577 View Code Duplication
    public function testInterface()
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...
578
    {
579
        $namespace = 'TestNamespace';
580
        $className = 'Itest';
581
        $gClassgen = new ClassGenerator($namespace, $className);
582
        $gClassgen->setLogger($this->logger);
583
        $config = new ClassConfig();
584
        $config->haveConstructor = true;
585
        $config->isInterface = true;
586
        $properties = [
587
            'fields' => [
588
            'prova' => [
589
                'primitive' => 'int',
590
                'description' => 'session unique identifier',
591
            ],
592
            ],
593
        ];
594
        $typesReferenceArray = [];
595
        $typesDescArray = [];
596
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
597
        $resourcesDir = __DIR__.'/../Resources/php';
598
599
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
600
    }
601
602 View Code Duplication
    public function testInterfaceWithGetter()
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...
603
    {
604
        $namespace = 'TestNamespace';
605
        $className = 'ItestWithGetter';
606
        $gClassgen = new ClassGenerator($namespace, $className);
607
        $gClassgen->setLogger($this->logger);
608
        $config = new ClassConfig();
609
        $config->haveGetter = true;
610
        $config->isInterface = true;
611
        $properties = [
612
            'fields' => [
613
            'prova' => [
614
                'primitive' => 'int',
615
                'description' => 'session unique identifier',
616
            ],
617
            ],
618
        ];
619
        $typesReferenceArray = [];
620
        $typesDescArray = [];
621
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
622
        $resourcesDir = __DIR__.'/../Resources/php';
623
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
624
    }
625
626
    public function testFirstClassMethodGenerator()
627
    {
628
        $namespace = 'TestNamespace';
629
        $className = 'FirstMethodClass';
630
        $gClassgen = new ClassGenerator($namespace, $className);
631
        $gClassgen->setLogger($this->logger);
632
        $config = new ClassConfig();
633
        $properties = [
634
            'extend' => 'ExtendClass',
635
            'implements' => 'IClass',
636
            'methods' => [
637
            'methodName' => [
638
                'params' => [
639
                'prova' => [
640
                    'primitive' => 'int',
641
                    'description' => 'session unique identifier',
642
                ],
643
                'prova2' => [
644
                    'primitive' => 'string',
645
                    'description' => 'campo generico',
646
                ],
647
                ],
648
            ],
649
            ],
650
        ];
651
        $typesReferenceArray = [];
652
        $typesDescArray = [];
653
        $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
654
655
        $resourcesDir = __DIR__.'/../Resources/php';
656
        $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
657
    }
658
659
    // public function testInterfaceWithGetterAndSetter()
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
660
    // {
661
    //     $namespace = "TestNamespace";
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
662
    //     $className = "ItestWithGetterSetter";
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
663
    //     $gClassgen = new ClassGenerator($namespace, $className);
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% 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...
664
    //     $gClassgen->setLogger($this->logger);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
665
    //     $config = new ClassConfig();
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% 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...
666
    //     $config->haveGetter = true;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
667
    //     $config->haveSetter = true;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
668
    //     $config->isInterface = true;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
669
    //     $properties = array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
670
    //       "fields" => array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
671
    //         "prova" => array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
672
    //           "primitive" => "int",
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...
673
    //           "description" => "session unique identifier"
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
674
    //         )
675
    //       )
676
    //     );
677
    //     $typesReferenceArray = array();
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% 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...
678
    //     $typesDescArray = array();
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% 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...
679
    //     $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% 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...
680
    //     $resourcesDir = __DIR__.'/../Resources/php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
681
    //
682
    //     $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% 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...
683
    // }
684
    //
685
    //
686
    // public function testStrange()
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
687
    // {
688
    //     $namespace = "BitPrepared\\Bundle\\FormazioneBundle\\Domain\\Events";
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
689
    //     $className = "SpiegazioneSessioneCampoDeleteEvent";
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
690
    //     $gClassgen = new ClassGenerator($namespace, $className, 'Event delete for Aggregate Root SpiegazioneSessioneCampo');
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% 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...
691
    //     $gClassgen->setLogger($this->logger);
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
692
    //     $config = new ClassConfig();
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% 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...
693
    //     $config->haveGetter = true;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
694
    //     $config->haveSetter = false;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
695
    //     $config->isInterface = false;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
696
    //     $config->isFinalClass = true;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
697
    //     $config->haveConstructor = true;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
698
    //     $properties = array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
699
    //       "implements" => "BitPrepared\\Bundle\\FormazioneBundle\\Domain\\Events\\DomainEvent",
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...
700
    //       "fields" => array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
701
    //         "occurredOn" => array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
702
    //           "class" => "\\DateTime",
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...
703
    //           "description" => "quando accade l'evento",
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...
704
    //           "default" => "new \\DateTime()",
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...
705
    //           "autoinizialize" => true
706
    //         ),
707
    //         "aggregateId" => array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
708
    //           "primitive" => "int",
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...
709
    //           "description" => "id dell'aggregato root relativo all'evento",
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...
710
    //           "autoinizialize" => false
711
    //         ),
712
    //         "properties" => array(
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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...
713
    //           "primitive" => "array",
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...
714
    //           "description" => "proprietà dell'evento",
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...
715
    //           "autoinizialize" => false
716
    //         ),
717
    //       )
718
    //     );
719
    //     $typesReferenceArray = array();
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% 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...
720
    //     $typesDescArray = array();
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% 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...
721
    //     $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config);
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% 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...
722
    //     $resourcesDir = __DIR__.'/../Resources/php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
723
    //
724
    //     $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen);
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% 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...
725
    // }
726
727
    /**
728
     * [generateDestDir description]
729
     *
730
     * @param string $namespace [description]
731
     *
732
     * @return string [description]
733
     */
734
    private function generateDestDir($namespace)
735
    {
736
        $directoryOutput = self::$directoryV->url().'/output';
737
        if (!file_exists($directoryOutput)) {
738
            mkdir($directoryOutput, 0700, true);
739
            mkdir($directoryOutput.'/'.$namespace.'/', 0700, true);
740
        }
741
742
        return $directoryOutput;
743
    }
744
745
    private function compareFileGenerated($resourcesDir, $namespace, $className, ClassGenerator $gClassgen)
746
    {
747
        $directoryOutput = $this->generateDestDir($namespace);
748
        $gClassgen->createFileOnDir(new VfsAdapter($directoryOutput, 0));
749
        $this->compareClassPhp($resourcesDir, $namespace, $className, $directoryOutput);
750
    }
751
}
752