/** * Check Options Integrity * * <p> * Could be abstract, because each Backend should check in a different * way, different types of options, but allowing it to be overwritten, * we can check if our common options were not corrupted in any form. * </p> * * <p> * Of course, the child classes must inherit these checks before check * their own, but this is the least of the problems * </p> * * @throws Next\Cache\CacheException * Invalid or unsupported Hash Algorithm */ protected function checkIntegrity() { $constants = $this->getClass()->getConstants(); if (!in_array($this->options->security->hashAlgorithm, $constants)) { throw BackendException::invalidHashType(); } }
/** * Check Options Integrity * * @throws Next\Cache\Backend\BackendException * Output Cache Directory is empty * * @throws Next\Cache\Backend\BackendException * Output Cache Directory doesn't exists * * @throws Next\Cache\Backend\BackendException * Output Cache Directory is not writeable */ protected function checkIntegrity() { // Inherit Integrity Checks from Parent Class parent::checkIntegrity(); // Shortening... $dir =& $this->options->outputDirectory; // Checking if Output Directory is set if (empty($dir)) { throw BackendException::unfullfilledRequirements('Output Cache Directory must be set as non empty string'); } $info = new \SplFileInfo($dir); // Checking if Output Directory exists... if (!$info->isDir()) { throw BackendException::unfullfilledRequirements('Output Cache Directory <strong>%s</strong> doesn\'t exists', array($dir)); } // ... and if is writeable if (!$info->isWritable()) { throw BackendException::unfullfilledRequirements('Output Cache Directory <strong>%s</strong> is not writable', array($dir)); } }