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.
is_callable(mixed $value, bool $syntax_only = false, string &$callable_name = null): bool
$callback = $callback[0].'@'.$callback[1];
}
if (is_callable($callback)) {
$this->abilities[$ability] = $callback;
} elseif (is_string($callback)) {
$this->stringCallbacks[$ability] = $callback;
}
if (is_callable($callback)) {
$this->abilities[$ability] = $callback;
} elseif (is_string($callback)) {
$this->stringCallbacks[$ability] = $callback;
protected function resolvePolicyCallback($user, $ability, array $arguments, $policy)
{
if (! is_callable([$policy, $this->formatAbilityToMethod($ability)])) {
return false;
}
{
if (! is_callable([$policy, $this->formatAbilityToMethod($ability)])) {
return false;
}
array_shift($arguments);
}
if (! is_callable([$policy, $method])) {
return;
}
}
if (! is_callable([$policy, $method])) {
return;
}
protected function extractParameters($callback)
{
if (is_callable($callback)) {
return (new ReflectionFunction($callback))->getParameters();
} elseif (is_string($callback)) {
return $this->extractParametersFromClass($callback);
{
if (is_callable($callback)) {
return (new ReflectionFunction($callback))->getParameters();
} elseif (is_string($callback)) {
return $this->extractParametersFromClass($callback);
protected function normalizeChannelHandlerToCallable($callback)
{
return is_callable($callback) ? $callback : function (...$args) use ($callback) {
return Container::getInstance()
->make($callback)
->join(...$args);
{
return is_callable($callback) ? $callback : function (...$args) use ($callback) {
return Container::getInstance()
->make($callback)
->join(...$args);
{
$result = $this->acquire();
if ($result && is_callable($callback)) {
try {
return $callback();
} finally {
$result = $this->acquire();
if ($result && is_callable($callback)) {
try {
return $callback();
} finally {
}
}
if (is_callable($callback)) {
try {
return $callback();
} finally {
}
if (is_callable($callback)) {
try {
return $callback();
} finally {
return Arr::random($this->items);
}
if (is_callable($number)) {
return new static(Arr::random($this->items, $number($this)));
}
}
if (is_callable($number)) {
return new static(Arr::random($this->items, $number($this)));
}
{
$items = $this->items;
$callback && is_callable($callback)
? uasort($items, $callback)
: asort($items, $callback ?? SORT_REGULAR);
$items = $this->items;
$callback && is_callable($callback)
? uasort($items, $callback)
: asort($items, $callback ?? SORT_REGULAR);
public function sortBy($callback, $options = SORT_REGULAR, $descending = false)
{
if (is_array($callback) && ! is_callable($callback)) {
return $this->sortByMany($callback);
}
{
if (is_array($callback) && ! is_callable($callback)) {
return $this->sortByMany($callback);
}
$ascending = Arr::get($comparison, 1, true) === true ||
Arr::get($comparison, 1, true) === 'asc';
if (! is_string($prop) && is_callable($prop)) {
$result = $prop($a, $b);
} else {
$values = [data_get($a, $prop), data_get($b, $prop)];
Arr::get($comparison, 1, true) === 'asc';
if (! is_string($prop) && is_callable($prop)) {
$result = $prop($a, $b);
} else {
$values = [data_get($a, $prop), data_get($b, $prop)];
protected function useAsCallable($value)
{
return ! is_string($value) && is_callable($value);
}
{
return ! is_string($value) && is_callable($value);
}
{
$question = new Question($question, $default);
is_callable($choices)
? $question->setAutocompleterCallback($choices)
: $question->setAutocompleterValues($choices);
$question = new Question($question, $default);
is_callable($choices)
? $question->setAutocompleterCallback($choices)
: $question->setAutocompleterValues($choices);
public function count(): int
{
if (is_callable($count = $this->count)) {
$this->count = $count();
}
{
if (is_callable($count = $this->count)) {
$this->count = $count();
}
public function reconnect()
{
if (is_callable($this->reconnector)) {
$this->doctrineConnection = null;
return call_user_func($this->reconnector, $this);
{
if (is_callable($this->reconnector)) {
$this->doctrineConnection = null;
return call_user_func($this->reconnector, $this);