Goracash/goracash-api-php-client

View on GitHub

Showing 22 of 38 total issues

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

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

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

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

Function __construct has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

public function __construct($config = null)
{
if (is_string($config) && strlen($config)) {
$config = new Config($config);
}
Severity: Minor
Found in src/Client.php - About 55 mins to fix

Function reverseJsonInContext has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

protected function reverseJsonInContext(array &$context)
{
if (!$context) {
return;
}
Severity: Minor
Found in src/Logger/Primary.php - About 55 mins to fix

Function executeRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

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

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

protected function export($value)
{
if (is_string($value)) {
if ($this->allowNewLines) {
return $value;
Severity: Minor
Found in src/Logger/Primary.php - About 45 mins to fix

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

public function parseHttpResponse($respData, $headerSize)
{
// check proxy header
foreach (self::$connectionEstablishedHeaders as $establishedHeader) {
if (stripos($respData, $establishedHeader) !== false) {
Severity: Minor
Found in src/IO/Primary.php - About 45 mins to fix

Function __construct has a Cognitive Complexity of 8 (exceeds 5 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 45 mins to fix

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

private function parseStringHeaders($rawHeaders)
{
$headers = array();
$responseHeaderLines = explode("\r\n", $rawHeaders);
foreach ($responseHeaderLines as $headerLine) {
Severity: Minor
Found in src/IO/Primary.php - About 45 mins to fix

Function parseQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

private function parseQuery($string)
{
$return = array();
$parts = explode("&", $string);
foreach ($parts as $part) {
Severity: Minor
Found in src/Http/Request.php - About 35 mins to fix

Function buildQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

private function buildQuery($parts)
{
$return = array();
foreach ($parts as $key => $value) {
if (is_array($value)) {
Severity: Minor
Found in src/Http/Request.php - About 35 mins to fix

Avoid too many return statements within this method.
Open

return @json_encode($value, $options);
Severity: Major
Found in src/Logger/Primary.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

return str_replace('\\/', '/', @json_encode($value));
Severity: Major
Found in src/Logger/Primary.php - About 30 mins to fix
Severity
Category
Status
Source
Language