| Total Complexity | 5 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | abstract class BaseFormatter |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var GenericIterator|Row |
||
| 13 | */ |
||
| 14 | protected $object; |
||
| 15 | |||
| 16 | abstract public function raw(); |
||
| 17 | |||
| 18 | abstract public function toText(); |
||
| 19 | |||
| 20 | public function saveToFile($filename) |
||
| 21 | { |
||
| 22 | if (empty($filename)) { |
||
| 23 | throw new InvalidArgumentException("Filename cannot be empty"); |
||
| 24 | } |
||
| 25 | file_put_contents($filename, $this->toText()); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * $object AnyDataset|Row |
||
| 30 | */ |
||
| 31 | public function __construct($object) |
||
| 37 | } |
||
| 38 | } |