@vituum/vite-plugin-latte 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/latte/PlaceholderFunction.php +2 -2
- package/package.json +1 -1
- package/vendor/autoload.php +1 -1
- package/vendor/composer/autoload_classmap.php +51 -0
- package/vendor/composer/autoload_real.php +4 -4
- package/vendor/composer/autoload_static.php +53 -2
- package/vendor/composer/installed.json +96 -7
- package/vendor/composer/installed.php +14 -5
- package/vendor/latte/latte/src/Latte/Compiler/Escaper.php +11 -2
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/FilterNode.php +1 -1
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ModifierNode.php +2 -2
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/NameNode.php +11 -21
- package/vendor/latte/latte/src/Latte/Compiler/PrintContext.php +1 -1
- package/vendor/latte/latte/src/Latte/Compiler/TagLexer.php +2 -2
- package/vendor/latte/latte/src/Latte/Compiler/TagParserData.php +275 -280
- package/vendor/latte/latte/src/Latte/Compiler/TemplateGenerator.php +4 -4
- package/vendor/latte/latte/src/Latte/Compiler/TemplateLexer.php +10 -2
- package/vendor/latte/latte/src/Latte/Compiler/TemplateParserHtml.php +6 -2
- package/vendor/latte/latte/src/Latte/Engine.php +109 -97
- package/vendor/latte/latte/src/Latte/Essential/AuxiliaryIterator.php +46 -0
- package/vendor/latte/latte/src/Latte/Essential/Blueprint.php +42 -25
- package/vendor/latte/latte/src/Latte/Essential/CoreExtension.php +76 -72
- package/vendor/latte/latte/src/Latte/Essential/Filters.php +95 -37
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ContentTypeNode.php +7 -0
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ForeachNode.php +36 -0
- package/vendor/latte/latte/src/Latte/Essential/Nodes/TemplatePrintNode.php +25 -3
- package/vendor/latte/latte/src/Latte/Essential/Nodes/VarPrintNode.php +9 -2
- package/vendor/latte/latte/src/Latte/Essential/Passes.php +10 -50
- package/vendor/latte/latte/src/Latte/Helpers.php +3 -1
- package/vendor/latte/latte/src/Latte/Loader.php +1 -0
- package/vendor/latte/latte/src/Latte/Loaders/FileLoader.php +1 -2
- package/vendor/latte/latte/src/Latte/Runtime/Filters.php +1 -4
- package/vendor/latte/latte/src/Latte/Runtime/FunctionExecutor.php +68 -0
- package/vendor/latte/latte/src/Latte/Runtime/Template.php +1 -3
- package/vendor/nette/utils/.phpstorm.meta.php +13 -0
- package/vendor/nette/utils/composer.json +51 -0
- package/vendor/nette/utils/license.md +60 -0
- package/vendor/nette/utils/readme.md +56 -0
- package/vendor/nette/utils/src/HtmlStringable.php +22 -0
- package/vendor/nette/utils/src/Iterators/CachingIterator.php +164 -0
- package/vendor/nette/utils/src/Iterators/Mapper.php +34 -0
- package/vendor/nette/utils/src/SmartObject.php +140 -0
- package/vendor/nette/utils/src/StaticClass.php +34 -0
- package/vendor/nette/utils/src/Translator.php +25 -0
- package/vendor/nette/utils/src/Utils/ArrayHash.php +106 -0
- package/vendor/nette/utils/src/Utils/ArrayList.php +136 -0
- package/vendor/nette/utils/src/Utils/Arrays.php +522 -0
- package/vendor/nette/utils/src/Utils/Callback.php +137 -0
- package/vendor/nette/utils/src/Utils/DateTime.php +140 -0
- package/vendor/nette/utils/src/Utils/FileInfo.php +69 -0
- package/vendor/nette/utils/src/Utils/FileSystem.php +326 -0
- package/vendor/nette/utils/src/Utils/Finder.php +510 -0
- package/vendor/nette/utils/src/Utils/Floats.php +107 -0
- package/vendor/nette/utils/src/Utils/Helpers.php +104 -0
- package/vendor/nette/utils/src/Utils/Html.php +839 -0
- package/vendor/nette/utils/src/Utils/Image.php +829 -0
- package/vendor/nette/utils/src/Utils/ImageColor.php +75 -0
- package/vendor/nette/utils/src/Utils/ImageType.php +25 -0
- package/vendor/nette/utils/src/Utils/Iterables.php +159 -0
- package/vendor/nette/utils/src/Utils/Json.php +84 -0
- package/vendor/nette/utils/src/Utils/ObjectHelpers.php +229 -0
- package/vendor/nette/utils/src/Utils/Paginator.php +245 -0
- package/vendor/nette/utils/src/Utils/Random.php +52 -0
- package/vendor/nette/utils/src/Utils/Reflection.php +320 -0
- package/vendor/nette/utils/src/Utils/ReflectionMethod.php +36 -0
- package/vendor/nette/utils/src/Utils/Strings.php +708 -0
- package/vendor/nette/utils/src/Utils/Type.php +267 -0
- package/vendor/nette/utils/src/Utils/Validators.php +416 -0
- package/vendor/nette/utils/src/Utils/exceptions.php +50 -0
- package/vendor/nette/utils/src/compatibility.php +32 -0
- package/vendor/nette/utils/src/exceptions.php +109 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is part of the Nette Framework (https://nette.org)
|
|
5
|
+
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare(strict_types=1);
|
|
9
|
+
|
|
10
|
+
namespace Nette;
|
|
11
|
+
|
|
12
|
+
use Nette\Utils\ObjectHelpers;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Strict class for better experience.
|
|
17
|
+
* - 'did you mean' hints
|
|
18
|
+
* - access to undeclared members throws exceptions
|
|
19
|
+
* - support for @property annotations
|
|
20
|
+
* - support for calling event handlers stored in $onEvent via onEvent()
|
|
21
|
+
*/
|
|
22
|
+
trait SmartObject
|
|
23
|
+
{
|
|
24
|
+
/**
|
|
25
|
+
* @return mixed
|
|
26
|
+
* @throws MemberAccessException
|
|
27
|
+
*/
|
|
28
|
+
public function __call(string $name, array $args)
|
|
29
|
+
{
|
|
30
|
+
$class = static::class;
|
|
31
|
+
|
|
32
|
+
if (ObjectHelpers::hasProperty($class, $name) === 'event') { // calling event handlers
|
|
33
|
+
$handlers = $this->$name ?? null;
|
|
34
|
+
if (is_iterable($handlers)) {
|
|
35
|
+
foreach ($handlers as $handler) {
|
|
36
|
+
$handler(...$args);
|
|
37
|
+
}
|
|
38
|
+
} elseif ($handlers !== null) {
|
|
39
|
+
throw new UnexpectedValueException("Property $class::$$name must be iterable or null, " . get_debug_type($handlers) . ' given.');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ObjectHelpers::strictCall($class, $name);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @throws MemberAccessException
|
|
51
|
+
*/
|
|
52
|
+
public static function __callStatic(string $name, array $args)
|
|
53
|
+
{
|
|
54
|
+
ObjectHelpers::strictStaticCall(static::class, $name);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @return mixed
|
|
60
|
+
* @throws MemberAccessException if the property is not defined.
|
|
61
|
+
*/
|
|
62
|
+
public function &__get(string $name)
|
|
63
|
+
{
|
|
64
|
+
$class = static::class;
|
|
65
|
+
|
|
66
|
+
if ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property getter
|
|
67
|
+
if (!($prop & 0b0001)) {
|
|
68
|
+
throw new MemberAccessException("Cannot read a write-only property $class::\$$name.");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
$m = ($prop & 0b0010 ? 'get' : 'is') . ucfirst($name);
|
|
72
|
+
if ($prop & 0b10000) {
|
|
73
|
+
$trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call()
|
|
74
|
+
$loc = isset($trace['file'], $trace['line'])
|
|
75
|
+
? " in $trace[file] on line $trace[line]"
|
|
76
|
+
: '';
|
|
77
|
+
trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if ($prop & 0b0100) { // return by reference
|
|
81
|
+
return $this->$m();
|
|
82
|
+
} else {
|
|
83
|
+
$val = $this->$m();
|
|
84
|
+
return $val;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
ObjectHelpers::strictGet($class, $name);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @throws MemberAccessException if the property is not defined or is read-only
|
|
94
|
+
*/
|
|
95
|
+
public function __set(string $name, mixed $value): void
|
|
96
|
+
{
|
|
97
|
+
$class = static::class;
|
|
98
|
+
|
|
99
|
+
if (ObjectHelpers::hasProperty($class, $name)) { // unsetted property
|
|
100
|
+
$this->$name = $value;
|
|
101
|
+
|
|
102
|
+
} elseif ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property setter
|
|
103
|
+
if (!($prop & 0b1000)) {
|
|
104
|
+
throw new MemberAccessException("Cannot write to a read-only property $class::\$$name.");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
$m = 'set' . ucfirst($name);
|
|
108
|
+
if ($prop & 0b10000) {
|
|
109
|
+
$trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call()
|
|
110
|
+
$loc = isset($trace['file'], $trace['line'])
|
|
111
|
+
? " in $trace[file] on line $trace[line]"
|
|
112
|
+
: '';
|
|
113
|
+
trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
$this->$m($value);
|
|
117
|
+
|
|
118
|
+
} else {
|
|
119
|
+
ObjectHelpers::strictSet($class, $name);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @throws MemberAccessException
|
|
126
|
+
*/
|
|
127
|
+
public function __unset(string $name): void
|
|
128
|
+
{
|
|
129
|
+
$class = static::class;
|
|
130
|
+
if (!ObjectHelpers::hasProperty($class, $name)) {
|
|
131
|
+
throw new MemberAccessException("Cannot unset the property $class::\$$name.");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
public function __isset(string $name): bool
|
|
137
|
+
{
|
|
138
|
+
return isset(ObjectHelpers::getMagicProperties(static::class)[$name]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is part of the Nette Framework (https://nette.org)
|
|
5
|
+
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare(strict_types=1);
|
|
9
|
+
|
|
10
|
+
namespace Nette;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Static class.
|
|
15
|
+
*/
|
|
16
|
+
trait StaticClass
|
|
17
|
+
{
|
|
18
|
+
/**
|
|
19
|
+
* Class is static and cannot be instantiated.
|
|
20
|
+
*/
|
|
21
|
+
private function __construct()
|
|
22
|
+
{
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Call to undefined static method.
|
|
28
|
+
* @throws MemberAccessException
|
|
29
|
+
*/
|
|
30
|
+
public static function __callStatic(string $name, array $args): mixed
|
|
31
|
+
{
|
|
32
|
+
Utils\ObjectHelpers::strictStaticCall(static::class, $name);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is part of the Nette Framework (https://nette.org)
|
|
5
|
+
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare(strict_types=1);
|
|
9
|
+
|
|
10
|
+
namespace Nette\Localization;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Translator adapter.
|
|
15
|
+
*/
|
|
16
|
+
interface Translator
|
|
17
|
+
{
|
|
18
|
+
/**
|
|
19
|
+
* Translates the given string.
|
|
20
|
+
*/
|
|
21
|
+
function translate(string|\Stringable $message, mixed ...$parameters): string|\Stringable;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
interface_exists(ITranslator::class);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is part of the Nette Framework (https://nette.org)
|
|
5
|
+
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare(strict_types=1);
|
|
9
|
+
|
|
10
|
+
namespace Nette\Utils;
|
|
11
|
+
|
|
12
|
+
use Nette;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Provides objects to work as array.
|
|
17
|
+
* @template T
|
|
18
|
+
* @implements \IteratorAggregate<array-key, T>
|
|
19
|
+
* @implements \ArrayAccess<array-key, T>
|
|
20
|
+
*/
|
|
21
|
+
class ArrayHash extends \stdClass implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
22
|
+
{
|
|
23
|
+
/**
|
|
24
|
+
* Transforms array to ArrayHash.
|
|
25
|
+
* @param array<T> $array
|
|
26
|
+
*/
|
|
27
|
+
public static function from(array $array, bool $recursive = true): static
|
|
28
|
+
{
|
|
29
|
+
$obj = new static;
|
|
30
|
+
foreach ($array as $key => $value) {
|
|
31
|
+
$obj->$key = $recursive && is_array($value)
|
|
32
|
+
? static::from($value)
|
|
33
|
+
: $value;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return $obj;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns an iterator over all items.
|
|
42
|
+
* @return \Iterator<array-key, T>
|
|
43
|
+
*/
|
|
44
|
+
public function &getIterator(): \Iterator
|
|
45
|
+
{
|
|
46
|
+
foreach ((array) $this as $key => $foo) {
|
|
47
|
+
yield $key => $this->$key;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns items count.
|
|
54
|
+
*/
|
|
55
|
+
public function count(): int
|
|
56
|
+
{
|
|
57
|
+
return count((array) $this);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Replaces or appends a item.
|
|
63
|
+
* @param array-key $key
|
|
64
|
+
* @param T $value
|
|
65
|
+
*/
|
|
66
|
+
public function offsetSet($key, $value): void
|
|
67
|
+
{
|
|
68
|
+
if (!is_scalar($key)) { // prevents null
|
|
69
|
+
throw new Nette\InvalidArgumentException(sprintf('Key must be either a string or an integer, %s given.', get_debug_type($key)));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
$this->$key = $value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns a item.
|
|
78
|
+
* @param array-key $key
|
|
79
|
+
* @return T
|
|
80
|
+
*/
|
|
81
|
+
#[\ReturnTypeWillChange]
|
|
82
|
+
public function offsetGet($key)
|
|
83
|
+
{
|
|
84
|
+
return $this->$key;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Determines whether a item exists.
|
|
90
|
+
* @param array-key $key
|
|
91
|
+
*/
|
|
92
|
+
public function offsetExists($key): bool
|
|
93
|
+
{
|
|
94
|
+
return isset($this->$key);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Removes the element from this list.
|
|
100
|
+
* @param array-key $key
|
|
101
|
+
*/
|
|
102
|
+
public function offsetUnset($key): void
|
|
103
|
+
{
|
|
104
|
+
unset($this->$key);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is part of the Nette Framework (https://nette.org)
|
|
5
|
+
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare(strict_types=1);
|
|
9
|
+
|
|
10
|
+
namespace Nette\Utils;
|
|
11
|
+
|
|
12
|
+
use Nette;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Provides the base class for a generic list (items can be accessed by index).
|
|
17
|
+
* @template T
|
|
18
|
+
* @implements \IteratorAggregate<int, T>
|
|
19
|
+
* @implements \ArrayAccess<int, T>
|
|
20
|
+
*/
|
|
21
|
+
class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
22
|
+
{
|
|
23
|
+
use Nette\SmartObject;
|
|
24
|
+
|
|
25
|
+
private array $list = [];
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Transforms array to ArrayList.
|
|
30
|
+
* @param list<T> $array
|
|
31
|
+
*/
|
|
32
|
+
public static function from(array $array): static
|
|
33
|
+
{
|
|
34
|
+
if (!Arrays::isList($array)) {
|
|
35
|
+
throw new Nette\InvalidArgumentException('Array is not valid list.');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
$obj = new static;
|
|
39
|
+
$obj->list = $array;
|
|
40
|
+
return $obj;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns an iterator over all items.
|
|
46
|
+
* @return \Iterator<int, T>
|
|
47
|
+
*/
|
|
48
|
+
public function &getIterator(): \Iterator
|
|
49
|
+
{
|
|
50
|
+
foreach ($this->list as &$item) {
|
|
51
|
+
yield $item;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns items count.
|
|
58
|
+
*/
|
|
59
|
+
public function count(): int
|
|
60
|
+
{
|
|
61
|
+
return count($this->list);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Replaces or appends a item.
|
|
67
|
+
* @param int|null $index
|
|
68
|
+
* @param T $value
|
|
69
|
+
* @throws Nette\OutOfRangeException
|
|
70
|
+
*/
|
|
71
|
+
public function offsetSet($index, $value): void
|
|
72
|
+
{
|
|
73
|
+
if ($index === null) {
|
|
74
|
+
$this->list[] = $value;
|
|
75
|
+
|
|
76
|
+
} elseif (!is_int($index) || $index < 0 || $index >= count($this->list)) {
|
|
77
|
+
throw new Nette\OutOfRangeException('Offset invalid or out of range');
|
|
78
|
+
|
|
79
|
+
} else {
|
|
80
|
+
$this->list[$index] = $value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Returns a item.
|
|
87
|
+
* @param int $index
|
|
88
|
+
* @return T
|
|
89
|
+
* @throws Nette\OutOfRangeException
|
|
90
|
+
*/
|
|
91
|
+
public function offsetGet($index): mixed
|
|
92
|
+
{
|
|
93
|
+
if (!is_int($index) || $index < 0 || $index >= count($this->list)) {
|
|
94
|
+
throw new Nette\OutOfRangeException('Offset invalid or out of range');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return $this->list[$index];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Determines whether a item exists.
|
|
103
|
+
* @param int $index
|
|
104
|
+
*/
|
|
105
|
+
public function offsetExists($index): bool
|
|
106
|
+
{
|
|
107
|
+
return is_int($index) && $index >= 0 && $index < count($this->list);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Removes the element at the specified position in this list.
|
|
113
|
+
* @param int $index
|
|
114
|
+
* @throws Nette\OutOfRangeException
|
|
115
|
+
*/
|
|
116
|
+
public function offsetUnset($index): void
|
|
117
|
+
{
|
|
118
|
+
if (!is_int($index) || $index < 0 || $index >= count($this->list)) {
|
|
119
|
+
throw new Nette\OutOfRangeException('Offset invalid or out of range');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
array_splice($this->list, $index, 1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Prepends a item.
|
|
128
|
+
* @param T $value
|
|
129
|
+
*/
|
|
130
|
+
public function prepend(mixed $value): void
|
|
131
|
+
{
|
|
132
|
+
$first = array_slice($this->list, 0, 1);
|
|
133
|
+
$this->offsetSet(0, $value);
|
|
134
|
+
array_splice($this->list, 1, 0, $first);
|
|
135
|
+
}
|
|
136
|
+
}
|