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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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 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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

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
Severity
Category
Status
Source
Language