GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CFBasedatos::single()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the MIT license. For more information, see
18
 * @category   
19
 * @package    sistema/nucleo
20
 * @copyright  Copyright (c) 2006 - 2014 webcol.net (http://www.webcol.net/calima)
21
 * @license	https://github.com/webcol/Calima/blob/master/LICENSE	MIT
22
 * @version	##BETA 1.0##, ##2014 - 2015##
23
 * <http://www.calimaframework.com>.
24
 */
25
26
namespace Sistema\Nucleo;
27
28
class CFBasedatos 
29
{
30
    
31
    private $host       = CF_BD_HOST;
32
    private $usuario    = CF_BD_USUARIO;
33
    private $clave      = CF_BD_CLAVE;
34
    private $bdnombre   = CF_BD_NOMBRE;
35
    private $bdchar     = CF_BD_CHAR;
0 ignored issues
show
Unused Code introduced by
The property $bdchar is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
36
    private $bdconector = CF_BD_CONECTOR;
37
    private $stmt;
38
    private $dbh;
39
    private $error;
40
    protected $db;
41
42
    public function __construct() {
43
        // definimos el dsn
44
        $dns = $this->bdconector . ':host=' . $this->host . ';dbname=' . $this->bdnombre;
45
46
        // Opciones para PDO
47
48
        $options = array(
49
            \PDO::ATTR_PERSISTENT => true,
50
            \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
51
            \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
52
        );
53
54
55
        // creamos una instancia de PDO
56
        try {
57
            $this->dbh = new \PDO($dns, $this->usuario, $this->clave, $options);
58
        }
59
        // Catch algunos errores
60
        catch (PDOException $e) {
0 ignored issues
show
Bug introduced by
The class Sistema\Nucleo\PDOException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
61
            $this->error = $e->getMessage();
62
        }
63
    }
64
65
    public function consulta($query) {
66
        $this->stmt = $this->dbh->prepare($query);
67
    }
68
69
    public function enlace($param, $value, $type = null) {//bind
70
        if (is_null($type)) {
71
            switch (true) {
72
                case is_int($value):
73
                    $type = \PDO::PARAM_INT;
74
                    break;
75
                case is_bool($value):
76
                    $type = \PDO::PARAM_BOOL;
77
                    break;
78
                case is_null($value):
79
                    $type = \PDO::PARAM_NULL;
80
                    break;
81
                default:
82
                    $type = \PDO::PARAM_STR;
83
            }
84
        }
85
        $this->stmt->bindValue($param, $value, $type); //bindValue de PDO php
86
    }
87
88
    public function ejecucion() {
89
        return $this->stmt->execute();
90
    }
91
92
    public function resultset() {
93
        $this->ejecucion();
94
        return $this->stmt->fetchAll(\PDO::FETCH_ASSOC);
95
    }
96
97
    public function primeraColumna() {
98
        $this->ejecucion();
99
        return $this->stmt->fetchColumn();
100
    }
101
102
    public function PrimerRegistro() {
103
        $this->ejecucion();
104
        return $this->stmt->fetch(\PDO::FETCH_ASSOC);
105
    }
106
107
    public function contarFilas() {
108
        return $this->stmt->rowCount();
109
    }
110
111
    public function lastInsertId() {
112
        return $this->dbh->lastInsertId();
113
    }
114
115
    public function beginTransaction() {
116
        return $this->dbh->beginTransaction();
117
    }
118
119
    public function endTransaction() {
120
        return $this->dbh->commit();
121
    }
122
123
    public function cancelTransaction() {
124
        return $this->dbh->rollBack();
125
    }
126
127
    public function debugDumpParams() {
128
        return $this->stmt->debugDumpParams();
129
    }
130
131
    public function single() {
132
        $this->ejecucion();
133
        return $this->stmt->fetch(\PDO::FETCH_ASSOC);
134
    }
135
136
}