MediaWiki REL1_31
ReverseArrayIterator.php
Go to the documentation of this file.
1<?php
29class ReverseArrayIterator implements Iterator, Countable {
31 protected $array;
32
41 public function __construct( $array = [] ) {
42 if ( is_array( $array ) ) {
43 $this->array = $array;
44 } elseif ( is_object( $array ) ) {
45 $this->array = get_object_vars( $array );
46 } else {
47 throw new InvalidArgumentException( __METHOD__ . ' requires an array or object' );
48 }
49
50 $this->rewind();
51 }
52
53 public function current() {
54 return current( $this->array );
55 }
56
57 public function key() {
58 return key( $this->array );
59 }
60
61 public function next() {
62 prev( $this->array );
63 }
64
65 public function rewind() {
66 end( $this->array );
67 }
68
69 public function valid() {
70 return key( $this->array ) !== null;
71 }
72
73 public function count() {
74 return count( $this->array );
75 }
76}
Convenience class for iterating over an array in reverse order.
__construct( $array=[])
Creates an iterator which will visit the keys in $array in reverse order.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
Definition design.txt:26