/** * @expectedException \LTDBeget\sphinx\informer\exceptions\InformerRuntimeException * @expectedExceptionMessage Sphinx of version 2.1.9 does't have section common */ public function testUnknownSection() { /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ $informer = Informer::get(eVersion::V_2_1_9()); /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ $informer->getOptionInfo(eSection::COMMON(), eCommonOption::JSON_AUTOCONV_KEYNAMES()); }
/** * @param eVersion $targetVersion * @param array $versions * * @throws \Symfony\Component\Yaml\Exception\ParseException * @throws \LogicException * @throws \LTDBeget\sphinx\informer\exceptions\InformerRuntimeException * @throws \LTDBeget\sphinx\informer\exceptions\DocumentationSourceException * @throws \InvalidArgumentException */ private function processVersion(eVersion $targetVersion, array $versions) { $informer = Informer::get($targetVersion); $sections = eSection::getConstants(); $all_permanently_removed = []; foreach ($sections as $section) { $section = eSection::get($section); if ($informer->isSectionExist($section)) { $removed = $this->getPermanentlyRemoved($section, $targetVersion, $versions); if (count($removed)) { $all_permanently_removed[(string) $section] = $removed; } } } if (count($all_permanently_removed)) { $this->dump($targetVersion, $all_permanently_removed); } }
/** * @internal * @throws \InvalidArgumentException * @throws \LogicException */ private function initType() { $this->type = eSection::get(strtolower($this->shortClassName())); }
/** * @return Common * @throws \LTDBeget\sphinx\configurator\exceptions\ConfigurationException */ public function getCommon() : Common { $section = eSection::COMMON(); if (!$this->isAllowedSection($section)) { throw new ConfigurationException("Sphinx of version {$this->version} does't have section {$section}"); } if (!$this->isHasCommon()) { $this->initCommon(); } return $this->common; }
/** * Is this section exists in current sphinx version * * @param eSection $section * * @return bool */ public function isSectionExist(eSection $section) : bool { return !$section->is(eSection::COMMON) || !version_compare((string) $this->version, eVersion::V_2_2_1, '<'); }