These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file is part of the League.csv library |
||
4 | * |
||
5 | * @license http://opensource.org/licenses/MIT |
||
6 | * @link https://github.com/thephpleague/csv/ |
||
7 | * @version 9.0.0 |
||
8 | * @package League.csv |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | declare(strict_types=1); |
||
14 | |||
15 | namespace League\Csv; |
||
16 | |||
17 | use IteratorIterator; |
||
18 | use Traversable; |
||
19 | |||
20 | /** |
||
21 | * A simple MapIterator |
||
22 | * |
||
23 | * @package League.csv |
||
24 | * @since 3.3.0 |
||
25 | * @author Ignace Nyamagana Butera <[email protected]> |
||
26 | * @internal used internally to modify CSV content |
||
27 | * |
||
28 | */ |
||
29 | class MapIterator extends IteratorIterator |
||
30 | { |
||
31 | /** |
||
32 | * The function to be apply on all InnerIterator element |
||
33 | * |
||
34 | * @var callable |
||
35 | */ |
||
36 | protected $callable; |
||
37 | |||
38 | /** |
||
39 | * The Constructor |
||
40 | * |
||
41 | * @param Traversable $iterator |
||
42 | * @param callable $callable |
||
43 | */ |
||
44 | 64 | public function __construct(Traversable $iterator, callable $callable) |
|
45 | { |
||
46 | 64 | parent::__construct($iterator); |
|
47 | 64 | $this->callable = $callable; |
|
48 | 64 | } |
|
49 | |||
50 | /** |
||
51 | * Get the value of the current element |
||
52 | */ |
||
53 | 50 | public function current() |
|
54 | { |
||
55 | 50 | return ($this->callable)(parent::current(), parent::key()); |
|
0 ignored issues
–
show
|
|||
56 | } |
||
57 | } |
||
58 |
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:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.