The
collect
function creates a collection instance from the given value:<?php $collection = collect(['taylor', 'abigail']);
<?php public function many(array $keys)
{
return collect($keys)->mapWithKeys(fn ($key) => [$key => $this->get($key)])->all();
}
<?php public function forgetEnvironmentVariables()
{
$variables = collect();
try {
$content = StoreBuilder::createWithNoNames()
<?php public function ddInfo($throwable, $verbosity = null)
{
collect(json_decode($throwable['message'], true))
->each(fn ($var) => VarDumper::dump($var));
}
<?php $outputTrace($throwable, -1);
return collect($throwable['trace'])->each($outputTrace);
}
(new Writer(null, $this->output))->write(
<?php return tap(new Process([
(new ExecutableFinder)->find('node'),
'file-watcher.js',
json_encode(collect(config('octane.watch'))->map(fn ($path) => base_path($path))),
], realpath(__DIR__.'/../../../bin'), null, null, null))->start();
}
<?php }
if (File::exists(base_path('.gitignore'))) {
collect(['rr', '.rr.yaml'])
->each(function ($file) {
$contents = File::get(base_path('.gitignore'));
if (! Str::contains($contents, $file.PHP_EOL)) {
<?php ]);
};
return collect($this->vars)->map($dump)->implode('');
}
}
<?php public static function from($throwable)
{
$fallbackTrace = str_starts_with($throwable->getFile(), 'closure://')
? collect($throwable->getTrace())->whereNotNull('file')->first()
: null;
return new static(
<?php public function resolve(array $coroutines, int $waitSeconds = -1): array
{
return collect($coroutines)->mapWithKeys(
fn ($coroutine, $key) => [$key => $coroutine()]
)->all();
}
<?php public function resolve(array $tasks, int $waitMilliseconds = 1): array
{
return collect($tasks)->mapWithKeys(
fn ($task, $key) => [$key => (function () use ($task) {
try {
return $task();
<?php public static function throwable(Throwable $throwable)
{
$fallbackTrace = str_starts_with($throwable->getFile(), 'closure://')
? collect($throwable->getTrace())->whereNotNull('file')->first()
: null;
fwrite(STDERR, json_encode([
<?php public function resolve(array $tasks, int $waitMilliseconds = 3000): array
{
$tasks = collect($tasks)->mapWithKeys(function ($task, $key) {
return [$key => $task instanceof Closure
? new SerializableClosure($task)
: $task, ];
<?php public function dispatch(array $tasks): void
{
$tasks = collect($tasks)->mapWithKeys(function ($task, $key) {
return [$key => $task instanceof Closure
? new SerializableClosure($task)
: $task, ];
<?php throw new InvalidArgumentException('Tasks can only be resolved within a Swoole server context / web request.');
}
$results = app(Server::class)->taskWaitMulti(collect($tasks)->mapWithKeys(function ($task, $key) {
return [$key => $task instanceof Closure
? new SerializableClosure($task)
: $task, ];
<?php $server = app(Server::class);
collect($tasks)->each(function ($task) use ($server) {
$server->task($task instanceof Closure ? new SerializableClosure($task) : $task);
});
}