SqlFile   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A eachQuery() 0 13 4
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoDbDump/ for the canonical source repository
6
 * @copyright   Copyright (c) 2014-2017 Webino, s. r. o. (http://webino.sk)
7
 * @license     BSD-3-Clause
8
 */
9
10
namespace WebinoDbDump\Db\Sql;
11
12
use SplFileObject;
13
14
/**
15
 * Sql file
16
 *
17
 * @author Peter Bačinský <[email protected]>
18
 */
19
class SqlFile extends SplFileObject implements SqlInterface
20
{
21
    use SqlTrait;
22
23
    /**
24
     * @param callable $callback
25
     */
26
    protected function eachQuery(callable $callback)
27
    {
28
        while ($line = parent::current()) {
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (current() instead of eachQuery()). Are you sure this is correct? If so, you might want to change this to $this->current().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
29
            parent::next();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (next() instead of eachQuery()). Are you sure this is correct? If so, you might want to change this to $this->next().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
30
31
            $result = call_user_func($callback, $line);
32
            if (false === $result) {
33
                continue;
34
            } elseif (true === $result) {
35
                break;
36
            }
37
        }
38
    }
39
}
40