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 public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{
$values = array_map(
fn ($val) => "'" . $val . "'",
$this->values
);
return "ENUM(" . implode(", ", $values) . ")";
}
<?php {
$options = explode(',', preg_replace('/enum\((?P<options>(.*))\)/', '$1', $definition));
return array_map(
function ($option) {
$raw_value = str_replace("''", "'", trim($option, "'"));
if (!preg_match('/\s/', $raw_value)) {
return $raw_value;
}
return sprintf('"%s"', $raw_value);
},
$options
);
}
}
<?php return $table;
}
$segments = array_map(
fn ($name) => Str::snake($name),
$segments
);
sort($segments);
return strtolower(implode('_', $segments));
<?php private function castableColumns(array $columns)
{
return array_filter(
array_map(
fn (Column $column) => $this->castForColumn($column),
$columns
)
);
}
<?php private function dateColumns(array $columns)
{
return array_map(
fn (Column $column) => $column->name(),
array_filter(
$columns,
fn (Column $column) => $column->dataType() === 'date'
|| stripos($column->dataType(), 'datetime') !== false
|| stripos($column->dataType(), 'timestamp') !== false
)
);
}
private function castForColumn(Column $column)
<?php protected function buildParameters(array $data)
{
$parameters = array_map(
fn ($parameter) => '$' . $parameter,
$data
);
return implode(', ', $parameters);
}
<?php $assertion = sprintf('$response->assertRedirect(route(\'%s\'', $statement->route());
if ($statement->data()) {
$parameters = array_map(fn ($parameter) => '$' . $parameter, $statement->data());
$assertion .= ', [' . implode(', ', $parameters) . ']';
} elseif (Str::contains($statement->route(), '.')) {
<?php }
$call .= ');';
$body = implode(PHP_EOL . PHP_EOL, array_map([$this, 'buildLines'], $this->uniqueSetupLines($setup)));
$body .= PHP_EOL . PHP_EOL;
$body .= str_pad(' ', 8) . $call;
$body .= PHP_EOL . PHP_EOL;
<?php $body .= PHP_EOL . PHP_EOL;
$body .= str_pad(' ', 8) . $call;
$body .= PHP_EOL . PHP_EOL;
$body .= implode(PHP_EOL . PHP_EOL, array_map([$this, 'buildLines'], array_filter($assertions)));
$test_case_name = $this->buildTestCaseName($name, $tested_bits);
$test_case = str_replace('{{ method }}', $test_case_name, $test_case);
<?php return ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy'];
}
return array_map('trim', explode(',', strtolower($type)));
}
private function hasOnlyApiResourceMethods(array $methods)
<?php if (isset($columns['indexes'])) {
foreach ($columns['indexes'] as $index) {
$model->addIndex(new Index(key($index), array_map('trim', explode(',', current($index)))));
}
unset($columns['indexes']);
}
<?php $attributes = explode(',', $attributes);
if ($data_type === 'enum') {
$attributes = array_map(fn ($attribute) => trim($attribute, '"'), $attributes);
}
}
}
<?php private function buildParameters(array $data)
{
$parameters = array_map(fn ($parameter) => '$' . $parameter, $data);
return implode(', ', $parameters);
}
<?php if ($this->operation() == 'update') {
if (!empty($this->columns())) {
$columns = implode(', ', array_map(fn ($column) => sprintf("'%s' => \$%s", $column, $column), $this->columns()));
$code = "$" . Str::camel($model) . '->update([' . $columns . ']);';
} elseif ($using_validation) {
<?php private function buildParameters(array $data)
{
$parameters = array_map(fn ($parameter) => '$' . $parameter, $data);
return implode(', ', $parameters);
}