Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Filters elements of an array using a callback function
<?php array_filter(array $array, ?callable $callback = null, int $mode = 0): array
<?php static function getPublicMethodsDefinedBySubClass($target)
{
$methods = array_filter((new \ReflectionObject($target))->getMethods(), function ($method) {
$isInBaseComponentClass = $method->getDeclaringClass()->getName() === \Livewire\Component::class;
return $method->isPublic()
&& ! $method->isStatic()
&& ! $isInBaseComponentClass;
});
return array_map(function ($method) {
return $method->getName();
<?php $fileHashName = TemporaryUploadedFile::generateHashNameWithOriginalNameEmbedded($file);
$path = FileUploadConfiguration::path($fileHashName);
$command = $client->getCommand('putObject', array_filter([
'Bucket' => $bucket,
'Key' => $path,
'ACL' => $visibility,
'ContentType' => $fileType ?: 'application/octet-stream',
'CacheControl' => null,
'Expires' => null,
]));
$signedRequest = $client->createPresignedRequest(
$command,
<?php if (is_array($uploads) && isset($uploads[0]) && $uploads[0] instanceof TemporaryUploadedFile) {
$this->dispatch('upload:removed', name: $name, tmpFilename: $tmpFilename)->self();
app('livewire')->updateProperty($this, $name, array_values(array_filter($uploads, function ($upload) use ($tmpFilename) {
if ($upload->getFilename() === $tmpFilename) {
$upload->delete();
return false;
}
return true;
})));
} elseif ($uploads instanceof TemporaryUploadedFile && $uploads->getFilename() === $tmpFilename) {
$uploads->delete();
<?php protected function filterData($data, $rules)
{
return array_filter($data, function ($key) use ($rules) {
return array_key_exists('*', $rules);
}, ARRAY_FILTER_USE_KEY);
}
protected function loadCollection($meta)
<?php protected function filterRelations($data, $rules)
{
return array_filter($data, function ($key) use ($rules) {
return array_key_exists($key, $rules) || in_array($key, $rules);
}, ARRAY_FILTER_USE_KEY);
}
protected function loadModel($meta): ?Model
<?php if ($parameter->isVariadic()) {
$parameters = array_merge(
array_filter($parameters, function ($key) { return ! is_int($key); }, ARRAY_FILTER_USE_KEY),
array_values(array_filter($parameters, function ($key) { return is_int($key); }, ARRAY_FILTER_USE_KEY))
);
<?php $parameters = array_merge(
array_filter($parameters, function ($key) { return ! is_int($key); }, ARRAY_FILTER_USE_KEY),
array_values(array_filter($parameters, function ($key) { return is_int($key); }, ARRAY_FILTER_USE_KEY))
);
return;