elchris/easysql

View on GitHub

Showing 8 of 8 total issues

Method getInsertQueryAndPropsForBeanArrayAndTable has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getInsertQueryAndPropsForBeanArrayAndTable($beanArray, $tableName = null)
    {
        //TODO Refactor this.
        $firstBean = $beanArray[0];
        $reflectionProps = $firstBean->getReflectionClass()->getProperties();
Severity: Minor
Found in com/github/elchris/easysql/EasySQLBeanQuery.php - About 1 hr to fix

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

        public function getInsertQueryAndPropsForBeanArrayAndTable($beanArray, $tableName = null)
        {
            //TODO Refactor this.
            $firstBean = $beanArray[0];
            $reflectionProps = $firstBean->getReflectionClass()->getProperties();
    Severity: Minor
    Found in com/github/elchris/easysql/EasySQLBeanQuery.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

    Method setProps has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private function setProps(&$arr, $host, $db, $u, $p)
    Severity: Minor
    Found in com/github/elchris/easysql/EasySQLConfig.php - About 35 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct($connectionString, $u, $p, $testMode = false, $driverOptions = array())
      Severity: Minor
      Found in com/github/elchris/easysql/EasySQLDB.php - About 35 mins to fix

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

            private function bindParams($params, IEasySQLDBStatement $stmt)
            {
                if (!is_null($params)) {
                    if (isset($params[0])) {
                        $this->bindIndexedParameters($params, $stmt);
        Severity: Minor
        Found in com/github/elchris/easysql/EasySQL.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 true;
        Severity: Major
        Found in com/github/elchris/easysql/EasySQLQueryAnalyzer.php - About 30 mins to fix

          Function runQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function runQuery($query, $params = null, $emptyBean = null, $isWrite = false)
              {
                  $connection = $this->getQueryConnection($query);
                  $stmt = $connection->prepareQuery($query);
                  if (!is_null($params)) {
          Severity: Minor
          Found in com/github/elchris/easysql/EasySQL.php - About 25 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 getPropertiesFromBean has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getPropertiesFromBean(IEasySQLBean $bean)
              {
                  $props = array();
                  foreach ($bean->getReflectionClass()->getProperties() as $beanProp) {
                      if ($beanProp->isPublic()) {
          Severity: Minor
          Found in com/github/elchris/easysql/EasySQLBeanQuery.php - About 25 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

          Severity
          Category
          Status
          Source
          Language