/** * @param bool $createClassIfNotExists * * @throws Exception */ protected function checkClass($createClassIfNotExists = false) { if (class_exists('OCClassTools')) { try { OCClassTools::setRemoteUrl(rtrim($this->attributes['definition']['Url'], '/') . self::SERVER_CLASSDEFINITION_PATH); $tools = new OCClassTools($this->classIdentifier, $createClassIfNotExists); if ($createClassIfNotExists) { $tools->sync(); } $tools->compare(); $result = $tools->getData(); if ($result->hasError) { throw new Exception(var_export($result->errors, 1)); } } catch (Exception $e) { throw new Exception('[Repository classi di contenuto ' . OCClassTools::getRemoteUrl() . '] ' . $e->getMessage()); } } else { throw new Exception("Libreria OCClassTools non trovata"); } $this->contentClass = eZContentClass::fetchByIdentifier($this->classIdentifier); if (!$this->contentClass instanceof eZContentClass) { throw new Exception("La classe di contenuto non esiste in questa installazione"); } }