Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Applies the callback to the elements of the given arrays
<?php array_map(?callable $callback, array $array, array ...$arrays): array
<?php && ! $isInBaseComponentClass;
});
return array_map(function ($method) {
return $method->getName();
}, $methods);
}
static function hasAttribute($target, $property, $attributeClass) {
<?php $this->component = $kebabCase;
$this->componentClass = str($this->component)->studly();
$this->directories = array_map([Str::class, 'studly'], $directories);
}
public function component()
<?php $console->table(
[$title],
[
array_map(fn($line) => "<fg=red>- {$line}</>", Arr::wrap($before)),
array_map(fn($line) => "<fg=green>+ {$line}</>", Arr::wrap($after))
],
);
<?php [$title],
[
array_map(fn($line) => "<fg=red>- {$line}</>", Arr::wrap($before)),
array_map(fn($line) => "<fg=green>+ {$line}</>", Arr::wrap($after))
],
);
}
<?php public static function middleware()
{
return array_map(fn ($middleware) => new Middleware($middleware), static::$middleware);
}
public function handle($filename)
<?php {
public static function middleware()
{
return array_map(fn ($middleware) => new Middleware($middleware), array_merge(
['web'],
(array) FileUploadConfiguration::middleware(),
));
}
public function handle()
<?php {
$value = Arr::wrap($value);
$values = $escape ? array_map('e', ($value)) : $value;
$content = $this->html();
<?php if ($this->as) {
if (is_array($this->as)) {
$as = $this->translate
? array_map(fn ($i) => trans($i), $this->as)
: $this->as;
$target->addValidationAttributesFromOutside($as);
<?php if ($this->message) {
if (is_array($this->message)) {
$messages = $this->translate
? array_map(fn ($i) => trans($i), $this->message)
: $this->message;
$target->addMessagesFromOutside($messages);
<?php else if (property_exists($this, 'rules')) $rulesFromComponent = $this->rules;
$rulesFromOutside = array_merge_recursive(
...array_map(
fn($i) => value($i),
$this->rulesFromOutside
)
);
return array_merge($rulesFromComponent, $rulesFromOutside);
<?php elseif (property_exists($this, 'messages')) $messages = $this->messages;
$messagesFromOutside = array_merge(
...array_map(
fn($i) => value($i),
$this->messagesFromOutside
)
);
return array_merge($messages, $messagesFromOutside);
<?php elseif (property_exists($this, 'validationAttributes')) $validationAttributes = $this->validationAttributes;
$validationAttributesFromOutside = array_merge(
...array_map(
fn($i) => value($i),
$this->validationAttributesFromOutside
)
);
return array_merge($validationAttributes, $validationAttributesFromOutside);
<?php $failed = $this->failedRules() ?: [];
$failedRules = array_keys(Arr::get($failed, $key, []));
$failedRules = array_map(function (string $rule) {
if (is_a($rule, ValidationRule::class, true) || is_a($rule, Rule::class, true)) {
return $rule;
}
return Str::snake($rule);
}, $failedRules);
PHPUnit::assertTrue($errors->isNotEmpty(), 'Component has no errors.');
<?php protected function classToName($class)
{
$resolvedAliases = array_map(fn ($i) => is_object($i) ? get_class($i) : $i, $this->aliases);
if ($name = array_search($class, $resolvedAliases)) return $name;
<?php protected function formatChannels(array $channels)
{
return array_map(function ($channel) {
$channel = (string) $channel;
if (Str::startsWith($channel, ['private-', 'presence-'])) {
return str_starts_with($channel, 'private-')
? Str::replaceFirst('private-', 'private:', $channel)
: Str::replaceFirst('presence-', 'presence:', $channel);
}
return 'public:'.$channel;
}, $channels);
}