for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace PHPAbles\Arrayable;
use Illuminate\Contracts\Support\Arrayable as IlluminateArrayable,
Inspirum\Arrayable\Arrayable as InspirumArrayable,
PhpExtended\Arrayable\ArrayableInterface as PhpExtendedArrayable;
final class Arrayable extends AbstractArrayable
{
private array $array;
public function __construct(array|IlluminateArrayable|InspirumArrayable|PhpExtendedArrayable $array)
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.
if (is_array($array)) {
is_array($array)
true
$this->array = $array;
return;
}
$this->inherit($array);
public function toArray(): array
$array = parent::toArray();
return array_key_exists('array', $array) ? $array['array'] : [];
private function inherit(IlluminateArrayable|InspirumArrayable|PhpExtendedArrayable $arrayable): void
if (($arrayable instanceOf IlluminateArrayable) ||
instanceof
instanceOf
($arrayable instanceOf PhpExtendedArrayable)) {
$this->array = $arrayable->toArray();
$this->array = $arrayable->__toArray();
This check marks files that end in a newline character, i.e. an empy line.