DesarrollosWeb/documentofacil

View on GitHub
gestoria/Db.php

Summary

Maintainability
A
0 mins
Test Coverage

Showing 14 of 14 total issues

Missing class import via use statement (line '24', column '37').
Open

$this->connection = new PDO($this->dsn, $this->username, $this->password);
Severity: Minor
Found in gestoria/Db.php by phpmd

Avoid unused private fields such as '$database'.
Open

private string $database = DB_NAME;
Severity: Minor
Found in gestoria/Db.php by phpmd

The method __construct() contains an exit expression.
Open

die($e->getMessage());
Severity: Minor
Found in gestoria/Db.php by phpmd

Avoid unused private fields such as '$servername'.
Open

private string $servername = DB_HOST;
Severity: Minor
Found in gestoria/Db.php by phpmd

syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST)
Open

private static ?DB $instance = null;
Severity: Critical
Found in gestoria/Db.php by phan

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class DB
Severity: Minor
Found in gestoria/Db.php by phpcodesniffer

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 7 and the first side effect is on line 2.
Open

<?php
Severity: Minor
Found in gestoria/Db.php by phpcodesniffer

Avoid classes with short names like DB. Configured minimum length is 3.
Open

class DB
{
//<editor-fold desc="Variables">
private static ?DB $instance = null;
private PDO $connection;
Severity: Minor
Found in gestoria/Db.php by phpmd

Method name "DB::execute_query" is not in camel caps format
Open

public function execute_query(string $sql, array $values): bool
Severity: Minor
Found in gestoria/Db.php by phpcodesniffer

Method name "DB::get_scalar" is not in camel caps format
Open

public function get_scalar(string $query): string
Severity: Minor
Found in gestoria/Db.php by phpcodesniffer

Method name "DB::get_query" is not in camel caps format
Open

public function get_query(string $query, array $params = []): array
Severity: Minor
Found in gestoria/Db.php by phpcodesniffer

The method get_query is not named in camelCase.
Open

public function get_query(string $query, array $params = []): array
{
$result = null;
try {
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Severity: Minor
Found in gestoria/Db.php by phpmd

The method get_scalar is not named in camelCase.
Open

public function get_scalar(string $query): string
{
$result = null;
$statement = null;
try {
Severity: Minor
Found in gestoria/Db.php by phpmd

The method execute_query is not named in camelCase.
Open

public function execute_query(string $sql, array $values): bool
{
try {
$result = $this->connection->prepare($sql)->execute($values);
if (IS_DEVELOPMENT) {
Severity: Minor
Found in gestoria/Db.php by phpmd

There are no issues that match your filters.

Category
Status