Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Verify that a value can be called as a function from the current scope.
<?php is_callable(mixed $value, bool $syntax_only = false, string &$callable_name = null): bool
<?php return function (...$params) use ($callbacks) {
foreach ($callbacks as $callback) {
if (is_callable($callback)) $callback(...$params);
}
};
}
<?php return function (...$params) use ($callbacks) {
foreach ($callbacks as $callback) {
if (is_callable($callback)) $callback(...$params);
}
};
}
<?php return function (...$params) use ($callbacks) {
foreach ($callbacks as $callback) {
if (is_callable($callback)) $callback(...$params);
}
};
}
<?php return function (...$params) use ($callbacks) {
foreach ($callbacks as $callback) {
if (is_callable($callback)) $callback(...$params);
}
};
}
<?php return function (...$params) use ($callbacks) {
foreach ($callbacks as $callback) {
if (is_callable($callback)) $callback(...$params);
}
};
}
<?php return function (...$params) use ($callbacks) {
foreach ($callbacks as $callback) {
if (is_callable($callback)) {
$callback(...$params);
}
}
<?php if (empty($params)) {
$test = collect(data_get($this->effects, 'dispatches'))->contains('name', '=', $value);
} elseif (isset($params[0]) && ! is_string($params[0]) && is_callable($params[0])) {
$event = collect(data_get($this->effects, 'dispatches'))->first(function ($item) use ($value) {
return $item['name'] === $value;
});
<?php $response = response(SupportPageComponents::renderContentsIntoLayout($html, $layoutConfig));
if (is_callable($layoutConfig->response)) {
call_user_func($layoutConfig->response, $response);
}
<?php invade($testCase)->beforeServingApplication(function ($app, $config) use ($tweakApplication) {
$config->set('app.debug', true);
if (is_callable($tweakApplication)) $tweakApplication();
static::loadTestComponents();
});
<?php {
$actual = $this->get($name);
if (! is_string($value) && is_callable($value)) {
PHPUnit::assertTrue($value($actual));
} else {
$strict ? PHPUnit::assertSame($value, $actual) : PHPUnit::assertEquals($value, $actual);
<?php {
$data = $this->lastState->getSnapshotData();
if (is_callable($value)) {
PHPUnit::assertTrue($value(data_get($data, $name)));
} else {
$strict ? PHPUnit::assertSame($value, data_get($data, $name)) : PHPUnit::assertEquals($value, data_get($data, $name));
<?php {
$data = $this->lastState->getSnapshotData();
if (is_callable($value)) {
PHPUnit::assertFalse($value(data_get($data, $name)));
} else {
$strict ? PHPUnit::assertNotSame($value, data_get($data, $name)) : PHPUnit::assertNotEquals($value, data_get($data, $name));
<?php {
$data = data_get($this->lastState->getEffects(), 'returns.0');
if (is_callable($value)) {
PHPUnit::assertTrue($value($data));
} else {
PHPUnit::assertEquals($value, $data);
<?php foreach ($params as $key => $param) {
if (! $through) {
if (is_callable($param)) $through = $param;
else $before[$key] = $param;
} else {
<?php $callback = $callback[0].'@'.$callback[1];
}
if (is_callable($callback)) {
$this->abilities[$ability] = $callback;
} elseif (is_string($callback)) {
$this->stringCallbacks[$ability] = $callback;