Passed
Push — main ( 54e4df...1e4bb3 )
by Osvaldo
01:40
created

SelectWhere::crear()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 18
rs 9.8333
1
<?php
2
namespace src\factory;
3
4
use src\FactoryClassInterface;
5
use src\pdodatabase\conexion\CrearConexionBaseDeDatos;
6
use src\pdodatabase\consultas\select\SelectWhere as ConsultaSelectSelectWhere;
0 ignored issues
show
Bug introduced by
The type src\pdodatabase\consultas\select\SelectWhere was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use src\pdodatabase\ejecutar\EjecutarConsultaConDatos;
8
use src\pdodatabase\elementos\Campos;
9
use src\pdodatabase\elementos\Columna;
0 ignored issues
show
Bug introduced by
The type src\pdodatabase\elementos\Columna was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use src\pdodatabase\elementos\Operador;
0 ignored issues
show
Bug introduced by
The type src\pdodatabase\elementos\Operador was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use src\pdodatabase\elementos\SentenciaDeComparacionColumnaOperadorValor;
0 ignored issues
show
Bug introduced by
The type src\pdodatabase\elemento...ionColumnaOperadorValor was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use src\pdodatabase\elementos\Tabla;
13
use src\pdodatabase\elementos\Valor;
0 ignored issues
show
Bug introduced by
The type src\pdodatabase\elementos\Valor was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use src\pdodatabase\elementos\Where;
15
use src\pdodatabase\sentencias\select\SelectWhere as SelectSelectWhere;
0 ignored issues
show
Bug introduced by
The type src\pdodatabase\sentencias\select\SelectWhere was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use src\pdodatabase\sentencias\select\Select as Select;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, src\factory\Select. 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...
Bug introduced by
The type src\pdodatabase\sentencias\select\Select was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
class SelectWhere implements FactoryClassInterface
19
{
20
    public function crear(array $array): ConsultaSelectSelectWhere
21
    {
22
        $conexion = new CrearConexionBaseDeDatos;
23
        
24
        return new ConsultaSelectSelectWhere(
25
            new EjecutarConsultaConDatos(
26
                $conexion->crear([])
27
            ),
28
            new SelectSelectWhere(
29
                new Select(
30
                    new Tabla($array['tabla']),
31
                    new Campos($array['campos'])
32
                ),
33
                new Where(
34
                   new SentenciaDeComparacionColumnaOperadorValor(
35
                       new Columna($array['where'][0]),
36
                       new Operador($array['where'][1]),
37
                       new Valor($array['where'][2])
38
                   ) 
39
                )
40
            )
41
        );
42
    }
43
}