| Total Complexity | 3 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 6 | class Tag extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb |
||
| 7 | { |
||
| 8 | |||
| 9 | /** |
||
| 10 | * DB Storage table name |
||
| 11 | */ |
||
| 12 | const TABLE_NAME = 'integernet_async_varnish_tags'; |
||
| 13 | |||
| 14 | /* must be protected */ |
||
| 15 | protected function _construct() //phpcs:ignore MEQP2.PHP.ProtectedClassMember.FoundProtected |
||
| 16 | { |
||
| 17 | $this->_init(self::TABLE_NAME, 'entity_id'); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function getMaxTagId(int $limit):array |
||
| 21 | { |
||
| 22 | $connection = $this->getConnection(); |
||
| 23 | |||
| 24 | $subSetSelect = $connection->select()->from( |
||
| 25 | self::TABLE_NAME, |
||
|
|
|||
| 26 | ['entity_id','tag'] |
||
| 27 | )->order( |
||
| 28 | 'entity_id', |
||
| 29 | 'ASC' |
||
| 30 | )->limit( |
||
| 31 | $limit |
||
| 32 | ); |
||
| 33 | |||
| 34 | $maxIdSelect = $connection->select()->from( |
||
| 35 | $subSetSelect, |
||
| 36 | ['max_id'=>'MAX(entity_id)'] |
||
| 37 | ); |
||
| 38 | |||
| 39 | return $connection->fetchRow($maxIdSelect); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getUniqueTagsByMaxId(int $maxId):array |
||
| 57 | } |
||
| 58 | } |
||
| 59 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.