public function __construct($filename) { if (!file_exists($filename)) { throw new \Exception('File : "' . $filename . '" not exists'); } if (!is_readable($filename)) { throw new \Exception('File : "' . $filename . '" is not readable'); } if (!Validate::isFileMimeType('xml', $filename)) { throw new \Exception('File : "' . $filename . '" is not a xml file'); } $this->_filename = $filename; }
public function __construct($options = array()) { if (isset($options['trapName']) && Validate::isVariableName($options['trapName'])) { $this->_trapName = $options['trapName']; } if (isset($options['badCrawlerFile'])) { if (!file_exists($options['badCrawlerFile'])) { throw new \Exception('badCrawlerFile does\'t exists'); } if (!Validate::isFileMimeType('xml', $options['badCrawlerFile'])) { throw new \Exception('goodCrawlerFile invalid format, must be xml'); } $this->_badCrawlerFile = $options['badCrawlerFile']; } if (isset($options['goodCrawlerFile'])) { if (!file_exists($options['goodCrawlerFile'])) { throw new \Exception('goodCrawlerFile does\'t exists'); } if (!Validate::isFileMimeType('xml', $options['goodCrawlerFile'])) { throw new \Exception('goodCrawlerFile invalid format, must be xml'); } $this->_goodCrawlerFile = $options['goodCrawlerFile']; } if (isset($options['logBadCrawler'])) { if (!is_bool($options['logBadCrawler'])) { throw new \Exception('logBadCrawler parameter must be a boolean'); } $this->_logBadCrawler = $options['logBadCrawler']; } if (isset($options['logGoodCrawler'])) { if (!is_bool($options['logGoodCrawler'])) { throw new \Exception('logGoodCrawler parameter must be a boolean'); } $this->_logBadCrawler = $options['logGoodCrawler']; } if (isset($options['logUnknownCrawler'])) { if (!is_bool($options['logUnknownCrawler'])) { throw new \Exception('logUnknownCrawler parameter must be a boolean'); } $this->_logUnknownCrawler = $options['logUnknownCrawler']; } }
public function setAudioNoiseFile($noiseFile) { if (!file_exists($noiseFile) || !is_readable($noiseFile) || !Validate::isFileMimeType('wav', $noiseFile)) { throw new \Exception('Invalid audio noise file, must be an readable wav file'); } $this->_audioNoiseFile = $noiseFile; }