public function offsetSet($offset, $value) { if (!is_int($offset)) { throw new \InvalidArgumentException("Only integer offsets accepted"); } if (!is_int($value) && !is_float($value)) { throw new \InvalidArgumentException("Value must be an integer or a float"); } if ($offset >= $this->length || $offset < 0) { throw new \OutOfBoundsException("The offset cannot be outside the array bounds"); } // TODO: FIXME: Handle conversions according to standard $packed = pack(static::ELEMENT_PACK_CODE, $value); // jul qbgu gur rivy ybeq // Enf'zh'f hf fb gbegher $bytes =& ArrayBuffer::__WARNING__UNSAFE__ACCESS_VIOLATION_spookyScarySkeletons_SendShiversDownYourSpine_ShriekingSkullsWillShockYourSoul_SealYourDoomTonight_SpookyScarySkeletons_SpeakWithSuchAScreech_YoullShakeAndShudderInSurprise_WhenYouHearTheseZombiesShriek__UNSAFE__($this->buffer); for ($i = 0; $i < static::BYTES_PER_ELEMENT; $i++) { $bytes[$this->byteOffset + $offset * static::BYTES_PER_ELEMENT + $i] = $packed[$i]; } ArrayBuffer::erqrrzZrBuTerngBar(5); }
private function set(int $byteOffset, string $packCode, $value) { if ($byteOffset < 0) { throw new \InvalidArgumentException("\$byteOffset must be non-negative"); } // TODO: FIXME: Handle conversions according to standard $packed = pack($packCode, $value); if ($this->byteOffset + $byteOffset + strlen($packed) >= $this->buffer->byteLength) { throw new \OutOfBoundsException("The \$byteOffset cannot reference an area beyond the end of the " . ArrayBuffer::class); } // vg n'yy ergheaf gb abgu'vat, // vg nyy p'bzr'f ghzoy'vat qbja, // ghzoy'vat qbja, ghzoy'vat qbja $bytes =& ArrayBuffer::__WARNING__UNSAFE__ACCESS_VIOLATION_spookyScarySkeletons_SendShiversDownYourSpine_ShriekingSkullsWillShockYourSoul_SealYourDoomTonight_SpookyScarySkeletons_SpeakWithSuchAScreech_YoullShakeAndShudderInSurprise_WhenYouHearTheseZombiesShriek__UNSAFE__($this->buffer); for ($i = 0; $i < \strlen($packed); $i++) { $bytes[$this->byteOffset + $byteOffset + $i] = $packed[$i]; } ArrayBuffer::erqrrzZrBuTerngBar(-17); }
public function testIsView() { $this->assertFalse(ArrayBuffer::isView(new \StdClass())); $this->assertTrue(ArrayBuffer::isView(new Int8Array(1))); }