Goracash/goracash-api-php-client

View on GitHub

Showing 38 of 38 total issues

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

<?php
/**
* Copyright 2015 Goracash
*
* This program is free software: you can redistribute it and/or modify
Severity: Major
Found in src/Service/LeadEstimationPro.php and 1 other location - About 1 day to fix
src/Service/LeadEstimation.php on lines 1..98

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

<?php
/**
* Copyright 2015 Goracash
*
* This program is free software: you can redistribute it and/or modify
Severity: Major
Found in src/Service/LeadEstimation.php and 1 other location - About 1 day to fix
src/Service/LeadEstimationPro.php on lines 1..98

Request has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request
{
const GZIP_UA = " (gzip)";
 
protected $queryParams;
Severity: Minor
Found in src/Http/Request.php - About 4 hrs to fix

Client has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class Client
{
const LIBVER = "1.0.0";
const USER_AGENT_SUFFIX = "goracash-api-php-client/";
 
Severity: Minor
Found in src/Client.php - About 2 hrs to fix

Method executeRequest has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function executeRequest(Request $request)
{
$curl = curl_init();
 
if ($request->getPostBody()) {
Severity: Major
Found in src/IO/Curl.php - About 2 hrs to fix

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

public function checkPeriod($startDate, $endDate)
{
$isValidStartDate = $this->utils->isSystemDatetime($startDate);
$isValidEndDate = $this->utils->isSystemDatetime($endDate);
if (!$isValidEndDate || !$isValidStartDate) {
Severity: Major
Found in src/Service/Phone.php and 1 other location - About 2 hrs to fix
src/Service/Web.php on lines 74..90

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

public function checkPeriod($startDate, $endDate)
{
$isValidStartDate = $this->utils->isSystemDatetime($startDate);
$isValidEndDate = $this->utils->isSystemDatetime($endDate);
if (!$isValidEndDate || !$isValidStartDate) {
Severity: Major
Found in src/Service/Web.php and 1 other location - About 2 hrs to fix
src/Service/Phone.php on lines 210..226

Config has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Config
{
const GZIP_DISABLED = true;
const GZIP_ENABLED = false;
const GZIP_UPLOADS_ENABLED = true;
Severity: Minor
Found in src/Config.php - About 2 hrs to fix

Method __construct has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function __construct($iniFileLocation = null)
{
$this->configuration = array(
// The application_name is included in the User-Agent HTTP header.
'application_name' => '',
Severity: Minor
Found in src/Config.php - About 1 hr to fix

Avoid excessively long variable names like $connectionEstablishedHeaders. Keep variable name length under 20.
Open

private static $connectionEstablishedHeaders = array(
"HTTP/1.0 200 Connection established\r\n\r\n",
"HTTP/1.1 200 Connection established\r\n\r\n",
);
Severity: Minor
Found in src/IO/Primary.php by phpmd

Function checkFormFields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

public function checkFormFields(array &$fields)
{
$requiredFields = array('gender', 'firstname', 'lastname', 'email', 'phone', 'offer');
foreach ($requiredFields as $requiredField) {
if ($this->utils->isEmpty($fields[$requiredField])) {
Severity: Minor
Found in src/Service/SubscriptionAcademic.php - About 1 hr to fix

Avoid using undefined variables such as '$params' which will lead to PHP notices.
Open

$response = $this->execute('/cbStats', $params);
Severity: Minor
Found in src/Service/Phone.php by phpmd

Avoid using undefined variables such as '$params' which will lead to PHP notices.
Open

$params['date_lbound'] = $startDate;
Severity: Minor
Found in src/Service/Phone.php by phpmd

Avoid using undefined variables such as '$params' which will lead to PHP notices.
Open

$params['date_ubound'] = $endDate;
Severity: Minor
Found in src/Service/Phone.php by phpmd

Avoid using undefined variables such as '$params' which will lead to PHP notices.
Open

$params['date_lbound'] = $startDate;
Severity: Minor
Found in src/Service/Phone.php by phpmd

Avoid using undefined variables such as '$params' which will lead to PHP notices.
Open

$response = $this->execute('/' . $phone . '/cbStats', $params);
Severity: Minor
Found in src/Service/Phone.php by phpmd

Avoid using undefined variables such as '$params' which will lead to PHP notices.
Open

$params['date_ubound'] = $endDate;
Severity: Minor
Found in src/Service/Phone.php by phpmd

Method normalizeParams has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function normalizeParams(array &$params)
{
$availableParams = array(
'date_lbound' => '',
'date_ubound' => '',
Severity: Minor
Found in src/Service/Contact.php - About 1 hr to fix

Function checkDates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

public function checkDates(array &$params)
{
if (!empty($params['dates'])) {
foreach ($params['dates'] as $date) {
if (!$this->utils->isSystemDate($date)) {
Severity: Minor
Found in src/Service/DataDaily.php - About 1 hr to fix

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

public function checkFormFields(array &$fields)
{
$requiredFields = array('gender', 'firstname', 'lastname', 'email', 'phone', 'offer');
foreach ($requiredFields as $requiredField) {
if ($this->utils->isEmpty($fields[$requiredField])) {
Severity: Minor
Found in src/Service/SubscriptionAcademic.php - About 1 hr to fix
Severity
Category
Status
Source
Language