| 1 | <?php |
||
| 11 | abstract class DataRow implements DataRowInterface |
||
| 12 | { |
||
| 13 | |||
| 14 | /** @var mixed row data */ |
||
| 15 | protected $src; |
||
| 16 | |||
| 17 | /** @var int row id */ |
||
| 18 | protected $id; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Constructor. |
||
| 22 | * |
||
| 23 | * @param $src |
||
| 24 | * @param int $id |
||
| 25 | */ |
||
| 26 | public function __construct($src, $id) |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Returns row id. |
||
| 34 | * |
||
| 35 | * It's row number starting from 1, considering pagination. |
||
| 36 | * |
||
| 37 | * @return mixed |
||
| 38 | */ |
||
| 39 | public function getId() |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Returns row data source. |
||
| 46 | * |
||
| 47 | * @return mixed |
||
| 48 | */ |
||
| 49 | public function getSrc() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Returns row data source. |
||
| 56 | * |
||
| 57 | * @return mixed |
||
| 58 | */ |
||
| 59 | public function src() |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Returns value for specified column. |
||
| 66 | * |
||
| 67 | * @param string $fieldName |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | abstract protected function extractCellValue($fieldName); |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Returns value of specified column from row. |
||
| 74 | * |
||
| 75 | * @param FieldConfig|string $field |
||
| 76 | * @return mixed |
||
| 77 | */ |
||
| 78 | public function getCellValue($field) |
||
| 83 | } |
||
| 84 |