private function _includeFile($file, tubepress_spi_addon_Addon $addon)
 {
     if ($this->_shouldLog) {
         $this->_logger->debug(sprintf('Now including file %s for add-on %s', $file, $addon->getName()));
     }
     if (!is_file($file) || !is_readable($file)) {
         $this->_logWarning(sprintf('%s is not a readable file', $file));
         return;
     }
     try {
         /** @noinspection PhpIncludeInspection */
         include $file;
     } catch (Exception $e) {
         $this->_logWarning(sprintf('Failed to include %s: %s', $file, $e->getMessage()));
     }
     if ($this->_shouldLog) {
         $this->_logger->debug(sprintf('Done including file %s for add-on %s', $file, $addon->getName()));
     }
 }
 private function _registerPsr0ClassPath(tubepress_spi_addon_Addon $addon, ehough_pulsar_ComposerClassLoader $classLoader)
 {
     $classPaths = $addon->getPsr0ClassPathRoots();
     if (count($classPaths) === 0) {
         return;
     }
     if ($this->_shouldLog) {
         $this->_logger->debug(sprintf('Add-on %s has %d PSR-0 path(s) for the classloader', $addon->getName(), count($classPaths)));
     }
     foreach ($classPaths as $prefix => $path) {
         if ($this->_shouldLog) {
             $this->_logger->debug(sprintf('Add-on %s registered %s => %s as a PSR-0 classpath', $addon->getName(), $prefix, $path));
         }
         if ($prefix) {
             $classLoader->registerPrefix($prefix, $path);
             $classLoader->registerNamespace($prefix, $path);
         } else {
             $classLoader->registerNamespaceFallback($path);
             $classLoader->registerPrefixFallback($path);
         }
     }
 }
 public function __callbackSystemAddonSorter(tubepress_spi_addon_Addon $first, tubepress_spi_addon_Addon $second)
 {
     $firstName = $first->getName();
     $secondName = $second->getName();
     /*
      * The core add-on always gets loaded first, the pro-core always last.
      */
     if ($firstName === 'tubepress-core-addon' || $secondName === 'tubepress-pro-core-addon') {
         return -1;
     }
     if ($firstName === 'tubepress-pro-core-addon' || $secondName === 'tubepress-core-addon') {
         return 1;
     }
     return 0;
 }