Passed
Push — main ( cd0525...18fc2b )
by Osvaldo
01:28
created

CrearCuestionarioEts   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 30
dl 0
loc 37
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A crear() 0 35 1
1
<?php
2
namespace src;
3
4
use src\FactoryClassInterface;
5
6
use src\{
7
    CuestionarioEts,
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, src\CuestionarioEts. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
8
    AcontecimientoTraumaticoSevero,
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, src\AcontecimientoTraumaticoSevero. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
9
    RecuerdosPersistentesSobreElAcontecimiento,
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, src\RecuerdosPersistentesSobreElAcontecimiento. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
10
    EsfuerzoPorEvitarCircunstanciasParecidasOAsociadasAlAcontecimiento,
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, src\EsfuerzoPorEvitarCir...ociadasAlAcontecimiento. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
11
    Afectacion
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, src\Afectacion. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
12
};
13
14
class CrearCuestionarioEts implements FactoryClassInterface
15
{
16
    public function crear(array $array): CuestionarioEts
17
    {
18
        $acontecimientoTraumaticoSevero = new AcontecimientoTraumaticoSevero(
19
            $array['pregunta1'],
20
            $array['pregunta2'],
21
            $array['pregunta3'],
22
            $array['pregunta4'],
23
            $array['pregunta5'],
24
            $array['pregunta6']
25
        );
26
27
        return new CuestionarioEts(
28
            $acontecimientoTraumaticoSevero,
29
            new RecuerdosPersistentesSobreElAcontecimiento(
30
                $acontecimientoTraumaticoSevero,
31
                $array['pregunta7'],
32
                $array['pregunta8'],
33
            ),
34
            new EsfuerzoPorEvitarCircunstanciasParecidasOAsociadasAlAcontecimiento(
35
                $acontecimientoTraumaticoSevero,
36
                $array['pregunta9'],
37
                $array['pregunta10'],
38
                $array['pregunta11'],
39
                $array['pregunta12'],
40
                $array['pregunta13'],
41
                $array['pregunta14'],
42
                $array['pregunta15']
43
            ),
44
            new Afectacion(
45
                $acontecimientoTraumaticoSevero,
46
                $array['pregunta16'],
47
                $array['pregunta17'],
48
                $array['pregunta18'],
49
                $array['pregunta19'],
50
                $array['pregunta20']
51
            )
52
        );
53
    }
54
}