cnizzardini/cakephp-yummy

View on GitHub

Showing 59 of 59 total issues

Method getModels has 31 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    public function getModels(Connection $connection, array $config) : array
    {
        $baseModel = $config['model'];
        $allowedModels = isset($config['allow']) ? $config['allow'] : [];
        $baseHumanName = $this->getHumanName($allowedModels, $baseModel);
Severity: Minor
Found in src/Service/YummySearch/Association.php - About 1 hr to fix

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

        public function getModels(Connection $connection, array $config) : array
        {
            $baseModel = $config['model'];
            $allowedModels = isset($config['allow']) ? $config['allow'] : [];
            $baseHumanName = $this->getHumanName($allowedModels, $baseModel);
    Severity: Minor
    Found in src/Service/YummySearch/Association.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

    There must not be more than one property declared per statement
    Open

        private $config,

    Blank line found at start of control structure
    Open

            foreach ($columns as $column) {

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

        private function getOptions(array $options) : array
        {
            $return = [];
    
            $keys = array_keys($options);
    Severity: Minor
    Found in src/Service/YummySearch/ViewHelper.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

    Expected 0 spaces before closing bracket; 1 found
    Open

            if( Configure::read('debug') == false ){

    Expected 1 space after FUNCTION keyword; 0 found
    Open

            $dotNotations = array_filter($dots, function($dot){

    Blank line found at start of control structure
    Open

            for ($i = 0; $i < $length; $i++) {

    Blank line found at start of control structure
    Open

            foreach ($data as $item) {

    Property name "$_defaultCode" should not be prefixed with an underscore to indicate visibility
    Open

        protected $_defaultCode = 500;

    Property name "$_defaultConfig" should not be prefixed with an underscore to indicate visibility
    Open

        protected $_defaultConfig = [

    Property name "$_defaultCode" should not be prefixed with an underscore to indicate visibility
    Open

        protected $_defaultCode = 500;

    Expected 1 space before opening brace; found 0
    Open

            $dotNotations = array_filter($dots, function($dot){

    There must not be more than one property declared per statement
    Open

        private $models = false,

    Property name "$_defaultCode" should not be prefixed with an underscore to indicate visibility
    Open

        protected $_defaultCode = 500;

    Blank line found at start of control structure
    Open

            foreach ($model['columns'] as $column => $field) {

    Blank line found at start of control structure
    Open

            foreach ($options as $key => $option) {

    Blank line found at start of control structure
    Open

            foreach ($paths as $path) {

    There must not be more than one property declared per statement
    Open

        private $model,

    Avoid too many return statements within this method.
    Open

                    return [];
    Severity: Major
    Found in src/Service/YummySearch/ViewHelper.php - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language