░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/moodle/public/lib/spatie/php-cloneable/src
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: Cloneable.php
<?php namespace Spatie\Cloneable; use ReflectionClass; trait Cloneable { public function with(...$values): static { $refClass = new ReflectionClass(static::class); $clone = $refClass->newInstanceWithoutConstructor(); foreach ($refClass->getProperties() as $property) { if ($property->isStatic()) { continue; } $objectField = $property->getName(); if (array_key_exists($objectField, $values)) { $objectValue = $values[$objectField]; } elseif ($property->isInitialized($this)) { $objectValue = $property->getValue($this); } else { continue; } $declarationScope = $property->getDeclaringClass()->getName(); if ($declarationScope === self::class) { $clone->$objectField = $objectValue; } else { (fn () => $this->$objectField = $objectValue) ->bindTo($clone, $declarationScope)(); } } return $clone; } }
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 Cloneable.php
PHP
1.1 KB
2026-02-11 01:44
EDIT