polyfony-inc/polyfony

View on GitHub

Showing 84 of 84 total issues

File Route.php has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
namespace Polyfony;

class Route {
Severity: Minor
Found in Private/Polyfony/Route.php - About 4 hrs to fix

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

    private function buildQuery() :void {

        // if the action is missing
        if(!$this->Action) { Throw new Exception('Query->buildQuery() : Missing action'); }
        // if action anything but query
Severity: Minor
Found in Private/Polyfony/Query.php - About 4 hrs 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

Query has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class Query extends Query\Conditions {
    
    // debugging methods (for the Profiler)
    public function getQuery() {
        return $this->Query;
Severity: Minor
Found in Private/Polyfony/Query.php - About 3 hrs to fix

Filter has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class Filter {

    const FILTERS_TO_METHODS_MAP = [
        'capslock30'=>'toUppercaseSafe30Percent',
        'capslock50'=>'toUppercaseSafe50Percent',
Severity: Minor
Found in Private/Polyfony/Entity/Filter.php - About 3 hrs to fix

Function validateThisParameter has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateThisParameter(
        $parameter_index, 
        $parameter_value
    ) :bool {
        // if a constraint exists for a parameter in that position
Severity: Minor
Found in Private/Polyfony/Route.php - About 3 hrs 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

File Emails.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Polyfony;

use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
Severity: Minor
Found in Private/Polyfony/Emails.php - About 3 hrs to fix

Response has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class Response {

    // set manually
    protected static $_content;                    // raw content before internal formatting
    protected static string $_type;                // type of the output (html/json/…)
Severity: Minor
Found in Private/Polyfony/Response.php - About 3 hrs to fix

File Query.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
namespace Polyfony;
use \PDO;
use Polyfony\Query\Convert as Convert;
Severity: Minor
Found in Private/Polyfony/Query.php - About 3 hrs to fix

Function log has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private static function log(
        int $level, 
        $message, 
        $context = null
    ) :void {
Severity: Minor
Found in Private/Polyfony/Logger.php - About 3 hrs 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

File HTML.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Polyfony\Response;

use Polyfony\{ 
Severity: Minor
Found in Private/Polyfony/Response/HTML.php - About 3 hrs to fix

File Response.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Polyfony;

class Response {
Severity: Minor
Found in Private/Polyfony/Response.php - About 2 hrs to fix

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

class Request {
    
    private static $_url;
    private static $_get;
    private static $_post;
Severity: Minor
Found in Private/Polyfony/Request.php - About 2 hrs to fix

Route has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Route {

    // url to match
    public ?string $url                        = null;
    // name of that route
Severity: Minor
Found in Private/Polyfony/Route.php - About 2 hrs to fix

Method buildQuery has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function buildQuery() :void {

        // if the action is missing
        if(!$this->Action) { Throw new Exception('Query->buildQuery() : Missing action'); }
        // if action anything but query
Severity: Major
Found in Private/Polyfony/Query.php - About 2 hrs to fix

Method formatContent has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function formatContent() :void {
        // base headers
        $headers = [];
        // case of html page
        if(self::$_type == 'html-page') {
Severity: Major
Found in Private/Polyfony/Response.php - About 2 hrs to fix

Function formatContent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private static function formatContent() :void {
        // base headers
        $headers = [];
        // case of html page
        if(self::$_type == 'html-page') {
Severity: Minor
Found in Private/Polyfony/Response.php - About 2 hrs 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

Emails has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Emails extends Entity {

    const recipients_types_to_phpmailer_methods = [
        'to'        =>'addAddress',
        'cc'        =>'addCC',
Severity: Minor
Found in Private/Polyfony/Emails.php - About 2 hrs to fix

Function hasValidSignature has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function hasValidSignature(
        array $request_parameters_indexed_by_position
    ) :bool {
        
        // if the route needs a signature to be a match
Severity: Minor
Found in Private/Polyfony/Route.php - About 2 hrs 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

File Aware.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
namespace Polyfony\Entity;
use Polyfony\Exception as Exception;
use Polyfony\Query\Convert as Convert;
Severity: Minor
Found in Private/Polyfony/Entity/Aware.php - About 2 hrs to fix

Method validateThisParameter has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function validateThisParameter(
        $parameter_index, 
        $parameter_value
    ) :bool {
        // if a constraint exists for a parameter in that position
Severity: Major
Found in Private/Polyfony/Route.php - About 2 hrs to fix
Severity
Category
Status
Source
Language