Passed
Push — main ( 18fc2b...535c40 )
by Osvaldo
01:29
created

CambiarValoresParaBaseDeDatosCuestionarioEts   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 48
rs 10
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A cambiarDeNumeroATexto() 0 10 2
A cambiarDeTextoANumero() 0 10 2
A cambiarTodosLosValoresDeNumeroATexto() 0 10 2
A cambiarTodosLosValoresDeTextoANumero() 0 10 2
1
<?php
2
namespace src;
3
4
use stdClass;
5
6
class CambiarValoresParaBaseDeDatosCuestionarioEts
7
{
8
    public function cambiarTodosLosValoresDeTextoANumero(array $datos): object
9
    {
10
        $resultado = new stdClass;
11
12
        foreach ($datos as $pregunta => $respuesta)
13
        {
14
            $resultado->{$pregunta} = $this->cambiarDeTextoANumero($pregunta, $respuesta);
15
        }
16
17
        return $resultado;
18
    }
19
20
    public function cambiarTodosLosValoresDeNumeroATexto(array $datos): object
21
    {
22
        $resultado = new stdClass;
23
24
        foreach ($datos as $pregunta => $respuesta)
25
        {
26
            $resultado->{$pregunta} = $this->cambiarDeNumeroATexto($pregunta, $respuesta);
27
        }
28
29
        return $resultado;
30
    }
31
32
    public function cambiarDeTextoANumero(string $pregunta, string $valor): int
0 ignored issues
show
Unused Code introduced by
The parameter $pregunta is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

32
    public function cambiarDeTextoANumero(/** @scrutinizer ignore-unused */ string $pregunta, string $valor): int

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
    {
34
        $resultado = 2;
35
        
36
        if($valor == 'No')
37
        {
38
            $resultado = 1;
39
        }
40
41
        return $resultado;
42
    }
43
44
    public function cambiarDeNumeroATexto(string $pregunta, int $valor): string
0 ignored issues
show
Unused Code introduced by
The parameter $pregunta is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

44
    public function cambiarDeNumeroATexto(/** @scrutinizer ignore-unused */ string $pregunta, int $valor): string

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
    {
46
        $resultado = 'Sí';
47
        
48
        if($valor == 1)
49
        {
50
            $resultado = 'No';
51
        }
52
53
        return $resultado;
54
    }
55
}