From 9003d8a4cfe810b9222273a36b9be89dda94a35b Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Fri, 10 Aug 2018 06:25:06 -0300 Subject: [PATCH] Drop spl/internal documentation These docs were outdated by now and the one at https://php.net/spl should be used instead --- ext/spl/internal/appenditerator.inc | 122 ------ ext/spl/internal/cachingiterator.inc | 157 -------- ext/spl/internal/emptyiterator.inc | 62 --- ext/spl/internal/filteriterator.inc | 127 ------ ext/spl/internal/infiniteiterator.inc | 48 --- ext/spl/internal/iteratoriterator.inc | 121 ------ ext/spl/internal/limititerator.inc | 134 ------- ext/spl/internal/multipleiterator.inc | 223 ----------- ext/spl/internal/norewinditerator.inc | 28 -- ext/spl/internal/outeriterator.inc | 25 -- ext/spl/internal/parentiterator.inc | 32 -- ext/spl/internal/recursivearrayiterator.inc | 59 --- ext/spl/internal/recursivecachingiterator.inc | 99 ----- ext/spl/internal/recursivefilteriterator.inc | 62 --- ext/spl/internal/recursiveiterator.inc | 30 -- .../internal/recursiveiteratoriterator.inc | 237 ----------- ext/spl/internal/recursiveregexiterator.inc | 61 --- ext/spl/internal/recursivetreeiterator.inc | 132 ------ ext/spl/internal/regexiterator.inc | 170 -------- ext/spl/internal/seekableiterator.inc | 48 --- ext/spl/internal/spldoublylinkedlist.inc | 277 ------------- ext/spl/internal/splfileobject.inc | 377 ------------------ ext/spl/internal/splobjectstorage.inc | 188 --------- ext/spl/internal/splqueue.inc | 71 ---- ext/spl/internal/splstack.inc | 48 --- 25 files changed, 2938 deletions(-) delete mode 100644 ext/spl/internal/appenditerator.inc delete mode 100644 ext/spl/internal/cachingiterator.inc delete mode 100644 ext/spl/internal/emptyiterator.inc delete mode 100644 ext/spl/internal/filteriterator.inc delete mode 100644 ext/spl/internal/infiniteiterator.inc delete mode 100644 ext/spl/internal/iteratoriterator.inc delete mode 100644 ext/spl/internal/limititerator.inc delete mode 100644 ext/spl/internal/multipleiterator.inc delete mode 100644 ext/spl/internal/norewinditerator.inc delete mode 100644 ext/spl/internal/outeriterator.inc delete mode 100644 ext/spl/internal/parentiterator.inc delete mode 100644 ext/spl/internal/recursivearrayiterator.inc delete mode 100644 ext/spl/internal/recursivecachingiterator.inc delete mode 100644 ext/spl/internal/recursivefilteriterator.inc delete mode 100644 ext/spl/internal/recursiveiterator.inc delete mode 100644 ext/spl/internal/recursiveiteratoriterator.inc delete mode 100644 ext/spl/internal/recursiveregexiterator.inc delete mode 100644 ext/spl/internal/recursivetreeiterator.inc delete mode 100644 ext/spl/internal/regexiterator.inc delete mode 100644 ext/spl/internal/seekableiterator.inc delete mode 100644 ext/spl/internal/spldoublylinkedlist.inc delete mode 100644 ext/spl/internal/splfileobject.inc delete mode 100644 ext/spl/internal/splobjectstorage.inc delete mode 100644 ext/spl/internal/splqueue.inc delete mode 100644 ext/spl/internal/splstack.inc diff --git a/ext/spl/internal/appenditerator.inc b/ext/spl/internal/appenditerator.inc deleted file mode 100644 index 72eb258136..0000000000 --- a/ext/spl/internal/appenditerator.inc +++ /dev/null @@ -1,122 +0,0 @@ -iterators = new ArrayIterator(); - } - - /** Append an Iterator - * @param $it Iterator to append - * - * If the current state is invalid but the appended iterator is valid - * the AppendIterator itself becomes valid. However there will be no - * call to $it->rewind(). Also if the current state is invalid the inner - * ArrayIterator will be rewound und forwarded to the appended element. - */ - function append(Iterator $it) - { - $this->iterators->append($it); - } - - /** @return the current inner Iterator - */ - function getInnerIterator() - { - return $this->iterators->current(); - } - - /** Rewind to the first element of the first inner Iterator. - * @return void - */ - function rewind() - { - $this->iterators->rewind(); - if ($this->iterators->valid()) - { - $this->getInnerIterator()->rewind(); - } - } - - /** @return whether the current element is valid - */ - function valid() - { - return $this->iterators->valid() && $this->getInnerIterator()->valid(); - } - - /** @return the current value if it is valid or \c NULL - */ - function current() - { - /* Using $this->valid() would be exactly the same; it would omit - * the access to a non valid element in the inner iterator. Since - * the user didn't respect the valid() return value false this - * must be intended hence we go on. */ - return $this->iterators->valid() ? $this->getInnerIterator()->current() : NULL; - } - - /** @return the current key if it is valid or \c NULL - */ - function key() - { - return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL; - } - - /** Move to the next element. If this means to another Iterator that - * rewind that Iterator. - * @return void - */ - function next() - { - if (!$this->iterators->valid()) - { - return; /* done all */ - } - $this->getInnerIterator()->next(); - if ($this->getInnerIterator()->valid()) - { - return; /* found valid element in current inner iterator */ - } - $this->iterators->next(); - while ($this->iterators->valid()) - { - $this->getInnerIterator()->rewind(); - if ($this->getInnerIterator()->valid()) - { - return; /* found element as first elemet in another iterator */ - } - $this->iterators->next(); - } - } - - /** Aggregates the inner iterator - */ - function __call($func, $params) - { - return call_user_func_array(array($this->getInnerIterator(), $func), $params); - } -} - -?> diff --git a/ext/spl/internal/cachingiterator.inc b/ext/spl/internal/cachingiterator.inc deleted file mode 100644 index 077ac726cf..0000000000 --- a/ext/spl/internal/cachingiterator.inc +++ /dev/null @@ -1,157 +0,0 @@ -it = $it; - $this->flags = $flags & (0x0000FFFF); - $this->next(); - } - - /** Rewind the Iterator - */ - function rewind() - { - $this->it->rewind(); - $this->next(); - } - - /** Forward to the next element - */ - function next() - { - if ($this->valid = $this->it->valid()) { - $this->current = $this->it->current(); - $this->key = $this->it->key(); - if ($this->flags & self::CALL_TOSTRING) { - if (is_object($this->current)) { - $this->strValue = $this->current->__toString(); - } else { - $this->strValue = (string)$this->current; - } - } - } else { - $this->current = NULL; - $this->key = NULL; - $this->strValue = NULL; - } - $this->it->next(); - } - - /** @return whether the iterator is valid - */ - function valid() - { - return $this->valid; - } - - /** @return whether there is one more element - */ - function hasNext() - { - return $this->it->valid(); - } - - /** @return the current element - */ - function current() - { - return $this->current; - } - - /** @return the current key - */ - function key() - { - return $this->key; - } - - /** Aggregate the inner iterator - * - * @param func Name of method to invoke - * @param params Array of parameters to pass to method - */ - function __call($func, $params) - { - return call_user_func_array(array($this->it, $func), $params); - } - - /** @return the string represenatation that was generated for the current - * element - * @throw exception when CALL_TOSTRING was not specified in constructor - */ - function __toString() - { - if ($this->flags & self::TOSTRING_USE_KEY) - { - return $this->key; - } - else if ($this->flags & self::TOSTRING_USE_CURRENT) - { - return $this->current; - } - if (!$this->flags & self::CALL_TOSTRING) - { - throw new exception('CachingIterator does not fetch string value (see CachingIterator::__construct)'); - } - return $this->strValue; - } - - /** - * @return The inner iterator - */ - function getInnerIterator() - { - return $this->it; - } -} - -?> diff --git a/ext/spl/internal/emptyiterator.inc b/ext/spl/internal/emptyiterator.inc deleted file mode 100644 index ac80e79581..0000000000 --- a/ext/spl/internal/emptyiterator.inc +++ /dev/null @@ -1,62 +0,0 @@ - \ No newline at end of file diff --git a/ext/spl/internal/filteriterator.inc b/ext/spl/internal/filteriterator.inc deleted file mode 100644 index e11e467a10..0000000000 --- a/ext/spl/internal/filteriterator.inc +++ /dev/null @@ -1,127 +0,0 @@ -it = $it; - } - - /** - * Rewind the inner iterator. - */ - function rewind() { - $this->it->rewind(); - $this->fetch(); - } - - /** - * Accept function to decide whether an element of the inner iterator - * should be accessible through the Filteriterator. - * - * @return whether or not to expose the current element of the inner - * iterator. - */ - abstract function accept(); - - /** - * Fetch next element and store it. - * - * @return void - */ - protected function fetch() { - while ($this->it->valid()) { - if ($this->accept()) { - return; - } - $this->it->next(); - }; - } - - /** - * Move to next element - * - * @return void - */ - function next() { - $this->it->next(); - $this->fetch(); - } - - /** - * @return Whether more elements are available - */ - function valid() { - return $this->it->valid(); - } - - /** - * @return The current key - */ - function key() { - return $this->it->key(); - } - - /** - * @return The current value - */ - function current() { - return $this->it->current(); - } - - /** - * hidden __clone - */ - protected function __clone() { - // disallow clone - } - - /** - * @return The inner iterator - */ - function getInnerIterator() - { - return $this->it; - } - - /** Aggregate the inner iterator - * - * @param func Name of method to invoke - * @param params Array of parameters to pass to method - */ - function __call($func, $params) - { - return call_user_func_array(array($this->it, $func), $params); - } -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/infiniteiterator.inc b/ext/spl/internal/infiniteiterator.inc deleted file mode 100644 index 04d7827182..0000000000 --- a/ext/spl/internal/infiniteiterator.inc +++ /dev/null @@ -1,48 +0,0 @@ -$key) - { - echo "$val=>$key\n"; - } - \endverbatim - */ -class InfiniteIterator extends IteratorIterator -{ - /** Move the inner Iterator forward to its next element or rewind it. - * @return void - */ - function next() - { - $this->getInnerIterator()->next(); - if (!$this->getInnerIterator()->valid()) - { - $this->getInnerIterator()->rewind(); - } - } -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/iteratoriterator.inc b/ext/spl/internal/iteratoriterator.inc deleted file mode 100644 index cdf89d8306..0000000000 --- a/ext/spl/internal/iteratoriterator.inc +++ /dev/null @@ -1,121 +0,0 @@ -getIterator(); - } - if ($iterator instanceof Iterator) - { - $this->iterator = $iterator; - } - else - { - throw new Exception("Classes that only implement Traversable can be wrapped only after converting class IteratorIterator into c code"); - } - } - - /** \return the inner iterator as passed to the constructor - */ - function getInnerIterator() - { - return $this->iterator; - } - - /** \return whether the iterator is valid - */ - function valid() - { - return $this->iterator->valid(); - } - - /** \return current key - */ - function key() - { - return $this->iterator->key(); - } - - /** \return current value - */ - function current() - { - return $this->iterator->current(); - } - - /** forward to next element - */ - function next() - { - return $this->iterator->next(); - } - - /** rewind to the first element - */ - function rewind() - { - return $this->iterator->rewind(); - } - - /** Aggregate the inner iterator - * - * @param func Name of method to invoke - * @param params Array of parameters to pass to method - */ - function __call($func, $params) - { - return call_user_func_array(array($this->iterator, $func), $params); - } - - /** The inner iterator must be private because when this class will be - * converted to c code it won't no longer be available. - */ - private $iterator; -} - -?> diff --git a/ext/spl/internal/limititerator.inc b/ext/spl/internal/limititerator.inc deleted file mode 100644 index 00c4122872..0000000000 --- a/ext/spl/internal/limititerator.inc +++ /dev/null @@ -1,134 +0,0 @@ - 0'); - } - if ($count < 0 && $count != -1) { - throw new exception('Parameter count must either be -1 or a value greater than or equal to 0'); - } - $this->it = $it; - $this->offset = $offset; - $this->count = $count; - $this->pos = 0; - } - - /** Seek to specified position - * @param position offset to seek to (relative to beginning not offset - * specified in constructor). - * @throw exception when position is invalid - */ - function seek($position) { - if ($position < $this->offset) { - throw new exception('Cannot seek to '.$position.' which is below offset '.$this->offset); - } - if ($position > $this->offset + $this->count && $this->count != -1) { - throw new exception('Cannot seek to '.$position.' which is behind offset '.$this->offset.' plus count '.$this->count); - } - if ($this->it instanceof SeekableIterator) { - $this->it->seek($position); - $this->pos = $position; - } else { - while($this->pos < $position && $this->it->valid()) { - $this->next(); - } - } - } - - /** Rewind to offset specified in constructor - */ - function rewind() - { - $this->it->rewind(); - $this->pos = 0; - $this->seek($this->offset); - } - - /** @return whether iterator is valid - */ - function valid() { - return ($this->count == -1 || $this->pos < $this->offset + $this->count) - && $this->it->valid(); - } - - /** @return current key - */ - function key() { - return $this->it->key(); - } - - /** @return current element - */ - function current() { - return $this->it->current(); - } - - /** Forward to nect element - */ - function next() { - $this->it->next(); - $this->pos++; - } - - /** @return current position relative to zero (not to offset specified in - * constructor). - */ - function getPosition() { - return $this->pos; - } - - /** - * @return The inner iterator - */ - function getInnerIterator() - { - return $this->it; - } - - /** Aggregate the inner iterator - * - * @param func Name of method to invoke - * @param params Array of parameters to pass to method - */ - function __call($func, $params) - { - return call_user_func_array(array($this->it, $func), $params); - } -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/multipleiterator.inc b/ext/spl/internal/multipleiterator.inc deleted file mode 100644 index c0e31a04ac..0000000000 --- a/ext/spl/internal/multipleiterator.inc +++ /dev/null @@ -1,223 +0,0 @@ -iterators = new SplObjectStorage(); - $this->flags = $flags; - } - - /** @return current flags MIT_* */ - public function getFlags() - { - return $this->flags; - } - - /** @param $flags new flags. */ - public function setFlags($flags) - { - $this->flags = $flags; - } - - /** @param $iter new Iterator to attach. - * @param $inf associative info forIteraotr, must be NULL, integer or string - * - * @throws IllegalValueException if a inf is none of NULL, integer or string - * @throws IllegalValueException if a inf is already an associated info - */ - public function attachIterator(Iterator $iter, $inf = NULL) - { - - if (!is_null($inf)) - { - if (!is_int($inf) && !is_string($inf)) - { - throw new IllegalValueException('Inf must be NULL, integer or string'); - } - foreach($this->iterators as $iter) - { - if ($inf == $this->iterators->getInfo()) - { - throw new IllegalValueException('Key duplication error'); - } - } - } - $this->iterators->attach($iter, $inf); - } - - /** @param $iter attached Iterator that should be detached. */ - public function detachIterator(Iterator $iter) - { - $this->iterators->detach($iter); - } - - /** @param $iter Iterator to check - * @return whether $iter is attached or not - */ - public function containsIterator(Iterator $iter) - { - return $this->iterator->contains($iter); - } - - /** @return number of attached Iterator instances. */ - public function countIterators() - { - return $this->iterators->count(); - } - - /** Rewind all attached Iterator instances. */ - public function rewind() - { - foreach($this->iterators as $iter) - { - $iter->rewind(); - } - } - - /** - * @return whether all or one sub iterator is valid depending on flags. - * In mode MIT_NEED_ALL we expect all sub iterators to be valid and - * return flase on the first non valid one. If that flag is not set we - * return true on the first valid sub iterator found. If no Iterator - * is attached, we always return false. - */ - public function valid() - { - if (!sizeof($this->iterators)) { - return false; - } - // The following code is an optimized version that executes as few - // valid() calls as necessary and that only checks the flags once. - $expect = $this->flags & self::MIT_NEED_ALL ? true : false; - foreach($this->iterators as $iter) - { - if ($expect != $iter->valid()) - { - return !$expect; - } - } - return $expect; - } - - /** Move all attached Iterator instances forward. That is invoke - * their next() method regardless of their state. - */ - public function next() - { - foreach($this->iterators as $iter) - { - $iter->next(); - } - } - - /** @return false if no sub Iterator is attached and an array of - * all registered Iterator instances current() result. - * @throws RuntimeException if mode MIT_NEED_ALL is set and at least one - * attached Iterator is not valid(). - * @throws IllegalValueException if a key is NULL and MIT_KEYS_ASSOC is set. - */ - public function current() - { - if (!sizeof($this->iterators)) - { - return false; - } - $retval = array(); - foreach($this->iterators as $iter) - { - if ($iter->valid()) - { - if ($this->flags & self::MIT_KEYS_ASSOC) - { - $key = $this->iterators->getInfo(); - if (is_null($key)) - { - throw new IllegalValueException('Sub-Iterator is associated with NULL'); - } - $retval[$key] = $iter->current(); - } - else - { - $retval[] = $iter->current(); - } - } - else if ($this->flags & self::MIT_NEED_ALL) - { - throw new RuntimeException('Called current() with non valid sub iterator'); - } - else - { - $retval[] = NULL; - } - } - return $retval; - } - - /** @return false if no sub Iterator is attached and an array of - * all registered Iterator instances key() result. - * @throws LogicException if mode MIT_NEED_ALL is set and at least one - * attached Iterator is not valid(). - */ - public function key() - { - if (!sizeof($this->iterators)) - { - return false; - } - $retval = array(); - foreach($this->iterators as $iter) - { - if ($iter->valid()) - { - $retval[] = $iter->key(); - } - else if ($this->flags & self::MIT_NEED_ALL) - { - throw new LogicException('Called key() with non valid sub iterator'); - } - else - { - $retval[] = NULL; - } - } - return $retval; - } -} diff --git a/ext/spl/internal/norewinditerator.inc b/ext/spl/internal/norewinditerator.inc deleted file mode 100644 index 8747a6116e..0000000000 --- a/ext/spl/internal/norewinditerator.inc +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/ext/spl/internal/outeriterator.inc b/ext/spl/internal/outeriterator.inc deleted file mode 100644 index f26d29da56..0000000000 --- a/ext/spl/internal/outeriterator.inc +++ /dev/null @@ -1,25 +0,0 @@ - \ No newline at end of file diff --git a/ext/spl/internal/parentiterator.inc b/ext/spl/internal/parentiterator.inc deleted file mode 100644 index 69a223444d..0000000000 --- a/ext/spl/internal/parentiterator.inc +++ /dev/null @@ -1,32 +0,0 @@ -it->hasChildren(); - } -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/recursivearrayiterator.inc b/ext/spl/internal/recursivearrayiterator.inc deleted file mode 100644 index 07dbce3def..0000000000 --- a/ext/spl/internal/recursivearrayiterator.inc +++ /dev/null @@ -1,59 +0,0 @@ -current()); - } - - /** @return an iterator for the current elements children - * - * @note the returned iterator will be of the same class as $this - */ - function getChildren() - { - if ($this->current() instanceof self) - { - return $this->current(); - } - if (empty($this->ref)) - { - $this->ref = new ReflectionClass($this); - } - return $this->ref->newInstance($this->current()); - } - - private $ref; -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/recursivecachingiterator.inc b/ext/spl/internal/recursivecachingiterator.inc deleted file mode 100644 index 1473b75457..0000000000 --- a/ext/spl/internal/recursivecachingiterator.inc +++ /dev/null @@ -1,99 +0,0 @@ -hasChildren = false; - $this->getChildren = NULL; - parent::rewind(); - } - - /** Forward to next element if necessary then an Iterator for the Children - * will be created. - */ - function next() - { - if ($this->hasChildren = $this->it->hasChildren()) - { - try - { - $child = $this->it->getChildren(); - if (!$this->ref) - { - $this->ref = new ReflectionClass($this); - } - $this->getChildren = $ref->newInstance($child, $this->flags); - } - catch(Exception $e) - { - if (!$this->flags & self::CATCH_GET_CHILD) - { - throw $e; - } - $this->hasChildren = false; - $this->getChildren = NULL; - } - } else - { - $this->getChildren = NULL; - } - parent::next(); - } - - private $ref; - - /** @return whether the current element has children - * @note The check whether the Iterator for the children can be created was - * already executed. Hence when flag CATCH_GET_CHILD was given in - * constructor this function returns false so that getChildren does - * not try to access those children. - */ - function hasChildren() - { - return $this->hasChildren; - } - - /** @return An Iterator for the children - */ - function getChildren() - { - return $this->getChildren; - } -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/recursivefilteriterator.inc b/ext/spl/internal/recursivefilteriterator.inc deleted file mode 100644 index 9d176112ba..0000000000 --- a/ext/spl/internal/recursivefilteriterator.inc +++ /dev/null @@ -1,62 +0,0 @@ -getInnerIterator()->hasChildren(); - } - - /** @return an iterator for the current elements children - * - * @note the returned iterator will be of the same class as $this - */ - function getChildren() - { - if (empty($this->ref)) - { - $this->ref = new ReflectionClass($this); - } - return $this->ref->newInstance($this->getInnerIterator()->getChildren()); - } - - private $ref; -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/recursiveiterator.inc b/ext/spl/internal/recursiveiterator.inc deleted file mode 100644 index 6e6c023486..0000000000 --- a/ext/spl/internal/recursiveiterator.inc +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/ext/spl/internal/recursiveiteratoriterator.inc b/ext/spl/internal/recursiveiteratoriterator.inc deleted file mode 100644 index 529c01b076..0000000000 --- a/ext/spl/internal/recursiveiteratoriterator.inc +++ /dev/null @@ -1,237 +0,0 @@ -ait[0] = $it; - $this->mode = $mode; - $this->flags = $flags; - } - - /** Rewind to top iterator as set in constructor - */ - function rewind() - { - while ($this->count) { - unset($this->ait[$this->count--]); - $this->endChildren(); - } - $this->ait[0]->rewind(); - $this->ait[0]->recursed = false; - callNextElement(true); - } - - /** @return whether iterator is valid - */ - function valid() - { - $count = $this->count; - while ($count) { - $it = $this->ait[$count]; - if ($it->valid()) { - return true; - } - $count--; - $this->endChildren(); - } - return false; - } - - /** @return current key - */ - function key() - { - $it = $this->ait[$this->count]; - return $it->key(); - } - - /** @return current element - */ - function current() - { - $it = $this->ait[$this->count]; - return $it->current(); - } - - /** Forward to next element - */ - function next() - { - while ($this->count) { - $it = $this->ait[$this->count]; - if ($it->valid()) { - if (!$it->recursed && callHasChildren()) { - $it->recursed = true; - try - { - $sub = callGetChildren(); - } - catch (Exception $e) - { - if (!($this->flags & self::CATCH_GET_CHILD)) - { - throw $e; - } - $it->next(); - continue; - } - $sub->recursed = false; - $sub->rewind(); - if ($sub->valid()) { - $this->ait[++$this->count] = $sub; - if (!$sub instanceof RecursiveIterator) { - throw new Exception(get_class($sub).'::getChildren() must return an object that implements RecursiveIterator'); - } - $this->beginChildren(); - return; - } - unset($sub); - } - $it->next(); - $it->recursed = false; - if ($it->valid()) { - return; - } - $it->recursed = false; - } - if ($this->count) { - unset($this->ait[$this->count--]); - $it = $this->ait[$this->count]; - $this->endChildren(); - callNextElement(false); - } - } - callNextElement(true); - } - - /** @return Sub Iterator at given level or if unspecified the current sub - * Iterator - */ - function getSubIterator($level = NULL) - { - if (is_null($level)) { - $level = $this->count; - } - return @$this->ait[$level]; - } - - /** - * @return The inner iterator - */ - function getInnerIterator() - { - return $this->it; - } - - /** @return Current Depth (Number of parents) - */ - function getDepth() - { - return $this->level; - } - - /** @return whether current sub iterators current element has children - * @since PHP 5.1 - */ - function callHasChildren() - { - return $this->ait[$this->count]->hasChildren(); - } - - /** @return current sub iterators current children - * @since PHP 5.1 - */ - function callGetChildren() - { - return $this->ait[$this->count]->getChildren(); - } - - /** Called right after calling getChildren() and its rewind(). - * @since PHP 5.1 - */ - function beginChildren() - { - } - - /** Called after current child iterator is invalid and right before it - * gets destructed. - * @since PHP 5.1 - */ - function endChildren() - { - } - - private function callNextElement($after_move) - { - if ($this->valid()) - { - if ($after_move) - { - if (($this->mode == self::SELF_FIRST && $this->callHasChildren()) - || $this->mode == self::LEAVES_ONLY) - $this->nextElement(); - } - else - { - $this->nextElement(); - } - } - } - - /** Called when the next element is available - */ - function nextElement() - { - } -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/recursiveregexiterator.inc b/ext/spl/internal/recursiveregexiterator.inc deleted file mode 100644 index 4223104398..0000000000 --- a/ext/spl/internal/recursiveregexiterator.inc +++ /dev/null @@ -1,61 +0,0 @@ -getInnerIterator()->hasChildren(); - } - - /** @return an iterator for the current elements children - * - * @note the returned iterator will be of the same class as $this - */ - function getChildren() - { - if (empty($this->ref)) - { - $this->ref = new ReflectionClass($this); - } - return $this->ref->newInstance($this->getInnerIterator()->getChildren()); - } - - private $ref; -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/recursivetreeiterator.inc b/ext/spl/internal/recursivetreeiterator.inc deleted file mode 100644 index dfcdc05995..0000000000 --- a/ext/spl/internal/recursivetreeiterator.inc +++ /dev/null @@ -1,132 +0,0 @@ -rit_flags = $rit_flags; - } - - private $prefix = array(0=>'', 1=>'| ', 2=>' ', 3=>'|-', 4=>'\-', 5=>''); - - /** Prefix used to start elements. */ - const PREFIX_LEFT = 0; - /** Prefix used if $level < depth and hasNext($level) == true. */ - const PREFIX_MID_HAS_NEXT = 1; - /** Prefix used if $level < depth and hasNext($level) == false. */ - const PREFIX_MID_LAST = 2; - /** Prefix used if $level == depth and hasNext($level) == true. */ - const PREFIX_END_HAS_NEXT = 3; - /** Prefix used if $level == depth and hasNext($level) == false. */ - const PREFIX_END_LAST = 4; - /** Prefix used right in front of the current element. */ - const PREFIX_RIGHT = 5; - - /** - * Set prefix part as used in getPrefix() and stored in $prefix. - * @param $part any PREFIX_* const. - * @param $value new prefix string for specified part. - * @throws OutOfRangeException if 0 > $part or $part > 5. - */ - function setPrefixPart($part, $value) - { - if (0 > $part || $part > 5) { - throw new OutOfRangeException(); - } - $this->prefix[$part] = (string)$value; - } - - /** @return string to place in front of current element - */ - function getPrefix() - { - $tree = ''; - for ($level = 0; $level < $this->getDepth(); $level++) - { - $tree .= $this->getSubIterator($level)->hasNext() ? $this->prefix[1] : $this->prefix[2]; - } - $tree .= $this->getSubIterator($level)->hasNext() ? $this->prefix[3] : $this->prefix[4]; - - return $this->prefix[0] . $tree . $this->prefix[5]; - } - - /** @return string presentation build for current element - */ - function getEntry() - { - return @(string)parent::current(); - } - - /** @return string to place after the current element - */ - function getPostfix() - { - return ''; - } - - /** @return the current element prefixed and postfixed - */ - function current() - { - if ($this->rit_flags & self::BYPASS_CURRENT) - { - return parent::current(); - } - else - { - return $this->getPrefix() . $this->getEntry() . $this->getPostfix(); - } - } - - /** @return the current key prefixed and postfixed - */ - function key() - { - if ($this->rit_flags & self::BYPASS_KEY) - { - return parent::key(); - } - else - { - return $this->getPrefix() . parent::key() . $this->getPostfix(); - } - } - - /** Aggregates the inner iterator - */ - function __call($func, $params) - { - return call_user_func_array(array($this->getSubIterator(), $func), $params); - } -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/regexiterator.inc b/ext/spl/internal/regexiterator.inc deleted file mode 100644 index 706eff33a7..0000000000 --- a/ext/spl/internal/regexiterator.inc +++ /dev/null @@ -1,170 +0,0 @@ -regex = $regex; - $this->flags = $flags; - $this->mode = $mode; - $this->preg_flags = $preg_flags; - } - - /** - * Match current or key against regular expression using mode, flags and - * preg_flags. - * - * @return whether this is a match - * - * @warning never call this twice for the same state - */ - function accept() - { - $matches = array(); - $this->key = parent::key(); - $this->current = parent::current(); - /* note that we use $this->current, rather than calling parent::current() */ - $subject = ($this->flags & self::USE_KEY) ? $this->key : $this->current; - switch($this->mode) - { - case self::MATCH: - return preg_match($this->regex, $subject, $matches, $this->preg_flags); - - case self::GET_MATCH: - $this->current = array(); - return preg_match($this->regex, $subject, $this->current, $this->preg_flags) > 0; - - case self::ALL_MATCHES: - $this->current = array(); - return preg_match_all($this->regex, $subject, $this->current, $this->preg_flags) > 0; - - case self::SPLIT: - $this->current = array(); - preg_split($this->regex, $subject, $this->current, $this->preg_flags) > 1; - - case self::REPLACE: - $this->current = array(); - $result = preg_replace($this->regex, $this->replacement, $subject); - if ($this->flags & self::USE_KEY) - { - $this->key = $result; - } - else - { - $this->current = $result; - } - } - } - - /** @return the key after accept has been called - */ - function key() - { - return $this->key; - } - - /** @return the current value after accept has been called - */ - function current() - { - return $this->current; - } - - /** @return current operation mode - */ - function getMode() - { - return $this->mode; - } - - /** @param mode new operaion mode - */ - function setMode($mode) - { - $this->mode = $mode; - } - - /** @return current operation flags - */ - function getFlags() - { - return $this->flags; - } - - /** @param flags new operaion flags - */ - function setFlags($flags) - { - $this->flags = $flags; - } - - /** @return current PREG flags - */ - function getPregFlags() - { - return $this->preg_flags; - } - - /** @param preg_flags new PREG flags - */ - function setPregFlags($preg_flags) - { - $this->preg_flags = $preg_flags; - } - - /** @return current regular expression - */ - function getRegex() - { - return $this->regex; - } -} - -?> diff --git a/ext/spl/internal/seekableiterator.inc b/ext/spl/internal/seekableiterator.inc deleted file mode 100644 index 7728636981..0000000000 --- a/ext/spl/internal/seekableiterator.inc +++ /dev/null @@ -1,48 +0,0 @@ -rewind(); - $position = 0; - while($position < $index && $this->valid()) { - $this->next(); - $position++; - } - if (!$this->valid()) { - throw new OutOfBoundsException('Invalid seek position'); - } - } - \endcode - */ - function seek($index); -} - -?> \ No newline at end of file diff --git a/ext/spl/internal/spldoublylinkedlist.inc b/ext/spl/internal/spldoublylinkedlist.inc deleted file mode 100644 index f01b6306a7..0000000000 --- a/ext/spl/internal/spldoublylinkedlist.inc +++ /dev/null @@ -1,277 +0,0 @@ -_llist) == 0) { - throw new RuntimeException("Can't pop from an empty datastructure"); - } - return array_pop($this->_llist); - } - - /** @return the element shifted from the beginning of the DLL. - * @throw RuntimeException If the datastructure is empty. - */ - public function shift() - { - if (count($this->_llist) == 0) { - throw new RuntimeException("Can't shift from an empty datastructure"); - } - return array_shift($this->_llist); - } - - /** Pushes an element to the end of the DLL. - * @param $data variable to add to the DLL. - */ - public function push($data) - { - array_push($this->_llist, $data); - return true; - } - - /** Adds an element to the beginning of the DLL. - * @param $data variable to add to the DLL. - */ - public function unshift($data) - { - array_unshift($this->_llist, $data); - return true; - } - - /** @return the element at the beginning of the DLL. - */ - public function top() - { - return end($this->_llist); - } - - /** @return the element at the end of the DLL. - */ - public function bottom() - { - return reset($this->_llist); - } - - /** @return number elements in the DLL. - */ - public function count() - { - return count($this->_llist); - } - - /** @return whether the DLL is empty. - */ - public function isEmpty() - { - return ($this->count() == 0); - } - - /** Changes the iteration mode. There are two orthogonal sets of modes that - * can be set: - * - The direction of the iteration (either one or the other) - * - SplDoublyLnkedList::IT_MODE_LIFO (Stack style) - * - SplDoublyLnkedList::IT_MODE_FIFO (Queue style) - * - * - The behavior of the iterator (either one or the other) - * - SplDoublyLnkedList::IT_MODE_DELETE (Elements are deleted by the iterator) - * - SplDoublyLnkedList::IT_MODE_KEEP (Elements are traversed by the iterator) - * - * The default mode is 0 : SplDoublyLnkedList::IT_MODE_FIFO | SplDoublyLnkedList::IT_MODE_KEEP - * - * @param $mode new mode of iteration - */ - public function setIteratorMode($mode) - { - $this->_it_mode = $mode; - } - - /** @return the current iteration mode - * @see setIteratorMode - */ - public function getIteratorMode() - { - return $this->_it_mode; - } - - /** Rewind to top iterator as set in constructor - */ - public function rewind() - { - if ($this->_it_mode & self::IT_MODE_LIFO) { - $this->_it_pos = count($this->_llist)-1; - } else { - $this->_it_pos = 0; - } - } - - /** @return whether iterator is valid - */ - public function valid() - { - return array_key_exists($this->_it_pos, $this->_llist); - } - - /** @return current key - */ - public function key() - { - return $this->_it_pos; - } - - /** @return current object - */ - public function current() - { - return $this->_llist[$this->_it_pos]; - } - - /** Forward to next element - */ - public function next() - { - if ($this->_it_mode & self::IT_MODE_LIFO) { - if ($this->_it_mode & self::IT_MODE_DELETE) { - $this->pop(); - } - $this->_it_pos--; - } else { - if ($this->_it_mode & self::IT_MODE_DELETE) { - $this->shift(); - } else { - $this->_it_pos++; - } - } - } - - /** @return whether a certain offset exists in the DLL - * - * @param $offset The offset - * @throw OutOfRangeException If the offset is either invalid or out of - * range. - */ - public function offsetExists($offset) - { - if (!is_numeric($offset)) { - throw new OutOfRangeException("Offset invalid or out of range"); - } else { - return array_key_exists($offset, $this->_llist); - } - } - - /** @return the data at a certain offset in the DLL - * - * @param $offset The offset - * @throw OutOfRangeException If the offset is either invalid or out of - * range. - */ - public function offsetGet($offset) - { - if ($this->_it_mode & self::IT_MODE_LIFO) { - $realOffset = count($this->_llist)-$offset; - } else { - $realOffset = $offset; - } - - if (!is_numeric($offset) || !array_key_exists($realOffset, $this->_llist)) { - throw new OutOfRangeException("Offset invalid or out of range"); - } else { - return $this->_llist[$realOffset]; - } - } - - /** Defines the data at a certain offset in the DLL - * - * @param $offset The offset - * @param $value New value - * @throw OutOfRangeException If the offset is either invalid or out of - * range. - */ - public function offsetSet($offset, $value) - { - if ($offset === null) { - return $this->push($value); - } - - if ($this->_it_mode & self::IT_MODE_LIFO) { - $realOffset = count($this->_llist)-$offset; - } else { - $realOffset = $offset; - } - - if (!is_numeric($offset) || !array_key_exists($realOffset, $this->_llist)) { - throw new OutOfRangeException("Offset invalid or out of range"); - } else { - $this->_llist[$realOffset] = $value; - } - } - - /** Unsets the element at a certain offset in the DLL - * - * @param $offset The offset - * @throw OutOfRangeException If the offset is either invalid or out of - * range. - */ - public function offsetUnset($offset) - { - if ($this->_it_mode & self::IT_MODE_LIFO) { - $realOffset = count($this->_llist)-$offset; - } else { - $realOffset = $offset; - } - - if (!is_numeric($offset) || !array_key_exists($realOffset, $this->_llist)) { - throw new OutOfRangeException("Offset invalid or out of range"); - } else { - array_splice($this->_llist, $realOffset, 1); - } - } -} - -?> diff --git a/ext/spl/internal/splfileobject.inc b/ext/spl/internal/splfileobject.inc deleted file mode 100644 index fea3d0cf61..0000000000 --- a/ext/spl/internal/splfileobject.inc +++ /dev/null @@ -1,377 +0,0 @@ -fp = fopen($file_name, $open_mode, $use_include_path, $context); - if (!$this->fp) - { - throw new RuntimeException("Cannot open file $file_name"); - } - $this->fname = $file_name; - } - - /** - * @return whether the end of the stream is reached - */ - function eof() - { - return feof($this->fp); - } - - /** increase current line number - * @return next line from stream - */ - function fgets() - { - $this->freeLine(); - $this->lnum++; - $buf = fgets($this->fp, $this->max_len); - - return $buf; - } - - /** - * @param delimiter character used as field separator - * @param enclosure end of - * @return array containing read data - */ - function fgetcsv($delimiter = NULL, $enclosure = NULL) - { - $this->freeLine(); - $this->lnum++; - switch(fun_num_args()) - { - case 0: - $delimiter = $this->delimiter; - case 1: - $enclosure = $this->enclosure; - default: - case 2: - break; - } - return fgetcsv($this->fp, $this->max_len, $delimiter, $enclosure); - } - - /** - * Set the delimiter and enclosure character used in fgetcsv - * - * @param delimiter new delimiter, defaults to ',' - * @param enclosure new enclosure, defaults to '"' - */ - function setCsvControl($delimiter = ';', $enclosure = '"') - { - $this->delimiter = $delimiter; - $this->enclosure = $enclosure; - } - - /** - * @return array(delimiter, enclosure) as used in fgetcsv - */ - function getCsvControl($delimiter = ',', $enclosure = '"') - { - return array($this->delimiter, $this->enclosure); - } - - /** - * @param operation lock operation (LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB) - * @retval $wouldblock whether the operation would block - */ - function flock($operation, &$wouldblock) - { - return flock($this->fp, $operation, $wouldblock); - } - - /** - * Flush current data - * @return success or failure - */ - function fflush() - { - return fflush($this->fp); - } - - /** - * @return current file position - */ - function ftell() - { - return ftell($this->fp); - } - - /** - * @param pos new file position - * @param whence seek method (SEEK_SET, SEEK_CUR, SEEK_END) - * @return Upon success, returns 0; otherwise, returns -1. Note that - * seeking past EOF is not considered an error. - */ - function fseek($pos, $whence = SEEK_SET) - { - return fseek($this->fp, $pos, $whence); - } - - /** - * @return next char from file - * @note a new line character does not increase $this->lnum - */ - function fgetc() - { - $this->freeLine(); - $c = fgetc($this->fp); - if ($c == '\n') { - $this->lnum++; - } - } - - /** Read and return remaining part of stream - * @return size of remaining part passed through - */ - function fpassthru() - { - return fpassthru($this->fp); - } - - /** Get a line from the file and strip HTML tags - * @param $allowable_tags tags to keep in the string - */ - function fgetss($allowable_tags = NULL) - { - return fgetss($this->fp, $allowable_tags); - } - - /** Scan the next line - * @param $format string specifying format to parse - */ - function fscanf($format /* , ... */) - { - $this->freeLine(); - $this->lnum++; - return fscanf($this->fp, $format /* , ... */); - } - - /** - * @param $str to write - * @param $length maximum line length to write - */ - function fwrite($str, $length = NULL) - { - return fwrite($this->fp, $length); - } - - /** - * @return array of file stat information - */ - function fstat() - { - return fstat($this->fp); - } - - /** - * @param $size new size to truncate file to - */ - function ftruncate($size) - { - return ftruncate($this->fp, $size); - } - - /** - * @param $flags new flag set - */ - function setFlags($flags) - { - $this->flags = $flags; - } - - /** - * @return current set of flags - */ - function getFlags() - { - return $this->flags; - } - - /** - * @param $max_len set the maximum line length read - */ - function setMaxLineLen($max_len) - { - $this->max_len = $max_len; - } - - /** - * @return current setting for max line - */ - function getMaxLineLen() - { - return $this->max_len; - } - - /** - * @return false - */ - function hasChildren() - { - return false; - } - - /** - * @return false - */ - function getChildren() - { - return NULL; - } - - /** - * Invalidate current line buffer and set line number to 0. - */ - function rewind() - { - $this->freeLine(); - $this->lnum = 0; - } - - /** - * @return whether more data can be read - */ - function valid() - { - return !$this->eof(); - } - - /** - * @note Fill current line buffer if not done yet. - * @return line buffer - */ - function current() - { - if (is_null($this->line)) - { - $this->line = getCurrentLine(); - } - return $this->line; - } - - /** - * @return line number - * @note fgetc() will increase the line number when reaing a new line char. - * This has the effect key() called on a read a new line will already - * return the increased line number. - * @note Line counting works as long as you only read the file and do not - * use fseek(). - */ - function key() - { - return $this->lnum; - } - - /** Invalidate current line buffer. - */ - function next() - { - $this->freeLine(); - } - - /** - * @return next line read from file and increase the line counter - */ - private function readLine() - { - if ($this->eof()) - { - $this->freeLine(); - throw new RuntimeException("Cannot read from file " . $this->fname); - } - if ($this->line) { - $this->lnum++; - } - $this->freeLine(); - $this->line = fgets($this->fp, $this->max_len); - return $this->line; - } - - /** - * Free the current line buffer and increment the line counter - */ - private function freeLine() - { - if ($this->line) { - $this->line = NULL; - } - } - - /* - * @note If you DO overload this function key() and current() will increment - * $this->lnum automatically. If not then function reaLine() will do - * that for you. - */ - function getCurrentLine() - { - $this->freeLine(); - if ($this->eof()) - { - throw new RuntimeException("Cannot read from file " . $this->fname); - } - $this->readLine(); - } - - /** - * @return current line - */ - function __toString() - { - return current(); - } - - /** - * @param $line_pos Seek to this line - */ - function seek($line_pos) - { - $this->rewind(); - while($this->lnum < $line_pos && !$this->eof()) - { - $this->getCurrentLine(); - } - } -} - -?> diff --git a/ext/spl/internal/splobjectstorage.inc b/ext/spl/internal/splobjectstorage.inc deleted file mode 100644 index 6b9b25f661..0000000000 --- a/ext/spl/internal/splobjectstorage.inc +++ /dev/null @@ -1,188 +0,0 @@ -storage); - } - - /** @return whether iterator is valid - */ - function valid() - { - return key($this->storage) !== false; - } - - /** @return current key - */ - function key() - { - return $this->index; - } - - /** @return current object - */ - function current() - { - $element = current($this->storage); - return $element ? $element[0] : NULL - } - - /** @return get current object's associated information - * @since 5.3.0 - */ - function getInfo() - { - $element = current($this->storage); - return $element ? $element[1] : NULL - } - - /** @return set current object's associated information - * @since 5.3.0 - */ - function setInfo($inf = NULL) - { - if ($this->valid()) { - $this->storage[$this->index][1] = $inf; - } - } - - /** Forward to next element - */ - function next() - { - next($this->storage); - $this->index++; - } - - /** @return number of objects in storage - */ - function count() - { - return count($this->storage); - } - - /** @param $obj object to look for - * @return whether $obj is contained in storage - */ - function contains($obj) - { - if (is_object($obj)) - { - foreach($this->storage as $element) - { - if ($object === $element[0]) - { - return true; - } - } - } - return false; - } - - /** @param $obj new object to attach to storage or object whose - * associative information is to be replaced - * @param $inf associative information stored along the object - */ - function attach($obj, $inf = NULL) - { - if (is_object($obj) && !$this->contains($obj)) - { - $this->storage[] = array($obj, $inf); - } - } - - /** @param $obj object to remove from storage - */ - function detach($obj) - { - if (is_object($obj)) - { - foreach($this->storage as $idx => $element) - { - if ($object === $element[0]) - { - unset($this->storage[$idx]); - $this->rewind(); - return; - } - } - } - } - - /** @param $obj new object to attach to storage or object whose - * associative information is to be replaced - * @param $inf associative information stored along the object - * @since 5.3.0 - */ - function offsetSet($obj, $inf) - { - $this->attach($obj, $inf); - } - - /** @param $obj Existing object to look for - * @return associative information stored with object - * @throw UnexpectedValueException if Object $obj is not contained in - * storage - * @since 5.3.0 - */ - function offsetGet($obj) - { - if (is_object($obj)) - { - foreach($this->storage as $idx => $element) - { - if ($object === $element[0]) - { - return $element[1]; - } - } - } - throw new UnexpectedValueException('Object not found'); - } - - /** @param $obj Existing object to look for - * @return associative information stored with object - * @since 5.3.0 - */ - function offsetUnset($obj) - { - $this->detach($obj); - } - - /** @param $obj object to look for - * @return whether $obj is contained in storage - */ - function offsetEsists($obj) - { - return $this->contains($obj); - } -} - -?> diff --git a/ext/spl/internal/splqueue.inc b/ext/spl/internal/splqueue.inc deleted file mode 100644 index 259e8ddd12..0000000000 --- a/ext/spl/internal/splqueue.inc +++ /dev/null @@ -1,71 +0,0 @@ -_it_mode = $mode; - } - - /** @return the first element of the queue. - * @note dequeue is an alias of push() - * @see splDoublyLinkedList::push() - */ - public function dequeue() - { - return parent::shift(); - } - - /** Pushes an element at the end of the queue. - * @param $data variable to add to the queue. - * @note enqueue is an alias of shift() - * @see splDoublyLinkedList::shift() - */ - public function enqueue($data) - { - return parent::push($data); - } -} - -?> diff --git a/ext/spl/internal/splstack.inc b/ext/spl/internal/splstack.inc deleted file mode 100644 index 05436b585d..0000000000 --- a/ext/spl/internal/splstack.inc +++ /dev/null @@ -1,48 +0,0 @@ -_it_mode = $mode; - } -} - -?> -- 2.40.0