1 | <?php |
||
21 | class CsvFileObject extends \SplFileObject implements \JsonSerializable, \Countable |
||
22 | { |
||
23 | /** |
||
24 | * The fields of a row. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $fields; |
||
29 | |||
30 | public $rows; |
||
31 | |||
32 | /** |
||
33 | * SplFileObject constructor. |
||
34 | * |
||
35 | * Setup SplFileObject in CSV read-mode. |
||
36 | */ |
||
37 | 11 | public function __construct($filename, $open_mode = "r", $use_include_path = false, $context = null) |
|
43 | |||
44 | /** |
||
45 | * Get determined fields for this csv file. |
||
46 | */ |
||
47 | 2 | public function getFields() |
|
51 | |||
52 | /** |
||
53 | * Fetch fields from the current row. |
||
54 | * |
||
55 | * This method should only be called when file is rewound. |
||
56 | */ |
||
57 | 11 | protected function processHeader() |
|
62 | |||
63 | /** |
||
64 | * Rewind file and fetch fields from first row. |
||
65 | */ |
||
66 | 8 | public function rewind() |
|
71 | |||
72 | /** |
||
73 | * Map row into fields. |
||
74 | */ |
||
75 | 7 | public function current() |
|
84 | |||
85 | 8 | public function valid() |
|
93 | |||
94 | /** |
||
95 | * Subtract 1 row from index, so that we don't include the header in our count. |
||
96 | */ |
||
97 | 9 | public function key() |
|
101 | |||
102 | /** |
||
103 | * Add 1 to skip the header when seeking. |
||
104 | */ |
||
105 | 4 | public function seek($position) |
|
112 | |||
113 | /** |
||
114 | * Implements jsonSerialize. |
||
115 | */ |
||
116 | 3 | public function jsonSerialize() |
|
120 | |||
121 | /** |
||
122 | * Implements Countable. |
||
123 | */ |
||
124 | 3 | public function count() |
|
132 | } |
||
133 |
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.