Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| ItemResultStrategy | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isItemEntityBased | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isItemInstanceLabelBased | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isItemInstanceItemRefBased | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isItemInstanceLabelItemRefBased | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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) 2022 (original work) Open Assessment Technologies SA; |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\taoOutcomeUi\model; |
| 24 | |
| 25 | class ItemResultStrategy |
| 26 | { |
| 27 | public const ENV_ITEM_RESULT_STRATEGY = 'ITEM_RESULT_STRATEGY'; |
| 28 | |
| 29 | private const ITEM_ENTITY_STRATEGY = 'item_entity'; |
| 30 | private const ITEM_INSTANCE_LABEL_STRATEGY = 'item_instance_label'; |
| 31 | private const ITEM_INSTANCE_ITEM_REF_STRATEGY = 'item_instance_item_ref'; |
| 32 | private const ITEM_INSTANCE_LABEL_ITEM_REF_STRATEGY = 'item_instance_label_item_ref'; |
| 33 | |
| 34 | private string $strategy; |
| 35 | |
| 36 | public function __construct(string $strategy) |
| 37 | { |
| 38 | $this->strategy = $strategy; |
| 39 | } |
| 40 | |
| 41 | public function isItemEntityBased(): bool |
| 42 | { |
| 43 | return $this->strategy === self::ITEM_ENTITY_STRATEGY; |
| 44 | } |
| 45 | |
| 46 | public function isItemInstanceLabelBased(): bool |
| 47 | { |
| 48 | return $this->strategy === self::ITEM_INSTANCE_LABEL_STRATEGY; |
| 49 | } |
| 50 | |
| 51 | public function isItemInstanceItemRefBased(): bool |
| 52 | { |
| 53 | return $this->strategy === self::ITEM_INSTANCE_ITEM_REF_STRATEGY; |
| 54 | } |
| 55 | |
| 56 | public function isItemInstanceLabelItemRefBased(): bool |
| 57 | { |
| 58 | return $this->strategy === self::ITEM_INSTANCE_LABEL_ITEM_REF_STRATEGY; |
| 59 | } |
| 60 | } |