Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Checks if the class has been defined
<?php class_exists(string $class, bool $autoload = true): bool
<?php $args = getopt('t:l:r:');
$t = isset($args['t']) ? (int)$args['t'] : 0;
$loop = isset($args['l']) && class_exists('React\EventLoop\\' . $args['l'] . 'Loop') ? 'React\EventLoop\\' . $args['l'] . 'Loop' : Loop::get();
if (!($loop instanceof LoopInterface)) {
Loop::set(new $loop());
<?php public function __construct()
{
if (!\class_exists('EventBase', false)) {
throw new BadMethodCallException('Cannot create ExtEventLoop, ext-event extension missing');
}
<?php public function __construct()
{
if (!\class_exists('libev\EventLoop', false)) {
throw new BadMethodCallException('Cannot create ExtLibevLoop, ext-libev extension missing');
}
<?php return new ExtUvLoop();
}
if (\class_exists('libev\EventLoop', false)) {
return new ExtLibevLoop();
}
<?php return new ExtLibevLoop();
}
if (\class_exists('EvLoop', false)) {
return new ExtEvLoop();
}
<?php return new ExtEvLoop();
}
if (\class_exists('EventBase', false)) {
return new ExtEventLoop();
}
<?php {
public function createLoop()
{
if (!class_exists('EvLoop')) {
$this->markTestSkipped('ExtEvLoop tests skipped because ext-ev extension is not installed.');
}
<?php {
public function createLoop()
{
if (!class_exists('libev\EventLoop')) {
$this->markTestSkipped('libev tests skipped because ext-libev is not installed.');
}
<?php {
public function createLoop()
{
if (!class_exists('EvLoop')) {
$this->markTestSkipped('ExtEvLoop tests skipped because ext-ev extension is not installed.');
}
<?php {
public function createLoop()
{
if (!class_exists('libev\EventLoop')) {
$this->markTestSkipped('libev tests skipped because ext-libev is not installed.');
}