Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
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) 2020 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
19 *
20 */
21
22declare(strict_types=1);
23
24namespace oat\taoQtiItem\model\compile\QtiAssetReplacer;
25
26use oat\taoQtiItem\model\pack\QtiAssetPacker\PackedAsset;
27
28interface QtiItemAssetReplacer
29{
30    public const SERVICE_ID = 'taoQtiItem/ItemAssetReplacer';
31
32    /**
33     * This option can be used for replacement default patterns
34     */
35    public const OPTION_EXCLUDE_PATTERNS = 'exclude_patterns';
36
37    /**
38     * Default patterns for excluding
39     */
40    public const DEFAULT_EXCLUDE_PATTERNS = [
41        '/\.css/',
42        '/\.js/',
43        '/textReaderInteraction/',
44        '/mathEntryInteraction/',
45        '/likertScaleInteraction/',
46        '/mathEntryInteractionBis/',
47        '/mathEntryInteraction/',
48        '/numericPadInteraction/',
49        '/textAreaTimer/',
50        '/mathematicAABC/',
51        '/decisiontask/',
52        '/numworxPCIplayer/',
53        '/\/explo\//',
54        '/tutochat/',
55        '/ilechat/',
56        '/hamsterchat/',
57        '/lifichat/',
58        '/rosettachat/',
59        '/fourchelangchat/',
60        '/vrtOEOBdroitezoomeecOAO/',
61        '/volcanisme/',
62        '/Berthold/',
63        '/vrtODOGdroitezoomeeAOAD/',
64        '/circuit/',
65        '/syracusea/',
66        '/delor/',
67        '/deppMaisonHHHHHK/',
68        '/descubesetdescubesa/',
69        '/arbrea/',
70        '/nterre/',
71        '/patternsdeuxa/',
72        '/forcegravite/',
73        '/deppLeLacEFEFEDJ/',
74        '/deppTectoniqueEFEFERRJ/',
75        '/lampedouble/',
76        '/deppCocktailZAAAG/',
77        '/deppCocktaiZZZZ/',
78        '/patterna/',
79        '/glips/',
80        '/menuisiera/',
81        '/mathematicAAB/',
82        '/cubea/',
83        '/vrtOEOEcalccasseeOAB/',
84        '/abeille/',
85        '/vrtOEOEcalccassebOAB/',
86        '/deppStoreDDDDDDK/',
87        '/bronco/',
88        '/deppTectoniqueEFEFERRF/',
89        '/maraissalant/',
90        '/dalichat/',
91        '/SnapForTao/'
92    ];
93
94    /**
95     * Check if an asset can be replaced with an external source
96     * @param PackedAsset $packetAsset
97     * @return bool
98     */
99    public function shouldBeReplaced(PackedAsset $packetAsset): bool;
100
101    /**
102     * Replace the current asset with the external
103     * @param PackedAsset $packetAsset
104     * @param string $itemId
105     * @return PackedAsset
106     */
107    public function replace(PackedAsset $packetAsset, string $itemId): PackedAsset;
108}