| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 41 | public function extract () : array |
||
| 42 | { |
||
| 43 | if ( $this->input == null ) { |
||
| 44 | throw new SourceWatcherException( "An input must be provided." ); |
||
| 45 | } |
||
| 46 | |||
| 47 | $inputIsFileInput = $this->input instanceof FileInput; |
||
| 48 | |||
| 49 | if ( !$inputIsFileInput ) { |
||
| 50 | throw new SourceWatcherException( sprintf( "The input must be an instance of %s", FileInput::class ) ); |
||
| 51 | } |
||
| 52 | |||
| 53 | $this->result = []; |
||
| 54 | |||
| 55 | $fileHandler = fopen( $this->input->getInput(), "r" ); |
||
| 56 | |||
| 57 | while ( $currentFileLine = fgets( $fileHandler ) ) { |
||
| 58 | array_push( $this->result, new Row( [ $this->column => trim( $currentFileLine ) ] ) ); |
||
| 59 | } |
||
| 60 | |||
| 61 | fclose( $fileHandler ); |
||
| 62 | |||
| 63 | return $this->result; |
||
| 64 | } |
||
| 66 |