X7ROOT File Manager
Current Path:
/home/prisjneg/public_html/vendor/nette/utils/src/Utils
home
/
prisjneg
/
public_html
/
vendor
/
nette
/
utils
/
src
/
Utils
/
📁
..
📄
ArrayHash.php
(1.86 KB)
📄
ArrayList.php
(2.61 KB)
📄
Arrays.php
(13.59 KB)
📄
Callback.php
(3.5 KB)
📄
DateTime.php
(5.12 KB)
📄
FileInfo.php
(1.26 KB)
📄
FileSystem.php
(9.48 KB)
📄
Finder.php
(13.04 KB)
📄
Floats.php
(2.07 KB)
📄
Helpers.php
(2.56 KB)
📄
Html.php
(19.03 KB)
📄
Image.php
(23.54 KB)
📄
ImageColor.php
(1.6 KB)
📄
ImageType.php
(421 B)
📄
Iterables.php
(5.64 KB)
📄
Json.php
(2.22 KB)
📄
ObjectHelpers.php
(6.85 KB)
📄
Paginator.php
(4.38 KB)
📄
Random.php
(1.2 KB)
📄
Reflection.php
(8.47 KB)
📄
ReflectionMethod.php
(812 B)
📄
Strings.php
(22.41 KB)
📄
Type.php
(6.36 KB)
📄
Validators.php
(10.41 KB)
📄
exceptions.php
(760 B)
Editing: ArrayList.php
<?php /** * This file is part of the Nette Framework (https://nette.org) * Copyright (c) 2004 David Grudl (https://davidgrudl.com) */ declare(strict_types=1); namespace Nette\Utils; use Nette; /** * Provides the base class for a generic list (items can be accessed by index). * @template T * @implements \IteratorAggregate<int, T> * @implements \ArrayAccess<int, T> */ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate { use Nette\SmartObject; private array $list = []; /** * Transforms array to ArrayList. * @param list<T> $array */ public static function from(array $array): static { if (!Arrays::isList($array)) { throw new Nette\InvalidArgumentException('Array is not valid list.'); } $obj = new static; $obj->list = $array; return $obj; } /** * Returns an iterator over all items. * @return \Iterator<int, T> */ public function &getIterator(): \Iterator { foreach ($this->list as &$item) { yield $item; } } /** * Returns items count. */ public function count(): int { return count($this->list); } /** * Replaces or appends a item. * @param int|null $index * @param T $value * @throws Nette\OutOfRangeException */ public function offsetSet($index, $value): void { if ($index === null) { $this->list[] = $value; } elseif (!is_int($index) || $index < 0 || $index >= count($this->list)) { throw new Nette\OutOfRangeException('Offset invalid or out of range'); } else { $this->list[$index] = $value; } } /** * Returns a item. * @param int $index * @return T * @throws Nette\OutOfRangeException */ public function offsetGet($index): mixed { if (!is_int($index) || $index < 0 || $index >= count($this->list)) { throw new Nette\OutOfRangeException('Offset invalid or out of range'); } return $this->list[$index]; } /** * Determines whether a item exists. * @param int $index */ public function offsetExists($index): bool { return is_int($index) && $index >= 0 && $index < count($this->list); } /** * Removes the element at the specified position in this list. * @param int $index * @throws Nette\OutOfRangeException */ public function offsetUnset($index): void { if (!is_int($index) || $index < 0 || $index >= count($this->list)) { throw new Nette\OutOfRangeException('Offset invalid or out of range'); } array_splice($this->list, $index, 1); } /** * Prepends a item. * @param T $value */ public function prepend(mixed $value): void { $first = array_slice($this->list, 0, 1); $this->offsetSet(0, $value); array_splice($this->list, 1, 0, $first); } }
Upload File
Create Folder