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 $attributes = $model->attributesToArray();
foreach ($model->getCasts() as $key => $cast) {
if (! class_exists($cast)) continue;
if (
in_array(CastsAttributes::class, class_implements($cast))
<?php static::$currentTestCase = null;
});
if (isset($_SERVER['CI']) && class_exists(\Orchestra\Testbench\Dusk\Options::class)) {
\Orchestra\Testbench\Dusk\Options::withoutUI();
}
<?php {
if (! app()->environment('testing')) return;
if (class_exists('Laravel\Dusk\Browser')) {
DuskTestable::provide();
}
<?php return $this;
});
if (class_exists(\Illuminate\Testing\TestView::class)) {
\Illuminate\Testing\TestView::macro('assertSeeLivewire', function ($component) {
if (is_subclass_of($component, Component::class)) {
$component = app(ComponentRegistry::class)->getName($component);
<?php protected function bootMechanisms()
{
if (class_exists(AboutCommand::class) && class_exists(InstalledVersions::class)) {
AboutCommand::add('Livewire', [
'Livewire' => InstalledVersions::getPrettyVersion('livewire/livewire'),
]);
<?php $classOrName = get_class($classOrName);
}
if (class_exists($name = $classOrName)) {
$name = $this->generateNameFromClass($classOrName);
}
<?php $class = $this->generateClassFromName($name);
if (class_exists($class) && is_subclass_of($class, Component::class)) {
return true;
}
<?php $nameOrClass = is_object($nameComponentOrClass) ? $nameComponentOrClass::class : $nameComponentOrClass;
if (class_exists($nameOrClass) && is_subclass_of($nameOrClass, Component::class)) {
$class = $nameOrClass;
} else {
<?php $class = $this->nameToClass($nameOrClass);
if(! class_exists($class)) {
$class = $class . '\\Index';
}
<?php $class = $class . '\\Index';
}
if(! class_exists($class)) {
foreach ($this->missingComponentResolvers as $resolve) {
if ($resolved = $resolve($nameOrClass)) {
$this->component($nameOrClass, $resolved);
<?php }
foreach ($this->guessPolicyName($class) as $guessedPolicy) {
if (class_exists($guessedPolicy)) {
return $this->resolvePolicy($guessedPolicy);
}
}
<?php return $classDirname.'\\Policies\\'.class_basename($class).'Policy';
})->reverse()->values()->first(function ($class) {
return class_exists($class);
}) ?: [$classDirname.'\\Policies\\'.class_basename($class).'Policy']);
}
<?php {
if ($channel instanceof HasBroadcastChannel) {
$channel = $channel->broadcastChannelRoute();
} elseif (is_string($channel) && class_exists($channel) && is_a($channel, HasBroadcastChannel::class, true)) {
$channel = (new $channel)->broadcastChannelRoute();
}
<?php protected function serializeJob($job)
{
if ($job instanceof Closure) {
if (! class_exists(CallQueuedClosure::class)) {
throw new RuntimeException(
'To enable support for closure jobs, please install the illuminate/queue package.'
);
<?php protected function now()
{
return class_exists(Carbon::class)
? Carbon::now()->timestamp
: time();
}