e107inc/e107

View on GitHub
e107_handlers/model_class.php

Summary

Maintainability
C
1 day
Test Coverage
F
43%

File model_class.php has 2130 lines of code (exceeds 2000 allowed). Consider refactoring.
Open

<?php
/*
 * e107 website system
 *
 * Copyright (C) 2008-2010 e107 Inc (e107.org)
Severity: Major
Found in e107_handlers/model_class.php - About 5 hrs to fix

    Avoid too many return statements within this method.
    Open

            return $default;
    Severity: Major
    Found in e107_handlers/model_class.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $this;
      Severity: Major
      Found in e107_handlers/model_class.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $default;
        Severity: Major
        Found in e107_handlers/model_class.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return (isset($arr[$index]) ? $arr[$index] : $default);
          Severity: Major
          Found in e107_handlers/model_class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return $value[$index];
            Severity: Major
            Found in e107_handlers/model_class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return $this->{$data_src}[$key];
              Severity: Major
              Found in e107_handlers/model_class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $default;
                Severity: Major
                Found in e107_handlers/model_class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $data;
                  Severity: Major
                  Found in e107_handlers/model_class.php - About 30 mins to fix

                    Argument 3 (index) is int but \e_model::_getData() takes null defined at /code/e107_handlers/model_class.php:951
                    Open

                            return $this->_getData($key, $default, $index);
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Assigning false to property but \e_tree_model->_total is string
                    Open

                        protected $_total = false;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Returning type bool|false|string but countResults() is declared to return int
                    Open

                            return $this->_total;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Default value for \boolen $from_post can't be true
                    Open

                        public function save($from_post = true, $force = false, $session_messages = false)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Returning type array but getIfPosted() is declared to return string
                    Open

                                return e107::unserialize($this->getData((string) $key, $default, $index));    
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Returning type false but dbInsert() is declared to return int
                    Open

                                return false;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 3 (index) is int but \e_front_model::_getData() takes null defined at /code/e107_handlers/model_class.php:951
                    Open

                            return $this->_getData($key, $default, $index, '_posted_data');
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Default value for \boolen $from_post can't be true
                    Open

                        public function save($from_post = true, $force = false, $session_messages = false)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Suspicious array access to ?mixed
                    Open

                                $item['_depth'] = $depth;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Assigning array{} to property but \e_front_model->data_has_changed is bool|false
                    Open

                            $this->data_has_changed = array();
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Parameter $from_post has undeclared type \boolen (Did you mean bool)
                    Open

                        public function save($from_post = true, $force = false, $session_messages = false)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Returning type array but getRowsList() is declared to return false
                    Open

                            return $sql->rows();
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Saw possibly unextractable annotation for a fragment of comment '* @param array &rows The remaining rows that have yet to be converted into children of nodes': after array, did not see an element name (will guess based on comment order)
                    Open

                         * @param array &rows The remaining rows that have yet to be converted into children of nodes
                    Severity: Info
                    Found in e107_handlers/model_class.php by phan

                    Argument 1 (node_id) is string but \e_tree_model::isNode() takes int defined at /code/e107_handlers/model_class.php:3813
                    Open

                            if (null !== $node_id && $this->isNode($node_id))
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Declaration of function delete(mixed $ids, bool|true $destroy = null, bool|false $session_messages = null) : int should be compatible with function delete($ids, bool|mixed $destroy = null, mixed $session_messages = null) : void defined in /code/e107_handlers/model_class.php:3940
                    Open

                        public function delete($ids, $destroy = true, $session_messages = false)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Returning type array{validator_valid_data:array,model_modified_ismodfied:bool,model_modified_data:mixed,posted_data:mixed,model_base_data:mixed,model_base_ismodfied:bool,optional_validation_rules:array,validation_rules:array} but saveDebug() is declared to return void
                    Open

                            if($return) return $ret;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Parameter $from_post has undeclared type \boolen (Did you mean bool)
                    Open

                        public function insert($from_post = true, $session_messages = false)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 1 (node_id) is string but \e_tree_model::getNode() takes int defined at /code/e107_handlers/model_class.php:3783
                    Open

                                return $this->getNode($node_id)->toString($AddSlashes);
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Assigning array{} to property but \e_model->_field_input_types is string
                    Open

                        protected $_field_input_types = array();
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Assigning array{} to property but \e_model->_url is string
                    Open

                        protected $_url = array();
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Assigning int to property but \e_tree_model->_total is bool|false|string
                    Open

                            $this->_total = $num;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Method \e_model::__get is declared to return mixed but has no return value
                    Open

                        public function __get($key)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 1 (str) is null but \e_front_model::setCacheString() takes string defined at /code/e107_handlers/model_class.php:1664
                    Open

                            return parent::setCacheString($str);
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Reference to undeclared property \e_db->total_results
                    Open

                                $this->_total = $sql->total_results = false;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Call to method mergePostedData on non-class type ?array|?mixed
                    Open

                                    $ret = $value->mergePostedData(false, true, true);
                    Severity: Critical
                    Found in e107_handlers/model_class.php by phan

                    Saw misspelled annotation @returns. Did you mean @return?
                    Open

                         * @returns null
                    Severity: Info
                    Found in e107_handlers/model_class.php by phan

                    Saw misspelled annotation @returns. Did you mean @return?
                    Open

                         * @returns null
                    Severity: Info
                    Found in e107_handlers/model_class.php by phan

                    Argument 1 (node_id) is string but \e_admin_tree_model::getNode() takes int defined at /code/e107_handlers/model_class.php:3783
                    Open

                                            call_user_func(array($this->getNode(trim($id)), 'destroy')); // first call model destroy method if any
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 4 (noWhere) is 'default' but \e_db::select() takes bool|false defined at /code/e107_handlers/e_db_interface.php:265
                    Open

                                    $this->getModelTable(),
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Assigning null to property but \e_front_model->_validator is \e_validator
                    Open

                            $this->_validator = null;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Parameter $from_post has undeclared type \boolen (Did you mean bool)
                    Open

                        public function save($from_post = true, $force = false, $session_messages = false)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Returning type false but dbInsert() is declared to return int
                    Open

                                return false;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Saw misspelled annotation @returns. Did you mean @return?
                    Open

                         * @returns null
                    Severity: Info
                    Found in e107_handlers/model_class.php by phan

                    array to string conversion
                    Open

                                            $this->_addData($key.'/'.$k, $v, $override, $data_src);
                    Severity: Info
                    Found in e107_handlers/model_class.php by phan

                    Argument 2 (node_id) is null but \e_tree_model::toString() takes string defined at /code/e107_handlers/model_class.php:3915
                    Open

                                $this->toString(false, null, $this->getParam('nocount') ? false : true),
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Call to undeclared method \e_model::removePostedData
                    Open

                                $this->setData($field, $dt, $strict)
                    Severity: Critical
                    Found in e107_handlers/model_class.php by phan

                    Assigning null to property but \e_front_model->_db_errno is int
                    Open

                            $this->_db_errno = null;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Assigning array{} to property but \e_model->_featurebox is string
                    Open

                        protected $_featurebox = array();
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 2 (session) is null but \e_front_model::addMessageDebug() takes bool|false defined at /code/e107_handlers/model_class.php:1430
                    Open

                                $this->addMessageDebug('SQL Qry: '.print_a($qry,true), null);
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Method \e_model::__isset is declared to return bool but has no return value
                    Open

                        public function __isset($key)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Default value for \boolen $from_post can't be true
                    Open

                        public function insert($from_post = true, $session_messages = false)
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 1 (url) is array but \e_model::setUrl() takes string defined at /code/e107_handlers/model_class.php:615
                    Open

                                if($this->getUrl()) $model->setUrl($this->getUrl()); // copy url config data if available
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Returning type false but export() is declared to return null
                    Open

                                return false;
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 1 (xmlprefs) is null but \xmlClass::e107Export() takes array defined at /code/e107_handlers/xml_class.php:953
                    Open

                            e107::getXml()->e107Export(null,$table,null,null, array('file'=>$filename,'query'=>$query));
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Argument 2 (node) is null but \e_admin_tree_model::setNode() takes \e_model defined at /code/e107_handlers/model_class.php:3795
                    Open

                                            $this->setNode($id, null);
                    Severity: Minor
                    Found in e107_handlers/model_class.php by phan

                    Call to undeclared method \e_db::db_CopyRow
                    Open

                            $res = $sql->db_CopyRow($this->getModelTable(), "*", $this->getFieldIdName().' IN ('.$idstr.')');
                    Severity: Critical
                    Found in e107_handlers/model_class.php by phan

                    There are no issues that match your filters.

                    Category
                    Status