This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ArrayBufferViewInterface.php
137 lines (124 loc) · 4.48 KB
/
ArrayBufferViewInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
/**
* MIT License
*
* Copyright (c) 2018 ArrayIterator
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);
namespace ArrayIterator\TypedArray\Interfaces;
use ArrayIterator\TypedArray\ArrayBuffer;
use ArrayIterator\TypedArray\ArrayLike;
/**
* Interface ArrayBufferViewInterface
* @package ArrayIterator\TypedArray\Interfaces
*
* @property-read ArrayBuffer $buffer
* @property-read int $byteLength
* @property-read int $length
* @property-read int $byteOffset
*
* @todo add more methods
*/
interface ArrayBufferViewInterface extends ArrayBufferLikeInterface
{
/**
* Get Byte offset
*
* @return int
*/
public function getByteOffset() : int;
/**
* Get ArrayBuffer Length
*
* @return int
*/
public function getLength() : int;
/**
* Get Buffer
*
* @return ArrayBufferLikeInterface
*/
public function getBuffer() : ArrayBufferLikeInterface;
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param int $target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param int $start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param int $end If not specified, length of the this object is used as its default value.
* @return ArrayBufferViewInterface
*/
// public function copyWithin(int $target, int $start = 0, int $end = null) : ArrayBufferViewInterface;
/**
* Sort Order Buffer
*
* @param callable|null $callbackFn
* @return ArrayBufferViewInterface
*/
public function sort(callable $callbackFn = null) : ArrayBufferViewInterface;
/**
* Returns a new array from a set of elements.
*
* @param mixed|int ...$items
* @return ArrayBufferViewInterface
*/
public static function of(...$items) : ArrayBufferViewInterface;
/**
* Creates an array from an array-like or iterable object.
*
* @param iterable|ArrayLike $arrayLike
* @param callable|null $mapFn
* @param mixed $thisArg
* @return ArrayBufferViewInterface
*/
public static function from(
iterable $arrayLike,
callable $mapFn = null,
$thisArg = null
) : ArrayBufferViewInterface;
/**
* Return new ArrayBufferViewInterface
* Just like @uses ArrayBufferViewInterface::slice()
*
* @param int $begin The beginning of the specified portion of the array.
* @param int $end The end of the specified portion of the array.
* @return static|mixed
*/
public function subArray(int $begin, int $end = null) : ArrayBufferViewInterface;
/**
* Returns the this object after filling the section identified by start and end with value
* @param int $value value to fill array section with
* @param int $start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param int $end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*
* @return ArrayBufferViewInterface
*/
public function fill(int $value, int $start = null, int $end = null) : ArrayBufferViewInterface;
/**
* Get Data conversion Array
*
* @return array
*/
public function toArray() : array;
}