BitsVector
class BitsVector extends BaseVector
Traits
Constants
| CB_ZERO_ARG |
|
Properties
| protected array | $items | from BaseVector |
Methods
Determines if at least an element of the collection satisfies a condition.
Determines if all elements of the collection satisfies a condition.
Create a new collection instance from the specified iterable.
No description
No description
No description
No description
Append all elements of the specified iterable to the current vector.
Append all elements of the specified iterable to the current vector.
Replace a part of the vector by the specified iterable.
Create a new vector by applying a callback on each element of the vector.
Create a new vector by filtering each element of the vector according the return value of the specified callback function.
Allows to map each vector elements into key/value pairs and collect them into a HashMap.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Pad the vector with 0 at the leftmost position ("zerofill")
No description
Truncate or pad the array as needed to ensure a specified length.
Copy the bits of the specified integer to the bits vector at the specified offset.
Details
in
WithCollection at line 12
abstract int
count()
No description
in
WithCollection at line 13
abstract array
toArray()
No description
in
WithCollection at line 15
mixed
first()
No description
in
WithCollection at line 23
mixed
firstOr(mixed $default)
No description
in
WithCollection at line 45
bool
any(callable $callable)
Determines if at least an element of the collection satisfies a condition.
The execution of callbacks stop after a callable returned true.
in
WithCollection at line 78
bool
all(callable $callable)
Determines if all elements of the collection satisfies a condition.
The execution of callbacks stop after a callable returned false.
in
BaseVector at line 45
static BaseCollection
from(iterable $items)
Create a new collection instance from the specified iterable.
in
BaseVector at line 95
bool
isEmpty()
Determine if a collection is empty.
at line 195
__construct(iterable $bits = [])
No description
in
BaseVector at line 53
mixed
get(int $key)
No description
in
BaseVector at line 61
mixed
getOr(int $key, mixed $defaultValue)
No description
at line 200
BaseVector
set(int $key, mixed $value)
No description
in
BaseVector at line 71
BaseVector
unset(int $key)
No description
at line 205
bool
contains(mixed $value)
No description
in
BaseVector at line 99
BaseVector
clear()
No description
at line 210
BaseVector
push(mixed $item)
No description
at line 215
BaseVector
append(iterable $iterable)
Append all elements of the specified iterable to the current vector.
If a value already exists, the value is still added as a duplicate.
This method returns the instance itself, so you can use it in fluent pattern.
at line 220
BaseVector
update(iterable $iterable)
Append all elements of the specified iterable to the current vector.
If a value already exists, it is skipped.
This method returns the instance itself, so you can use it in fluent pattern.
in
BaseVector at line 159
BaseVector
replace(iterable $iterable, int $offset = 0, int $len = 0)
Replace a part of the vector by the specified iterable.
This method returns the instance itself, so you can use it in fluent pattern.
in
BaseVector at line 198
BaseVector
map(callable $callable)
Create a new vector by applying a callback on each element of the vector.
in
BaseVector at line 226
BaseVector
filter(callable $callable)
Create a new vector by filtering each element of the vector according the return value of the specified callback function.
Example:
$words = new Vector(["foo", "bar", "quux", "xizzy"]);
$threeLettersWords = $words->filter(
fn(string $word) => strlen($word) === 3
);
// The new vector contains "foo" and "bar".
in
BaseVector at line 242
BaseVector
mapKeys(callable $callable)
No description
in
BaseVector at line 259
HashMap
mapToHashMap(callable $callable)
Allows to map each vector elements into key/value pairs and collect them into a HashMap.
in
BaseVector at line 282
BaseVector
flatMap(callable $callable)
No description
in
BaseVector at line 298
BaseVector
filterKeys(callable $callable)
No description
in
BaseVector at line 304
Vector
chunk(int $length)
No description
in
BaseVector at line 308
BaseVector
slice(int $offset, int $length)
No description
in
BaseVector at line 313
OmniString
implode(string $delimiter)
No description
in
BaseVector at line 317
Vector
bigrams()
No description
in
BaseVector at line 321
Vector
trigrams()
No description
in
BaseVector at line 325
Vector
ngrams(int $n)
No description
in
BaseVector at line 361
bool
offsetExists(mixed $offset)
No description
in
BaseVector at line 367
mixed
offsetGet(mixed $offset)
No description
at line 225
void
offsetSet(mixed $offset, mixed $value)
No description
in
BaseVector at line 384
void
offsetUnset(mixed $offset)
No description
in
BaseVector at line 402
ArrayIterator
getIterator()
Retrieve an iterator on the elements of the vector.
This iterator also allows unsetting and modifying values and keys while iterating.
at line 15
static BitsVector
new(int $capacity)
No description
at line 23
static BitsVector
fromInteger(int $n)
No description
at line 27
static BitsVector
fromBinaryString(string $bits)
No description
at line 32
static BitsVector
fromHexString(string $number)
No description
at line 41
static BitsVector
fromDecoratedHexString(string $expression)
No description
at line 46
static BitsVector
fromString(string $string)
No description
at line 53
static BitsVector
random(int $length)
No description
at line 71
string
toBinaryString()
No description
at line 75
int
toInteger()
No description
at line 88
string
toHexString()
No description
at line 99
array
toBytesArray()
No description
at line 115
BitsVector
pad(int $length)
Pad the vector with 0 at the leftmost position ("zerofill")
at line 129
BitsVector
truncate(int $length)
No description
at line 143
BitsVector
shapeCapacity(int $length)
Truncate or pad the array as needed to ensure a specified length.
at line 165
BitsVector
copyInteger(int $integer, int $offset, int $length)
Copy the bits of the specified integer to the bits vector at the specified offset.