class Runtime
Same name in this branch
- 11.1.x vendor/phpunit/phpunit/src/Event/Value/Runtime/Runtime.php \PHPUnit\Event\Runtime\Runtime
- 11.1.x vendor/sebastian/environment/src/Runtime.php \SebastianBergmann\Environment\Runtime
Hierarchy
- class \Composer\Platform\Runtime
Expanded class hierarchy of Runtime
1 file declares its use of Runtime
- PlatformRepository.php in vendor/
composer/ composer/ src/ Composer/ Repository/ PlatformRepository.php
20 string references to 'Runtime'
- Application::writeRuntimeInformation in vendor/
phpunit/ phpunit/ src/ TextUI/ Application.php - BuildInformation::setRuntimeInformation in vendor/
phpunit/ php-code-coverage/ src/ Report/ Xml/ BuildInformation.php - demo_umami_requirements in core/
profiles/ demo_umami/ demo_umami.install - Implements hook_requirements().
- file_requirements in core/
modules/ file/ file.install - Implements hook_requirements().
- hook_requirements in core/
lib/ Drupal/ Core/ Extension/ module.api.php - Check installation requirements and do status reporting.
File
-
vendor/
composer/ composer/ src/ Composer/ Platform/ Runtime.php, line 15
Namespace
Composer\PlatformView source
class Runtime {
/**
* @param class-string $class
*/
public function hasConstant(string $constant, ?string $class = null) : bool {
return defined(ltrim($class . '::' . $constant, ':'));
}
/**
* @param class-string $class
*
* @return mixed
*/
public function getConstant(string $constant, ?string $class = null) {
return constant(ltrim($class . '::' . $constant, ':'));
}
public function hasFunction(string $fn) : bool {
return function_exists($fn);
}
/**
* @param mixed[] $arguments
*
* @return mixed
*/
public function invoke(callable $callable, array $arguments = []) {
return $callable(...$arguments);
}
/**
* @param class-string $class
*/
public function hasClass(string $class) : bool {
return class_exists($class, false);
}
/**
* @template T of object
* @param mixed[] $arguments
*
* @phpstan-param class-string<T> $class
* @phpstan-return T
*
* @throws \ReflectionException
*/
public function construct(string $class, array $arguments = []) : object {
if (empty($arguments)) {
return new $class();
}
$refl = new \ReflectionClass($class);
return $refl->newInstanceArgs($arguments);
}
/** @return string[] */
public function getExtensions() : array {
return get_loaded_extensions();
}
public function getExtensionVersion(string $extension) : string {
$version = phpversion($extension);
if ($version === false) {
$version = '0';
}
return $version;
}
/**
* @throws \ReflectionException
*/
public function getExtensionInfo(string $extension) : string {
$reflector = new \ReflectionExtension($extension);
ob_start();
$reflector->info();
return ob_get_clean();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Runtime::construct | public | function | @template T of object |
Runtime::getConstant | public | function | |
Runtime::getExtensionInfo | public | function | |
Runtime::getExtensions | public | function | |
Runtime::getExtensionVersion | public | function | |
Runtime::hasClass | public | function | |
Runtime::hasConstant | public | function | |
Runtime::hasFunction | public | function | |
Runtime::invoke | public | function |