Files
lucent-laravel/src/Primitive/StringCollection.php
T

39 lines
725 B
PHP
Raw Normal View History

2023-10-02 23:10:49 +03:00
<?php
namespace Lucent\Primitive;
use Illuminate\Support\Collection;
/**
* @extends \Illuminate\Support\Collection<int|string, string>
*/
final class StringCollection extends Collection
{
public function __construct(
string ...$array
) {
parent::__construct($array);
}
/**
* @return string[]
**/
public function toArray(): array
{
return collect($this)->values()->toArray();
}
public static function fromArray(array $data): StringCollection
{
return new StringCollection(...$data);
}
public static function fromDB(string $data): StringCollection
{
return new StringCollection(...\json_decode($data,true));
}
}