vendor/sintra/api-bundle/SintraApiBundle.php line 14

Open in your IDE?
  1. <?php
  2. namespace Sintra\ApiBundle;
  3. use Composer\InstalledVersions;
  4. use Exception;
  5. use LogBundle\LogBundle;
  6. use Nelmio\ApiDocBundle\NelmioApiDocBundle;
  7. use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
  8. use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
  9. use Pimcore\HttpKernel\BundleCollection\BundleCollection;
  10. use Symfony\Bundle\SecurityBundle\SecurityBundle;
  11. class SintraApiBundle extends AbstractPimcoreBundle implements DependentBundleInterface
  12. {
  13.     public static function registerDependentBundles(BundleCollection $collection)
  14.     {
  15.         $collection->addBundle(new LogBundle(), 5000);
  16.         $collection->addBundle(new NelmioApiDocBundle(), 2000);
  17.         $collection->addBundle(new SecurityBundle(), 2000);
  18.         return $collection;
  19.     }
  20.     public function getJsPaths()
  21.     {
  22.         return [
  23.             '/bundles/sintraapi/js/pimcore/startup.js'
  24.         ];
  25.     }
  26.     public function getVersion(): ?string
  27.     {
  28.         try {
  29.             $versionFile "/var/www/html/sohproj.json";
  30.             if (file_exists($versionFile)) {
  31.                 return json_decode(file_get_contents($versionFile))->version;
  32.             } else {
  33.                 $packageName json_decode(file_get_contents(__DIR__ '/composer.json'))->name;
  34.                 return InstalledVersions::getPrettyVersion($packageName);
  35.             }
  36.         } catch (Exception $ex) {
  37.             return "2.0.0";
  38.         }
  39.     }
  40. }