Passed
Push — main ( 9adc11...884f7a )
by Osvaldo
05:31
created

UpdateWhereAnd::crear()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 15
ccs 12
cts 12
cp 1
crap 1
rs 9.9
1
<?php
2
namespace src\factory;
3
4
use src\FactoryClassInterface;
5
use src\pdodatabase\conexion\CrearConexionBaseDeDatos;
6
use src\pdodatabase\consultas\update\ConsultaUpdate;
7
use src\pdodatabase\ejecutar\EjecutarConsultaConDatos;
8
use src\pdodatabase\elementos\Tabla;
9
use src\pdodatabase\elementos\Update as ElementoUpdate;
10
use src\pdodatabase\elementos\ValidadorDeParametrosWhereAndOthers;
11
use src\pdodatabase\elementos\WhereAnd;
12
use src\pdodatabase\sentencias\update\SentenciaUpdate;
13
14
class UpdateWhereAnd implements FactoryClassInterface
15
{
16 1
    public function crear(array $array): ConsultaUpdate
17
    {
18 1
        $conexion = new CrearConexionBaseDeDatos;
19 1
        $conexion = $conexion->crear([]);
20
21 1
        return new ConsultaUpdate(
22 1
            new EjecutarConsultaConDatos(
23 1
                $conexion
24
            ),
25 1
            new SentenciaUpdate(
26 1
                new Tabla($array['tabla']),
27 1
                new ElementoUpdate(
28 1
                    $array['valores'],
29 1
                    new WhereAnd(
30 1
                        new ValidadorDeParametrosWhereAndOthers($array['where'])
31
                    )
32
                )
33
            )
34
        );
35
    }
36
}