| 1 | <?php |
||
| 7 | abstract class AbstractExporter implements ExporterInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var \Encore\Admin\Grid |
||
| 11 | */ |
||
| 12 | protected $grid; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Create a new exporter instance. |
||
| 16 | * |
||
| 17 | * @param $grid |
||
| 18 | */ |
||
| 19 | public function __construct(Grid $grid = null) |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Set grid for exporter. |
||
| 28 | * |
||
| 29 | * @param Grid $grid |
||
| 30 | * |
||
| 31 | * @return $this |
||
| 32 | */ |
||
| 33 | public function setGrid(Grid $grid) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get table of grid. |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | public function getTable() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Get data with export query. |
||
| 52 | * |
||
| 53 | * @return array |
||
| 54 | */ |
||
| 55 | public function getData() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param callable $callback |
||
| 62 | * @param int $count |
||
| 63 | * |
||
| 64 | * @return bool |
||
| 65 | */ |
||
| 66 | public function chunk(callable $callback, $count = 100) |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Export data with scope. |
||
| 73 | * |
||
| 74 | * @param string $scope |
||
| 75 | * |
||
| 76 | * @return $this |
||
| 77 | */ |
||
| 78 | public function withScope($scope) |
||
| 97 | |||
| 98 | /** |
||
| 99 | * {@inheritdoc} |
||
| 100 | */ |
||
| 101 | abstract public function export(); |
||
| 102 | } |
||
| 103 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: