| 1 | <?php |
||
| 7 | final class HeaderStrategy implements HeaderStrategyInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var callable |
||
| 11 | */ |
||
| 12 | private $getHeadersCallable; |
||
| 13 | |||
| 14 | private function __construct(callable $getHeadersCallable) |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Create header strategy which derives the headers from the first line of the file. |
||
| 21 | * |
||
| 22 | * @return HeaderstrategyInterface |
||
| 23 | */ |
||
| 24 | public static function derive() : HeaderStrategyInterface |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Create header strategy which uses the provided headers array. |
||
| 37 | * |
||
| 38 | * @return HeaderstrategyInterface |
||
| 39 | */ |
||
| 40 | public static function provide(array $headers) : HeaderStrategyInterface |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Create header strategy which generates a numeric array whose size is the number of columns in the given file. |
||
| 51 | * |
||
| 52 | * @return HeaderstrategyInterface |
||
| 53 | */ |
||
| 54 | public static function none() : HeaderStrategyInterface |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Extracts headers from the given SplFileObject. |
||
| 68 | * |
||
| 69 | * @param SplFileObject $fileObject The delimited file containing the headers. |
||
| 70 | * |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | public function getHeaders(SplFileObject $fileObject) : array |
||
| 77 | } |
||
| 78 |