polyfony-inc/polyfony

View on GitHub

Showing 69 of 84 total issues

Function packAndMinifyScripts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private static function packAndMinifyScripts() :void {
        // if we are allowed to pack js files
        if(self::isPackingOfTheseAssetsAllowed('js')) {
            // generate a unique name for a pack that contains that list of scripts only
            list(
Severity: Minor
Found in Private/Polyfony/Response/HTML.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 authenticateByForm has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected static function authenticateByForm() :void {
        
        // look for users with this login
        $account = \Models\Accounts::getByLogin(
            Request::post( Config::get('security', 'login') )
Severity: Minor
Found in Private/Polyfony/Security.php - About 1 hr to fix

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

    public function getPermissions(
        // if we want to keep a trace of what that permission whas inherited from
        bool $with_parent_role_id = false
    ) :array {

Severity: Minor
Found in Private/Polyfony/Security/Accounts/PermissionsAccessors.php - About 1 hr to fix

Method getBody has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getBody(
        Dropdown $security_dropdown
    ) : Dropdown {

        $account = \Polyfony\Security::getAccount();
Severity: Minor
Found in Private/Polyfony/Profiler/HTML/Security.php - About 1 hr to fix

Method hasValidSignature has 40 lines of code (exceeds 25 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 1 hr to fix

Method getQueriesAndTheirDuration has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function getQueriesAndTheirDuration($stack) {

        $queries_count = 0;
        $queries_duration = 0;
        $queries = [];
Severity: Minor
Found in Private/Polyfony/Profiler/HTML/Queries.php - About 1 hr to fix

Method configureAndGetDSN has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function configureAndGetDSN() :string {

        // alter the configuration
        self::$_config = array(
            'driver'    => Config::get('database','driver'),
Severity: Minor
Found in Private/Polyfony/Database.php - About 1 hr to fix

Method setLinks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function setLinks(
        array $links, 
        bool $replace_existing=false
    ) :void {
        // if we want to purge existing links
Severity: Minor
Found in Private/Polyfony/Response/HTML.php - About 1 hr to fix

Method getBody has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function getBody($data) {

        $timing_body = [];
        // for each stacked element
        foreach($data['stack'] as $elem) {
Severity: Minor
Found in Private/Polyfony/Profiler/HTML/Timing.php - About 1 hr to fix

Method forward has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function forward(Route $route) :void {

        // get the full destination
        list(
            $script, 
Severity: Minor
Found in Private/Polyfony/Router.php - About 1 hr to fix

Method valueForDatabase has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function valueForDatabase(string $column, $value) {
        // if we find a serialization keyword
        if(strpos($column,'_array') !== false) {
            // encode the content as JSON, being it array, null, false, whatever
            $value = json_encode($value);
Severity: Minor
Found in Private/Polyfony/Query/Convert.php - About 1 hr to fix

Method getLogs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function getLogs($stack) {

        $logs_count = 0;
        $logs = [];

Severity: Minor
Found in Private/Polyfony/Profiler/HTML/Logs.php - About 1 hr to fix

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

    public function save() :bool {
        
        // if nothing has changed on this object
        if(!count($this->_['altered'])) {
            // we consider the object saved without touching the database
Severity: Minor
Found in Private/Polyfony/Entity/Aware.php - About 1 hr to fix

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

    public function getAccounts() :array {

        
        return array_unique(array_merge(
            // get account with that permissions directly assigned to them
Severity: Minor
Found in Private/Polyfony/Security/AccountsPermissions.php - About 1 hr to fix

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

    public function set(
        $column_or_array, 
        $value = null
    ) {
        // if we want to set a batch of values
Severity: Minor
Found in Private/Polyfony/Entity/Aware.php - About 1 hr to fix

Method whereIn has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function whereIn(array $conditions, bool $invert=false) :self {
        // for each provided strict condition
        foreach($conditions as $column => $values) {
            // if we have to conditions
            if(!is_array($values) || empty($values)) {
Severity: Minor
Found in Private/Polyfony/Query/Conditions.php - About 1 hr to fix

Method packAndMinifyScripts has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function packAndMinifyScripts() :void {
        // if we are allowed to pack js files
        if(self::isPackingOfTheseAssetsAllowed('js')) {
            // generate a unique name for a pack that contains that list of scripts only
            list(
Severity: Minor
Found in Private/Polyfony/Response/HTML.php - About 1 hr to fix

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

    final public function view(
        string $view_name, 
        $bundle_or_variables = null, 
        ?array $variables = []
    ) :void {
Severity: Minor
Found in Private/Polyfony/Controller.php - About 1 hr to fix

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

    private static function getBodyMisc(
        Dropdown $cache_dropdown
    ) :Dropdown {

        return $cache_dropdown
Severity: Minor
Found in Private/Polyfony/Profiler/HTML/Cache.php - About 1 hr to fix

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

    public static function select(
        string $name, 
        array $select_options=[], 
        $selected_value=null, 
        array $attributes=[]
Severity: Minor
Found in Private/Polyfony/Form.php - About 1 hr to fix
Severity
Category
Status
Source
Language