DesarrollosWeb/documentofacil

View on GitHub
gestoria/Procedure.php

Summary

Maintainability
C
1 day
Test Coverage

Showing 155 of 155 total issues

update_user_info accesses the super-global variable $_POST.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

update_user_info accesses the super-global variable $_POST.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

update_user_info accesses the super-global variable $_POST.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

update_user_info accesses the super-global variable $_POST.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

update_user_info accesses the super-global variable $_POST.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

File Procedure.php has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
//region Includes
include_once 'vendor/autoload.php';
include_once "Db.php";
Severity: Minor
Found in gestoria/Procedure.php - About 2 hrs to fix

Method get_order_and_procedure has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php - About 1 hr to fix

Method process has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function process(array $post, array $files): array
{
if (IS_DEVELOPMENT) {
krumo($post);
krumo($files);
Severity: Minor
Found in gestoria/Procedure.php - About 1 hr to fix

Method get_orders_current_user has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php - About 1 hr to fix

Function process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

public function process(array $post, array $files): array
{
if (IS_DEVELOPMENT) {
krumo($post);
krumo($files);
Severity: Minor
Found in gestoria/Procedure.php - About 45 mins to fix

Function get_user_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php - About 25 mins to fix

Missing class import via use statement (line '102', column '23').
Open

throw new Exception("User $email not found");
Severity: Minor
Found in gestoria/Procedure.php by phpmd

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

return DateTime::createFromFormat("Y-m-d H:i:s", $creation_date, new DateTimeZone('UTC'));
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid using static access to class 'URLify' in method 'get_user_type'.
Open

$user_type[self::DATA][$i]["display_name"] = URLify::slug($user_type[self::DATA][$i]["display_name"]);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_orders_current_user uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

} else {
$query = $this->client_query;
$params["email"] = $this->email;
$count_orders_query = $this->db->get_scalar("select count(p.id) as orders from wp_procedure p
inner join wpsw_users u on p.user_id = u.ID
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid using static access to class 'DB' in method '__construct'.
Open

$this->db = DB::getInstance();
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid using static access to class 'DateTime' in method 'createDateTimeFromString'.
Open

return DateTime::createFromFormat("Y-m-d H:i:s", $creation_date, new DateTimeZone('UTC'));
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_user_type uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

} else {
throw new Exception("User $email not found");
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid using static access to class 'URLify' in method 'process'.
Open

$path = "tramites" . "/" . URLify::slug($post["user"]) . "/";
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_orders_current_user() contains an exit expression.
Open

die($user_orders["error"]);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid using count() function in for loops.
Open

for ($i = 0; $i < count($user_type[self::DATA]); $i++) {
$user_type[self::DATA][$i]["rol"] = unserialize($user_type[self::DATA][$i]["rol"]);
$user_type[self::DATA][$i]["display_name"] = URLify::slug($user_type[self::DATA][$i]["display_name"]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid using count() function in for loops.
Open

for ($i = 0; $i < count($procedure_data[self::DATA]); $i++) {
$procedure_data[self::DATA][$i]["creation_date"] = self::createDateTimeFromString($procedure_data[self::DATA][$i]["creation_date"]);
$procedure_data[self::DATA][$i]["update_date"] = self::createDateTimeFromString($procedure_data[self::DATA][$i]["update_date"]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid using count() function in for loops.
Open

for ($i = 0; $i < count($user_orders[self::DATA]); $i++) {
$user_orders[self::DATA][$i]["creation_date"] = self::createDateTimeFromString($user_orders[self::DATA][$i]["creation_date"]);
$user_orders[self::DATA][$i]["update_date"] = self::createDateTimeFromString($user_orders[self::DATA][$i]["update_date"]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

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

private string $email;
Severity: Critical
Found in gestoria/Procedure.php by phan

Similar blocks of code found in 2 locations. Consider refactoring.
Open

for ($i = 0; $i < count($user_orders[self::DATA]); $i++) {
$user_orders[self::DATA][$i]["creation_date"] = self::createDateTimeFromString($user_orders[self::DATA][$i]["creation_date"]);
$user_orders[self::DATA][$i]["update_date"] = self::createDateTimeFromString($user_orders[self::DATA][$i]["update_date"]);
}
Severity: Major
Found in gestoria/Procedure.php and 1 other location - About 1 hr to fix
gestoria/Procedure.php on lines 189..192

Similar blocks of code found in 2 locations. Consider refactoring.
Open

for ($i = 0; $i < count($procedure_data[self::DATA]); $i++) {
$procedure_data[self::DATA][$i]["creation_date"] = self::createDateTimeFromString($procedure_data[self::DATA][$i]["creation_date"]);
$procedure_data[self::DATA][$i]["update_date"] = self::createDateTimeFromString($procedure_data[self::DATA][$i]["update_date"]);
}
Severity: Major
Found in gestoria/Procedure.php and 1 other location - About 1 hr to fix
gestoria/Procedure.php on lines 140..143

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

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

The property $order_statuses is not named in camelCase.
Open

class Procedure
{
const DATA = "data";
private string $email;
 
 
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Avoid variables with short names like $db. Configured minimum length is 3.
Open

private Db $db;
Severity: Minor
Found in gestoria/Procedure.php by phpmd

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 9 and the first side effect is on line 4.
Open

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

The property $admin_query is not named in camelCase.
Open

class Procedure
{
const DATA = "data";
private string $email;
 
 
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $user_info is not named in camelCase.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $document_name is not named in camelCase.
Open

public function add_user_file(string $user_email, string $file, int $type, string $document_name = ""): bool
{
$sql = "INSERT INTO wp_procedure_file(user_email, file_path, type, document_name)
VALUES(:user_email, :file, :type, :document_name)";
return $this->db->execute_query($sql, [
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $user_id is not named in camelCase.
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
{
return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
values(:user_id, :status_id, :procedure_type, :amount, :payment_info) ",
[
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $creation_date is not named in camelCase.
Open

private static function createDateTimeFromString(string $creation_date)
{
return DateTime::createFromFormat("Y-m-d H:i:s", $creation_date, new DateTimeZone('UTC'));
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The property $procedure_statuses is not named in camelCase.
Open

class Procedure
{
const DATA = "data";
private string $email;
 
 
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The property $client_query is not named in camelCase.
Open

class Procedure
{
const DATA = "data";
private string $email;
 
 
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $user_email is not named in camelCase.
Open

public function add_user_file(string $user_email, string $file, int $type, string $document_name = ""): bool
{
$sql = "INSERT INTO wp_procedure_file(user_email, file_path, type, document_name)
VALUES(:user_email, :file, :type, :document_name)";
return $this->db->execute_query($sql, [
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $procedure_type is not named in camelCase.
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
{
return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
values(:user_id, :status_id, :procedure_type, :amount, :payment_info) ",
[
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $procedure_id is not named in camelCase.
Open

public function change_procedure_status(string $procedure_id, int $status): bool
{
return $this->db->execute_query("update wp_procedure set status_id = :status where id = :procedure_id",
["status" => $status, "procedure_id" => $procedure_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $payment_info is not named in camelCase.
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
{
return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
values(:user_id, :status_id, :procedure_type, :amount, :payment_info) ",
[
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $procedure_id is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $procedure_id is not named in camelCase.
Open

public function remove_procedure_file(string $procedure_id, string $file_id): bool
{
return $this->db->execute_query("delete from wp_procedure_file where procedure_id = :procedure_id and id= :file_id",
["procedure_id" => $procedure_id, "file_id" => $file_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $file_id is not named in camelCase.
Open

public function remove_procedure_file(string $procedure_id, string $file_id): bool
{
return $this->db->execute_query("delete from wp_procedure_file where procedure_id = :procedure_id and id= :file_id",
["procedure_id" => $procedure_id, "file_id" => $file_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The parameter $user_email is not named in camelCase.
Open

public function get_user_files(?string $user_email = ""): array
{
if (!empty($user_email)) {
$this->email = $user_email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

Method name "Procedure::get_identification__types" is not in camel caps format
Open

public static function get_identification__types(): array
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::remove_procedure_file" is not in camel caps format
Open

public function remove_procedure_file(string $procedure_id, string $file_id): bool
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_user_type" is not in camel caps format
Open

public function get_user_type(string $email): array
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_document_types" is not in camel caps format
Open

public function get_document_types(): array
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_procedure_status" is not in camel caps format
Open

public function get_procedure_status()
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_user_files" is not in camel caps format
Open

public function get_user_files(?string $user_email = ""): array
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::add_user_file" is not in camel caps format
Open

public function add_user_file(string $user_email, string $file, int $type, string $document_name = ""): bool
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::change_procedure_status" is not in camel caps format
Open

public function change_procedure_status(string $procedure_id, int $status): bool
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::update_user_info" is not in camel caps format
Open

public function update_user_info(WP_User $user, array $user_info)
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_order_and_procedure" is not in camel caps format
Open

public function get_order_and_procedure(string $procedure_id): array
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_procedure_types" is not in camel caps format
Open

public function get_procedure_types(): array
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::create_procedure" is not in camel caps format
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_document_types_string" is not in camel caps format
Open

public function get_document_types_string(): string
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Method name "Procedure::get_orders_current_user" is not in camel caps format
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Line exceeds 120 characters; contains 134 characters
Open

$user_orders[self::DATA][$i]["update_date"] = self::createDateTimeFromString($user_orders[self::DATA][$i]["update_date"]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

return $this->db->execute_query("delete from wp_procedure_file where procedure_id = :procedure_id and id= :file_id",
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Line exceeds 120 characters; contains 144 characters
Open

$procedure_data[self::DATA][$i]["creation_date"] = self::createDateTimeFromString($procedure_data[self::DATA][$i]["creation_date"]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Line exceeds 120 characters; contains 140 characters
Open

$procedure_data[self::DATA][$i]["update_date"] = self::createDateTimeFromString($procedure_data[self::DATA][$i]["update_date"]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Line exceeds 120 characters; contains 138 characters
Open

$user_orders[self::DATA][$i]["creation_date"] = self::createDateTimeFromString($user_orders[self::DATA][$i]["creation_date"]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

on pf.type = ft.id where pf.user_email= :user_email", ["user_email" => $procedure_data[self::DATA][0]["email"]]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

["status" => $status, "procedure_id" => $procedure_id]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

["user_email" => $this->email]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

return $this->db->execute_query("update wp_procedure set status_id = :status where id = :procedure_id",
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

["status" => $status, "procedure_id" => $procedure_id]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

$post["document_name"][$i]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

return $this->db->get_query("select pf.id, file_path, wpft.type, document_name
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

["procedure_id" => $procedure_id, "file_id" => $file_id]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

["procedure_id" => $procedure_id, "file_id" => $file_id]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Multi-line function call not indented correctly; expected 16 spaces but found 20
Open

$post["document_name"][$i]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

["user_email" => $this->email]);
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

$db_result[$i] = $this->add_user_file($this->email,
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

return $this->db->execute_query("delete from wp_procedure_file where procedure_id = :procedure_id and id= :file_id",
Severity: Minor
Found in gestoria/Procedure.php by phpcodesniffer

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $creation_date is not named in camelCase.
Open

private static function createDateTimeFromString(string $creation_date)
{
return DateTime::createFromFormat("Y-m-d H:i:s", $creation_date, new DateTimeZone('UTC'));
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_files is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_email is not named in camelCase.
Open

public function get_user_files(?string $user_email = ""): array
{
if (!empty($user_email)) {
$this->email = $user_email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_email is not named in camelCase.
Open

public function add_user_file(string $user_email, string $file, int $type, string $document_name = ""): bool
{
$sql = "INSERT INTO wp_procedure_file(user_email, file_path, type, document_name)
VALUES(:user_email, :file, :type, :document_name)";
return $this->db->execute_query($sql, [
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $db_result is not named in camelCase.
Open

public function process(array $post, array $files): array
{
if (IS_DEVELOPMENT) {
krumo($post);
krumo($files);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $files_count is not named in camelCase.
Open

public function process(array $post, array $files): array
{
if (IS_DEVELOPMENT) {
krumo($post);
krumo($files);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $count_orders_query is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $count_orders_query is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_id is not named in camelCase.
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
{
return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
values(:user_id, :status_id, :procedure_type, :amount, :payment_info) ",
[
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_id is not named in camelCase.
Open

public function remove_procedure_file(string $procedure_id, string $file_id): bool
{
return $this->db->execute_query("delete from wp_procedure_file where procedure_id = :procedure_id and id= :file_id",
["procedure_id" => $procedure_id, "file_id" => $file_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $file_id is not named in camelCase.
Open

public function remove_procedure_file(string $procedure_id, string $file_id): bool
{
return $this->db->execute_query("delete from wp_procedure_file where procedure_id = :procedure_id and id= :file_id",
["procedure_id" => $procedure_id, "file_id" => $file_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $count_orders_query is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_email is not named in camelCase.
Open

public function get_user_files(?string $user_email = ""): array
{
if (!empty($user_email)) {
$this->email = $user_email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $document_types is not named in camelCase.
Open

public function get_document_types_string(): string
{
$document_types = $this->get_document_types();
$array_string = array_map(fn(array $value) => '"' . $value["type"] . '"', $document_types);
return implode(",", $array_string);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $array_string is not named in camelCase.
Open

public function get_document_types_string(): string
{
$document_types = $this->get_document_types();
$array_string = array_map(fn(array $value) => '"' . $value["type"] . '"', $document_types);
return implode(",", $array_string);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $document_types is not named in camelCase.
Open

public function get_document_types_string(): string
{
$document_types = $this->get_document_types();
$array_string = array_map(fn(array $value) => '"' . $value["type"] . '"', $document_types);
return implode(",", $array_string);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $db_result is not named in camelCase.
Open

public function process(array $post, array $files): array
{
if (IS_DEVELOPMENT) {
krumo($post);
krumo($files);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_type is not named in camelCase.
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
{
return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
values(:user_id, :status_id, :procedure_type, :amount, :payment_info) ",
[
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_info is not named in camelCase.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_files is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $document_name is not named in camelCase.
Open

public function add_user_file(string $user_email, string $file, int $type, string $document_name = ""): bool
{
$sql = "INSERT INTO wp_procedure_file(user_email, file_path, type, document_name)
VALUES(:user_email, :file, :type, :document_name)";
return $this->db->execute_query($sql, [
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $files_count is not named in camelCase.
Open

public function process(array $post, array $files): array
{
if (IS_DEVELOPMENT) {
krumo($post);
krumo($files);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_type is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $array_string is not named in camelCase.
Open

public function get_document_types_string(): string
{
$document_types = $this->get_document_types();
$array_string = array_map(fn(array $value) => '"' . $value["type"] . '"', $document_types);
return implode(",", $array_string);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $payment_info is not named in camelCase.
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
{
return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
values(:user_id, :status_id, :procedure_type, :amount, :payment_info) ",
[
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_id is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_files is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_info is not named in camelCase.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $user_orders is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $db_result is not named in camelCase.
Open

public function process(array $post, array $files): array
{
if (IS_DEVELOPMENT) {
krumo($post);
krumo($files);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_data is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The variable $procedure_id is not named in camelCase.
Open

public function change_procedure_status(string $procedure_id, int $status): bool
{
return $this->db->execute_query("update wp_procedure set status_id = :status where id = :procedure_id",
["status" => $status, "procedure_id" => $procedure_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_user_type is not named in camelCase.
Open

public function get_user_type(string $email): array
{
if (empty($email)) {
$email = $this->email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_orders_current_user is not named in camelCase.
Open

public function get_orders_current_user(array $limit = ["start" => 0, "items" => 10]): array
{
$user_type = $this->get_user_type($this->email);
$params = [];
if (isset($user_type["rol"]["administrator"])) {
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method change_procedure_status is not named in camelCase.
Open

public function change_procedure_status(string $procedure_id, int $status): bool
{
return $this->db->execute_query("update wp_procedure set status_id = :status where id = :procedure_id",
["status" => $status, "procedure_id" => $procedure_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_user_files is not named in camelCase.
Open

public function get_user_files(?string $user_email = ""): array
{
if (!empty($user_email)) {
$this->email = $user_email;
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_document_types_string is not named in camelCase.
Open

public function get_document_types_string(): string
{
$document_types = $this->get_document_types();
$array_string = array_map(fn(array $value) => '"' . $value["type"] . '"', $document_types);
return implode(",", $array_string);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_procedure_types is not named in camelCase.
Open

public function get_procedure_types(): array
{
return $this->db->get_query("select id, name from wp_procedure_type")[self::DATA];
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method add_user_file is not named in camelCase.
Open

public function add_user_file(string $user_email, string $file, int $type, string $document_name = ""): bool
{
$sql = "INSERT INTO wp_procedure_file(user_email, file_path, type, document_name)
VALUES(:user_email, :file, :type, :document_name)";
return $this->db->execute_query($sql, [
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_document_types is not named in camelCase.
Open

public function get_document_types(): array
{
return $this->db->get_query("select id, type from wp_procedure_file_type")[self::DATA];
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method update_user_info is not named in camelCase.
Open

public function update_user_info(WP_User $user, array $user_info)
{
array_pop($user_info);
foreach ($user_info as $key => $value) {
add_user_meta($user->ID, $key, $value, true);
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_procedure_status is not named in camelCase.
Open

public function get_procedure_status()
{
return $this->db->get_query("select id, status from wp_procedure_status")[self::DATA];
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_order_and_procedure is not named in camelCase.
Open

public function get_order_and_procedure(string $procedure_id): array
{
$procedure_data = $this->db->get_query("select p.id,
creation_date,
update_date,
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method create_procedure is not named in camelCase.
Open

public function create_procedure(int $user_id, int $procedure_type, float $amount, string $payment_info): bool
{
return $this->db->execute_query(" insert into wp_procedure(user_id,status_id,procedure_type,amount,payment_info)
values(:user_id, :status_id, :procedure_type, :amount, :payment_info) ",
[
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method remove_procedure_file is not named in camelCase.
Open

public function remove_procedure_file(string $procedure_id, string $file_id): bool
{
return $this->db->execute_query("delete from wp_procedure_file where procedure_id = :procedure_id and id= :file_id",
["procedure_id" => $procedure_id, "file_id" => $file_id]);
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd

The method get_identification__types is not named in camelCase.
Open

public static function get_identification__types(): array
{
return ["NIE" => "NIE", "DNI" => "DNI", "PASAPORTE" => "PASAPORTE"];
}
Severity: Minor
Found in gestoria/Procedure.php by phpmd
Category
Status