/**
  * Finds and returns the suitable TYPO3 versions of an extension
  *
  * @param Extension $extension
  * @return string
  */
 public function render(Extension $extension)
 {
     /** @var Dependency $dependency */
     foreach ($extension->getDependencies() as $dependency) {
         if ($dependency->getIdentifier() === 'typo3') {
             $lowestVersion = $dependency->getLowestVersion();
             $highestVersion = $dependency->getHighestVersion();
             $cssClass = $this->isVersionSuitable($lowestVersion, $highestVersion) ? 'success' : 'default';
             return '<span class="label label-' . $cssClass . '">' . htmlspecialchars($lowestVersion) . ' - ' . htmlspecialchars($highestVersion) . '</span>';
         }
     }
     return '';
 }
Example #2
0
 /**
  * Checks dependencies for special cases (currently typo3 and php)
  *
  * @param Extension $extension
  * @return void
  */
 public function checkDependencies(Extension $extension)
 {
     $this->dependencyErrors = [];
     $dependencies = $extension->getDependencies();
     foreach ($dependencies as $dependency) {
         /** @var Dependency $dependency */
         $identifier = strtolower($dependency->getIdentifier());
         try {
             if (in_array($identifier, Dependency::$specialDependencies)) {
                 if (!$this->skipDependencyCheck) {
                     $methodName = 'check' . ucfirst($identifier) . 'Dependency';
                     $this->{$methodName}($dependency);
                 }
             } else {
                 if ($dependency->getType() === 'depends') {
                     $this->checkExtensionDependency($dependency);
                 }
             }
         } catch (Exception\UnresolvedDependencyException $e) {
             if (in_array($identifier, Dependency::$specialDependencies)) {
                 $extensionKey = $extension->getExtensionKey();
             } else {
                 $extensionKey = $identifier;
             }
             if (!isset($this->dependencyErrors[$extensionKey])) {
                 $this->dependencyErrors[$extensionKey] = [];
             }
             $this->dependencyErrors[$extensionKey][] = ['code' => $e->getCode(), 'message' => $e->getMessage()];
         }
     }
 }
 /**
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  * @return void
  */
 public function buildExtensionDependenciesTree($extension)
 {
     $dependencies = $extension->getDependencies();
     $this->checkDependencies($dependencies);
 }