/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Support/Common.php
62 строки
1 KB
Sergey Danilchenko
[12.x] Introduce Arr::from() (#55715)
12 май 2025, 16:59
Не верифицирован
12 май 2025, 16:59
64c440f
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Support; use ArrayIterator; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Jsonable; use IteratorAggregate; use JsonSerializable; use Traversable; class TestArrayableObject implements Arrayable { public function toArray() { return ['foo' => 'bar']; } } class TestJsonableObject implements Jsonable { public function toJson($options = 0) { return '{"foo":"bar"}'; } } class TestJsonSerializeObject implements JsonSerializable { public function jsonSerialize(): array { return ['foo' => 'bar']; } } class TestJsonSerializeWithScalarValueObject implements JsonSerializable { public function jsonSerialize(): string { return 'foo'; } } class TestTraversableAndJsonSerializableObject implements IteratorAggregate, JsonSerializable { public $items; public function __construct($items = []) { $this->items = $items; } public function getIterator(): Traversable { return new ArrayIterator($this->items); } public function jsonSerialize(): array { return json_decode(json_encode($this->items), true); } }