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 $tokens['cache'] = $cache['models'] ?? [];
$registry = $blueprint->analyze($tokens);
$only = array_filter(explode(',', $only));
$skip = array_filter(explode(',', $skip));
$generated = $blueprint->generate($registry, $only, $skip, $overwriteMigrations);
<?php $registry = $blueprint->analyze($tokens);
$only = array_filter(explode(',', $only));
$skip = array_filter(explode(',', $skip));
$generated = $blueprint->generate($registry, $only, $skip, $overwriteMigrations);
<?php return $columns;
}
$nonNullableColumns = array_filter(
$columns,
fn (Column $column) => !in_array('nullable', $column->modifiers())
);
return array_filter(
$nonNullableColumns,
<?php fn (Column $column) => !in_array('nullable', $column->modifiers())
);
return array_filter(
$nonNullableColumns,
fn (Column $column) => $column->dataType() !== 'softDeletes'
);
}
private function fullyQualifyModelReference(string $model_name)
<?php private function castableColumns(array $columns)
{
return array_filter(
array_map(
fn (Column $column) => $this->castForColumn($column),
$columns
)
);
}
private function dateColumns(array $columns)
<?php {
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
)
);
}
<?php $paths = [];
foreach (array_filter($routes) as $type => $definitions) {
$path = 'routes/' . $type . '.php';
$this->filesystem->append($path, $definitions . PHP_EOL);
$paths[] = $path;
<?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 array_filter($statements);
}
private function analyzeRender(string $statement)
<?php $classes = array_merge($classes, $this->filesystem->allFiles($path));
}
return array_filter(array_map(function (\SplFIleInfo $file) {
if ($file->getExtension() !== 'php') {
return;
}
$content = $this->filesystem->get($file->getPathName());
preg_match("/namespace ([\w\\\\]+)/", $content, $namespace);
preg_match("/class (\w+)/", $content, $class);
return ($namespace[1] ?? '').'\\'.($class[1] ?? '');
}, $classes));
}
private function loadModel(string $class)
<?php return $this->models[Str::studly(Str::plural($context))];
}
$matches = array_filter(array_keys($this->models), fn ($key) => Str::endsWith(Str::afterLast(Str::afterLast($key, '\\'), '/'), [Str::studly($context), Str::studly(Str::plural($context))]));
if (count($matches) === 1) {
return $this->models[current($matches)];
<?php return $this->models[$context]->fullyQualifiedClassName();
}
$matches = array_filter(array_keys($this->models), fn ($key) => Str::endsWith($key, '\\' . Str::studly($context)));
if (count($matches) === 1) {
return $this->models[current($matches)]->fullyQualifiedClassName();