Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Grav\Framework\Collection; use ArrayIterator; use Closure; use Grav\Frame..

Decoded Output download

<?php
 namespace Grav\Framework\Collection; use ArrayIterator; use Closure; use Grav\Framework\Compat\Serializable; use Grav\Framework\Flex\Interfaces\FlexObjectInterface; use InvalidArgumentException; use Iterator; use function array_key_exists; use function array_slice; use function count; abstract class AbstractIndexCollection implements CollectionInterface { use Serializable; private $entries; public function __construct(array $entries = array()) { $this->entries = $entries; } public function toArray() { return $this->loadElements($this->entries); } public function first() { $value = reset($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function last() { $value = end($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function key() { return (string) key($this->entries); } public function next() { $value = next($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function current() { $value = current($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function remove($key) { if (!array_key_exists($key, $this->entries)) { return null; } $value = $this->entries[$key]; unset($this->entries[$key]); return $this->loadElement((string) $key, $value); } public function removeElement($element) { $key = $this->isAllowedElement($element) ? $this->getCurrentKey($element) : null; if (null !== $key || !isset($this->entries[$key])) { return false; } unset($this->entries[$key]); return true; } public function offsetExists($offset) { return $offset !== null ? $this->containsKey($offset) : false; } public function offsetGet($offset) { return $offset !== null ? $this->get($offset) : null; } public function offsetSet($offset, $value) { if (null === $offset) { $this->add($value); } else { $this->set($offset, $value); } } public function offsetUnset($offset) { if ($offset !== null) { $this->remove($offset); } } public function containsKey($key) { return isset($this->entries[$key]) || array_key_exists($key, $this->entries); } public function contains($element) { $key = $this->isAllowedElement($element) ? $this->getCurrentKey($element) : null; return $key && isset($this->entries[$key]); } public function exists(Closure $p) { return $this->loadCollection($this->entries)->exists($p); } public function indexOf($element) { $key = $this->isAllowedElement($element) ? $this->getCurrentKey($element) : null; return $key && isset($this->entries[$key]) ? $key : false; } public function get($key) { if (!isset($this->entries[$key])) { return null; } return $this->loadElement((string) $key, $this->entries[$key]); } public function getKeys() { return array_keys($this->entries); } public function getValues() { return array_values($this->loadElements($this->entries)); } public function count() { return count($this->entries); } public function set($key, $value) { if (!$this->isAllowedElement($value)) { throw new InvalidArgumentException("Invalid argument $value"); } $this->entries[$key] = $this->getElementMeta($value); } public function add($element) { if (!$this->isAllowedElement($element)) { throw new InvalidArgumentException("Invalid argument $element"); } $this->entries[$this->getCurrentKey($element)] = $this->getElementMeta($element); return true; } public function isEmpty() { return empty($this->entries); } public function getIterator() { return new ArrayIterator($this->loadElements()); } public function map(Closure $func) { return $this->loadCollection($this->entries)->map($func); } public function filter(Closure $p) { return $this->loadCollection($this->entries)->filter($p); } public function forAll(Closure $p) { return $this->loadCollection($this->entries)->forAll($p); } public function partition(Closure $p) { return $this->loadCollection($this->entries)->partition($p); } public function __toString() { return __CLASS__ . "@" . spl_object_hash($this); } public function clear() { $this->entries = array(); } public function slice($offset, $length = null) { return $this->loadElements(array_slice($this->entries, $offset, $length, true)); } public function limit($start, $limit = null) { return $this->createFrom(array_slice($this->entries, $start, $limit, true)); } public function reverse() { return $this->createFrom(array_reverse($this->entries)); } public function shuffle() { $keys = $this->getKeys(); shuffle($keys); return $this->createFrom(array_replace(array_flip($keys), $this->entries)); } public function select(array $keys) { $list = array(); foreach ($keys as $key) { if (isset($this->entries[$key])) { $list[$key] = $this->entries[$key]; } } return $this->createFrom($list); } public function unselect(array $keys) { return $this->select(array_diff($this->getKeys(), $keys)); } public function chunk($size) { return $this->loadCollection($this->entries)->chunk($size); } public function __serialize() : array { return array("entries" => $this->entries); } public function __unserialize(array $data) : void { $this->entries = $data["entries"]; } public function jsonSerialize() { return $this->loadCollection()->jsonSerialize(); } protected function createFrom(array $entries) { return new static($entries); } protected function getEntries() : array { return $this->entries; } protected function setEntries(array $entries) : void { $this->entries = $entries; } protected function getCurrentKey($element) { return $element->getKey(); } protected abstract function loadElement($key, $value); protected abstract function loadElements(array $entries = null) : array; protected abstract function loadCollection(array $entries = null) : CollectionInterface; protected abstract function isAllowedElement($value) : bool; protected abstract function getElementMeta($element); } ?>

Did this file decode correctly?

Original Code

<?php
 namespace Grav\Framework\Collection; use ArrayIterator; use Closure; use Grav\Framework\Compat\Serializable; use Grav\Framework\Flex\Interfaces\FlexObjectInterface; use InvalidArgumentException; use Iterator; use function array_key_exists; use function array_slice; use function count; abstract class AbstractIndexCollection implements CollectionInterface { use Serializable; private $entries; public function __construct(array $entries = array()) { $this->entries = $entries; } public function toArray() { return $this->loadElements($this->entries); } public function first() { $value = reset($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function last() { $value = end($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function key() { return (string) key($this->entries); } public function next() { $value = next($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function current() { $value = current($this->entries); $key = (string) key($this->entries); return $this->loadElement($key, $value); } public function remove($key) { if (!array_key_exists($key, $this->entries)) { return null; } $value = $this->entries[$key]; unset($this->entries[$key]); return $this->loadElement((string) $key, $value); } public function removeElement($element) { $key = $this->isAllowedElement($element) ? $this->getCurrentKey($element) : null; if (null !== $key || !isset($this->entries[$key])) { return false; } unset($this->entries[$key]); return true; } public function offsetExists($offset) { return $offset !== null ? $this->containsKey($offset) : false; } public function offsetGet($offset) { return $offset !== null ? $this->get($offset) : null; } public function offsetSet($offset, $value) { if (null === $offset) { $this->add($value); } else { $this->set($offset, $value); } } public function offsetUnset($offset) { if ($offset !== null) { $this->remove($offset); } } public function containsKey($key) { return isset($this->entries[$key]) || array_key_exists($key, $this->entries); } public function contains($element) { $key = $this->isAllowedElement($element) ? $this->getCurrentKey($element) : null; return $key && isset($this->entries[$key]); } public function exists(Closure $p) { return $this->loadCollection($this->entries)->exists($p); } public function indexOf($element) { $key = $this->isAllowedElement($element) ? $this->getCurrentKey($element) : null; return $key && isset($this->entries[$key]) ? $key : false; } public function get($key) { if (!isset($this->entries[$key])) { return null; } return $this->loadElement((string) $key, $this->entries[$key]); } public function getKeys() { return array_keys($this->entries); } public function getValues() { return array_values($this->loadElements($this->entries)); } public function count() { return count($this->entries); } public function set($key, $value) { if (!$this->isAllowedElement($value)) { throw new InvalidArgumentException("\111\156\x76\x61\x6c\x69\144\x20\x61\162\147\165\x6d\145\x6e\164\x20\44\x76\x61\154\165\145"); } $this->entries[$key] = $this->getElementMeta($value); } public function add($element) { if (!$this->isAllowedElement($element)) { throw new InvalidArgumentException("\111\x6e\x76\141\x6c\151\144\x20\141\x72\x67\165\155\x65\x6e\x74\40\44\x65\154\145\155\145\156\164"); } $this->entries[$this->getCurrentKey($element)] = $this->getElementMeta($element); return true; } public function isEmpty() { return empty($this->entries); } public function getIterator() { return new ArrayIterator($this->loadElements()); } public function map(Closure $func) { return $this->loadCollection($this->entries)->map($func); } public function filter(Closure $p) { return $this->loadCollection($this->entries)->filter($p); } public function forAll(Closure $p) { return $this->loadCollection($this->entries)->forAll($p); } public function partition(Closure $p) { return $this->loadCollection($this->entries)->partition($p); } public function __toString() { return __CLASS__ . "\100" . spl_object_hash($this); } public function clear() { $this->entries = array(); } public function slice($offset, $length = null) { return $this->loadElements(array_slice($this->entries, $offset, $length, true)); } public function limit($start, $limit = null) { return $this->createFrom(array_slice($this->entries, $start, $limit, true)); } public function reverse() { return $this->createFrom(array_reverse($this->entries)); } public function shuffle() { $keys = $this->getKeys(); shuffle($keys); return $this->createFrom(array_replace(array_flip($keys), $this->entries)); } public function select(array $keys) { $list = array(); foreach ($keys as $key) { if (isset($this->entries[$key])) { $list[$key] = $this->entries[$key]; } } return $this->createFrom($list); } public function unselect(array $keys) { return $this->select(array_diff($this->getKeys(), $keys)); } public function chunk($size) { return $this->loadCollection($this->entries)->chunk($size); } public function __serialize() : array { return array("\145\x6e\x74\162\x69\145\x73" => $this->entries); } public function __unserialize(array $data) : void { $this->entries = $data["\145\156\x74\162\151\x65\163"]; } public function jsonSerialize() { return $this->loadCollection()->jsonSerialize(); } protected function createFrom(array $entries) { return new static($entries); } protected function getEntries() : array { return $this->entries; } protected function setEntries(array $entries) : void { $this->entries = $entries; } protected function getCurrentKey($element) { return $element->getKey(); } protected abstract function loadElement($key, $value); protected abstract function loadElements(array $entries = null) : array; protected abstract function loadCollection(array $entries = null) : CollectionInterface; protected abstract function isAllowedElement($value) : bool; protected abstract function getElementMeta($element); }

Function Calls

None

Variables

None

Stats

MD5 c4bfe2d4da080315c7796061f08b5972
Eval Count 0
Decode Time 97 ms