| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | protected function insert ( Row $row ) : void |
||
| 27 | { |
||
| 28 | if ( $this->output == null ) { |
||
| 29 | throw new SourceWatcherException( "An output must be provided." ); |
||
| 30 | } |
||
| 31 | |||
| 32 | $outputIsDatabaseOutput = $this->output instanceof DatabaseOutput; |
||
| 33 | |||
| 34 | if ( !$outputIsDatabaseOutput ) { |
||
| 35 | throw new SourceWatcherException( sprintf( "The output must be an instance of %s", DatabaseOutput::class ) ); |
||
| 36 | } |
||
| 37 | |||
| 38 | if ( $this->output->getOutput() == null ) { |
||
| 39 | throw new SourceWatcherException( "No connector found. Set a connector before trying to insert a row." ); |
||
| 40 | } |
||
| 41 | |||
| 42 | $this->output->getOutput()->insert( $row ); |
||
| 43 | } |
||
| 45 |