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;
<?php 'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
<?php 'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
<?php 'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
<?php 'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
<?php public function retrieveByCredentials(array $credentials)
{
$credentials = array_filter(
$credentials,
fn ($key) => ! str_contains($key, 'password'),
ARRAY_FILTER_USE_KEY
);
if (empty($credentials)) {
return;
<?php public function retrieveByCredentials(array $credentials)
{
$credentials = array_filter(
$credentials,
fn ($key) => ! str_contains($key, 'password'),
ARRAY_FILTER_USE_KEY
);
if (empty($credentials)) {
return;
<?php $signature = $this->generateAblySignature(
$request->channel_name,
$request->socket_id,
$userData = array_filter([
'user_id' => (string) $broadcastIdentifier,
'user_info' => $result,
])
);
return [
<?php $result = $this->dynamoDbClient->query([
'TableName' => $this->table,
'KeyConditionExpression' => $condition,
'ExpressionAttributeValues' => array_filter([
':application' => ['S' => $this->applicationName],
':id' => array_filter(['S' => $before]),
]),
'Limit' => $limit,
'ScanIndexForward' => false,
]);