Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HhvmDetector.php

class HhvmDetector

Hierarchy

  • class \Composer\Platform\HhvmDetector

Expanded class hierarchy of HhvmDetector

1 file declares its use of HhvmDetector
PlatformRepository.php in vendor/composer/composer/src/Composer/Repository/PlatformRepository.php

File

vendor/composer/composer/src/Composer/Platform/HhvmDetector.php, line 19

Namespace

Composer\Platform
View source
class HhvmDetector {
    
    /** @var string|false|null */
    private static $hhvmVersion = null;
    
    /** @var ?ExecutableFinder */
    private $executableFinder;
    
    /** @var ?ProcessExecutor */
    private $processExecutor;
    public function __construct(?ExecutableFinder $executableFinder = null, ?ProcessExecutor $processExecutor = null) {
        $this->executableFinder = $executableFinder;
        $this->processExecutor = $processExecutor;
    }
    public function reset() : void {
        self::$hhvmVersion = null;
    }
    public function getVersion() : ?string {
        if (null !== self::$hhvmVersion) {
            return self::$hhvmVersion ?: null;
        }
        self::$hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
        if (self::$hhvmVersion === null && !Platform::isWindows()) {
            self::$hhvmVersion = false;
            $this->executableFinder = $this->executableFinder ?: new ExecutableFinder();
            $hhvmPath = $this->executableFinder
                ->find('hhvm');
            if ($hhvmPath !== null) {
                $this->processExecutor = $this->processExecutor ?? new ProcessExecutor();
                $exitCode = $this->processExecutor
                    ->execute([
                    $hhvmPath,
                    '--php',
                    '-d',
                    'hhvm.jit=0',
                    '-r',
                    'echo HHVM_VERSION;',
                ], self::$hhvmVersion);
                if ($exitCode !== 0) {
                    self::$hhvmVersion = false;
                }
            }
        }
        return self::$hhvmVersion ?: null;
    }

}

Members

Title Sort descending Modifiers Object type Summary
HhvmDetector::$executableFinder private property @var ?ExecutableFinder
HhvmDetector::$hhvmVersion private static property @var string|false|null
HhvmDetector::$processExecutor private property @var ?ProcessExecutor
HhvmDetector::getVersion public function
HhvmDetector::reset public function
HhvmDetector::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal