REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.62 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/rector/rector-symfony/src/NodeManipulator/ArrayManipulator.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\Symfony\NodeManipulator; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Scalar\String_; final class ArrayManipulator { public function addItemToArrayUnderKey(Array_ $array, ArrayItem $newArrayItem, string $key) : void { foreach ($array->items as $item) { if (!$item instanceof ArrayItem) { continue; } if ($this->hasKeyName($item, $key)) { if (!$item->value instanceof Array_) { continue; } $item->value->items[] = $newArrayItem; return; } } $array->items[] = new ArrayItem(new Array_([$newArrayItem]), new String_($key)); } public function findItemInInArrayByKeyAndUnset(Array_ $array, string $keyName) : ?ArrayItem { foreach ($array->items as $i => $item) { if (!$item instanceof ArrayItem) { continue; } if (!$this->hasKeyName($item, $keyName)) { continue; } $removedArrayItem = $array->items[$i]; if (!$removedArrayItem instanceof ArrayItem) { continue; } // remove + recount for the printer unset($array->items[$i]); return $item; } return null; } private function hasKeyName(ArrayItem $arrayItem, string $name) : bool { if (!$arrayItem->key instanceof String_) { return \false; } return $arrayItem->key->value === $name; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ArrayManipulator.php
1.62 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ClassManipulator.php
822 B
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).