* @package taoQTI */ class QtiItemCompilerAssetBlacklist extends ConfigurableService { const SERVICE_ID = 'taoQtiItem/compileBlacklist'; const BLACKLIST = 'blacklist'; private $blacklist = []; /** * QtiItemCompilerAssetBlacklist constructor. * @param array $options */ public function __construct(array $options = []) { parent::__construct($options); $this->blacklist = ($this->hasOption(self::BLACKLIST)) ? $this->getOption(self::BLACKLIST) : []; } /** * Allow to know if a path is blacklisted or not * @param string $assetPath * @return bool */ public function isBlacklisted($assetPath) { foreach ($this->blacklist as $pattern) { if (preg_match($pattern, $assetPath) === 1) { return true; } } return false; } /** * Get the list of blacklisted pattern * @return array */ public function getBlacklist() { return $this->blacklist; } /** * set new list of blacklisted pattern * @param $blacklist */ public function setBlacklist($blacklist) { $this->blacklist = $blacklist; } }