Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
46.15% |
6 / 13 |
|
50.00% |
3 / 6 |
CRAP | |
0.00% |
0 / 1 |
| DeliveryExecutionColumn | |
46.15% |
6 / 13 |
|
50.00% |
3 / 6 |
21.65 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| fromArray | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
3.33 | |||
| getIdentifier | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getContextIdentifier | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDataProvider | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| toArray | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2019 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | * @author Oleksandr Zagovorychev <zagovorichev@gmail.com> |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoOutcomeUi\model\table; |
| 24 | |
| 25 | /** |
| 26 | * Represents a delivery executions columns |
| 27 | * |
| 28 | * @access public |
| 29 | */ |
| 30 | class DeliveryExecutionColumn extends \tao_models_classes_table_Column |
| 31 | { |
| 32 | private static $dataProvider; |
| 33 | private $identifier; |
| 34 | |
| 35 | public function __construct($label, $identifier) |
| 36 | { |
| 37 | parent::__construct($label); |
| 38 | $this->identifier = $identifier; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @param $array |
| 43 | * @return DeliveryExecutionColumn|\tao_models_classes_table_Column |
| 44 | * @throws \common_exception_Error |
| 45 | */ |
| 46 | protected static function fromArray($array) |
| 47 | { |
| 48 | if (!array_key_exists('label', $array) || !array_key_exists('variableIdentifier', $array)) { |
| 49 | throw new \common_exception_Error('Incorrect data description'); |
| 50 | } |
| 51 | return new self($array['label'], $array['variableIdentifier']); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @return string |
| 56 | */ |
| 57 | public function getIdentifier() |
| 58 | { |
| 59 | return $this->identifier; |
| 60 | } |
| 61 | |
| 62 | public function getContextIdentifier() |
| 63 | { |
| 64 | return 'delivery_execution'; |
| 65 | } |
| 66 | |
| 67 | public function getDataProvider() |
| 68 | { |
| 69 | if (!self::$dataProvider) { |
| 70 | self::$dataProvider = new DeliveryExecutionDataProvider(); |
| 71 | } |
| 72 | return self::$dataProvider; |
| 73 | } |
| 74 | |
| 75 | public function toArray() |
| 76 | { |
| 77 | $res = parent::toArray(); |
| 78 | $res['variableIdentifier'] = $this->getIdentifier(); |
| 79 | return $res; |
| 80 | } |
| 81 | } |