8000 TypedArray/src/TypedArray/ArrayBufferLike.php at master · ArrayIterator/TypedArray · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.
{"payload":{"allShortcutsEnabled":false,"fileTree":{"src/TypedArray":{"items":[{"name":"Interfaces","path":"src/TypedArray/Interfaces","contentType":"directory"},{"name":"Traits","path":"src/TypedArray/Traits","contentType":"directory"},{"name":"Util","path":"src/TypedArray/Util","contentType":"directory"},{"name":"ArrayBuffer.php","path":"src/TypedArray/ArrayBuffer.php","contentType":"file"},{"name":"ArrayBufferAbstract.php","path":"src/TypedArray/ArrayBufferAbstract.php","contentType":"file"},{"name":"ArrayBufferLike.php","path":"src/TypedArray/ArrayBufferLike.php","contentType":"file"},{"name":"ArrayBufferView.php","path":"src/TypedArray/ArrayBufferView.php","contentType":"file"},{"name":"ArrayLike.php","path":"src/TypedArray/ArrayLike.php","contentType":"file"},{"name":"Buffer.php","path":"src/TypedArray/Buffer.php","contentType":"file"},{"name":"Float32Array.php","path":"src/TypedArray/Float32Array.php","contentType":"file"},{"name":"Float64Array.php","path":"src/TypedArray/Float64Array.php","contentType":"file"},{"name":"Int16Array.php","path":"src/TypedArray/Int16Array.php","contentType":"file"},{"name":"Int32Array.php","path":"src/TypedArray/Int32Array.php","contentType":"file"},{"name":"Int8Array.php","path":"src/TypedArray/Int8Array.php","contentType":"file"},{"name":"Uint16Array.php","path":"src/TypedArray/Uint16Array.php","contentType":"file"},{"name":"Uint32Array.php","path":"src/TypedArray/Uint32Array.php","contentType":"file"},{"name":"Uint8Array.php","path":"src/TypedArray/Uint8Array.php","contentType":"file"}],"totalCount":17},"src":{"items":[{"name":"TypedArray","path":"src/TypedArray","contentType":"directory"}],"totalCount":1},"":{"items":[{"name":"src","path":"src","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"composer.json","path":"composer.json","contentType":"file"},{"name":"phpcs.xml","path":"phpcs.xml","contentType":"file"}],"totalCount":6}},"fileTreeProcessingTime":5.053197,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":128374968,"defaultBranch":"master","name":"TypedArray","ownerLogin":"ArrayIterator","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2018-04-06T09:25:54.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/37867551?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1523006783.0","canEdit":false,"refType":"branch","currentOid":"1ab62dc90af1013a1759db541b71c36a472ea0af"},"path":"src/TypedArray/ArrayBufferLike.php","currentUser":null,"blob":{"rawLines":["\u003c?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;","","use ArrayIterator\\TypedArray\\Interfaces\\ArrayBufferLikeInterface;","","/**"," * Class ArrayBufferLike"," * @package ArrayIterator\\TypedArray"," *"," * @property-read int $length"," * @property-read int $byteLength"," */","abstract class ArrayBufferLike extends ArrayLike implements ArrayBufferLikeInterface","{"," /**"," * @var int The length in bytes of the array."," */"," protected $byteLength = 0;",""," /**"," * {@inheritdoc}"," */"," public function getByteLength() : int"," {"," return $this-\u003ebyteLength;"," }",""," /**"," * @return int"," */"," public function getLength() : int"," {"," return $this-\u003elength;"," }",""," /**"," * Get Array by length sliced"," *"," * @return array"," */"," public function getBytesLengthArray() : array"," {"," return array_slice("," $this-\u003egetArrayCopy(),"," 0,"," $this-\u003egetByteLength()"," );"," }",""," /**"," * {@inheritdoc}"," */"," public function slice(int $begin = null, int $end = null)"," {"," $max = $this-\u003egetByteLength();"," $begin = $begin \u003c -$max ? -$max : $begin;"," $end = $end === null || $end \u003e $max ? $max : $end;"," if ($max \u003c $begin || $begin \u003e= $end || $end \u003c= -$max) {"," return new static();"," }"," $length = $end - $begin;"," if ($begin \u003c 0) {"," $begin = $max + $begin;"," }",""," return new static(array_slice("," $this-\u003egetBytesLengthArray(),"," $begin,"," $length"," ));"," }",""," /**"," * @param string $name"," * @return bool"," */"," public function __isset($name): bool"," {"," return $this-\u003eoffsetExists($name);"," }",""," /**"," * @param string|float|int $name"," * @param mixed $value"," */"," public function __set($name, $value)"," {"," $this-\u003eoffsetSet($name, $value);"," }",""," /**"," * @param string|float|int $name"," */"," public function __unset($name)"," {"," $this-\u003eoffsetUnset($name);"," }",""," /**"," * @param string $name"," * @return mixed"," */"," public function __get($name)"," {"," if ($name === 'length' \u0026\u0026 !isset($this-\u003e$name)) {"," return $this-\u003ecount();"," }",""," return property_exists($this, $name)"," ? $this-\u003e$name"," : $this-\u003eoffsetGet($name);"," }","}"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/ArrayIterator/TypedArray/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"ArrayBufferLike.php","displayUrl":"https://github.com/ArrayIterator/TypedArray/blob/master/src/TypedArray/ArrayBufferLike.php?raw=true","headerInfo":{"blobSize":"3.43 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"548483c","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FArrayIterator%2FTypedArray%2Fblob%2Fmaster%2Fsrc%2FTypedArray%2FArrayBufferLike.php","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"139","truncatedSloc":"125"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"PHP","languageID":272,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/ArrayIterator/TypedArray/blob/master/src/TypedArray/ArrayBufferLike.php","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/ArrayIterator/TypedArray/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/ArrayIterator/TypedArray/raw/refs/heads/master/src/TypedArray/ArrayBufferLike.php","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/ArrayIterator/TypedArray/branches":{"post":"_oRdQv_Ygwj0wMV7nZiPPOva1Al3ksPjN5ay-RklCwRTLu4UO73PR5A59FKbHIQXigdofgvj4SBgYK5j0FDG2Q"},"/repos/preferences":{"post":"lpTjFdD1H9B6r0zaptxG5CTJ5CTq2zVejPTyePHVuHJzVxwGEhkoiyKVUolDVjWbFApg3mXnJFZElIfpamXl4w"}}},"title":"TypedArray/src/TypedArray/ArrayBufferLike.php at master · ArrayIterator/TypedArray","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-b84e9496fc59.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0