Completed
Push — develop ( 505f0b...e8b338 )
by Peter
01:58
created

SqlFile::eachQuery()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.2
cc 4
eloc 8
nc 4
nop 1
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-2016 Webino, s. r. o. (http://webino.sk)
7
 * @license     The BSD 3-Clause License
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