Inheritance diagram for RecursiveRegexIterator:


Public Member Functions | |
| __construct (RecursiveIterator $it, $regex, $mode=0, $flags=0, $preg_flags=0) | |
| accept () | |
| current () | |
| current () | |
| getChildren () | |
| getFlags () | |
| getMode () | |
| getPregFlags () | |
| hasChildren () | |
| key () | |
| key () | |
| next () | |
| rewind () | |
| setFlags ($flags) | |
| setMode ($mode) | |
| setPregFlags ($preg_flags) | |
| valid () | |
Public Attributes | |
| const | ALL_MATCHES = 2 |
| const | GET_MATCH = 1 |
| const | MATCH = 0 |
| const | REPLACE = 4 |
| const | SPLIT = 3 |
| const | USE_KEY = 0x00000001 |
Private Attributes | |
| $ref | |
Definition at line 20 of file recursiveregexiterator.inc.
| RecursiveRegexIterator::__construct | ( | RecursiveIterator $ | it, | |
| $ | regex, | |||
| $ | mode = 0, |
|||
| $ | flags = 0, |
|||
| $ | preg_flags = 0 | |||
| ) |
Constructs a regular expression filter around an iterator whose elemnts or keys are strings.
| it | inner iterator | |
| regex | the regular expression to match | |
| mode | operation mode (one of self::MATCH, self::GET_MATCH, self::ALL_MATCHES, self::SPLIT) | |
| flags | special flags (self::USE_KEY) | |
| preg_flags | global PREG_* flags, see preg_match(), preg_match_all(), preg_split() |
Definition at line 34 of file recursiveregexiterator.inc.
References RegexIterator::$flags, $it, RegexIterator::$mode, RegexIterator::$preg_flags, and RegexIterator::$regex.
00034 { 00035 parent::__construct($it, $regex, $mode, $flags, $preg_flags); 00036 }
| RegexIterator::accept | ( | ) | [inherited] |
Match current or key against regular expression using mode, flags and preg_flags.
Definition at line 68 of file regexiterator.inc.
References RegexIterator::current(), and RegexIterator::key().
00069 { 00070 $matches = array(); 00071 $this->key = parent::key(); 00072 $this->current = parent::current(); 00073 /* note that we use $this->current, rather than calling parent::current() */ 00074 $subject = ($this->flags & self::USE_KEY) ? $this->key : $this->current; 00075 switch($this->mode) 00076 { 00077 case self::MATCH: 00078 return preg_match($this->regex, $subject, $matches, $this->preg_flags); 00079 00080 case self::GET_MATCH: 00081 $this->current = array(); 00082 return preg_match($this->regex, $subject, $this->current, $this->preg_flags) > 0; 00083 00084 case self::ALL_MATCHES: 00085 $this->current = array(); 00086 return preg_match_all($this->regex, $subject, $this->current, $this->preg_flags) > 0; 00087 00088 case self::SPLIT: 00089 $this->current = array(); 00090 preg_split($this->regex, $subject, $this->current, $this->preg_flags) > 1; 00091 00092 case self::REPLACE: 00093 $this->current = array(); 00094 $result = preg_replace($this->regex, $this->replacement, $subject); 00095 if ($this->flags & self::USE_KEY) 00096 { 00097 $this->key = $result; 00098 } 00099 else 00100 { 00101 $this->current = $result; 00102 } 00103 } 00104 }
Here is the call graph for this function:

| Iterator::current | ( | ) | [inherited] |
Return the current element.
Implemented in ArrayIterator, DirectoryIterator, RecursiveDirectoryIterator, SimpleXMLIterator, SubClasses, DbaReader, DirectoryTreeIterator, DualIterator, RecursiveTreeIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.
| RegexIterator::current | ( | ) | [inherited] |
Definition at line 115 of file regexiterator.inc.
Referenced by RegexIterator::accept().
00116 { 00117 return $this->current; 00118 }
| RecursiveRegexIterator::getChildren | ( | ) |
Implements RecursiveIterator.
Definition at line 49 of file recursiveregexiterator.inc.
00050 { 00051 if (empty($this->ref)) 00052 { 00053 $this->ref = new ReflectionClass($this); 00054 } 00055 return $this->ref->newInstance($this->getInnerIterator()->getChildren()); 00056 }
| RegexIterator::getFlags | ( | ) | [inherited] |
| RegexIterator::getMode | ( | ) | [inherited] |
| RegexIterator::getPregFlags | ( | ) | [inherited] |
| RecursiveRegexIterator::hasChildren | ( | ) |
Implements RecursiveIterator.
Definition at line 40 of file recursiveregexiterator.inc.
| Iterator::key | ( | ) | [inherited] |
Return the key of the current element.
Implemented in ArrayIterator, DirectoryIterator, RecursiveDirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, RecursiveTreeIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.
| RegexIterator::key | ( | ) | [inherited] |
Definition at line 108 of file regexiterator.inc.
Referenced by RegexIterator::accept().
00109 { 00110 return $this->key; 00111 }
| Iterator::next | ( | ) | [inherited] |
Move forward to next element.
Implemented in ArrayIterator, DirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, InfiniteIterator, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.
| Iterator::rewind | ( | ) | [inherited] |
Rewind the Iterator to the first element.
Implemented in ArrayIterator, DirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, RecursiveCompareDualIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, NoRewindIterator, RecursiveCachingIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.
| RegexIterator::setFlags | ( | $ | flags | ) | [inherited] |
| flags | new operaion flags |
Definition at line 143 of file regexiterator.inc.
References RegexIterator::$flags.
00144 { 00145 $this->flags = $flags; 00146 }
| RegexIterator::setMode | ( | $ | mode | ) | [inherited] |
| mode | new operaion mode |
Definition at line 129 of file regexiterator.inc.
References RegexIterator::$mode.
00130 { 00131 $this->mode = $mode; 00132 }
| RegexIterator::setPregFlags | ( | $ | preg_flags | ) | [inherited] |
| preg_flags | new PREG flags |
Definition at line 157 of file regexiterator.inc.
References RegexIterator::$preg_flags.
00158 { 00159 $this->preg_flags = $preg_flags; 00160 }
| Iterator::valid | ( | ) | [inherited] |
Check if there is a current element after calls to rewind() or next().
Implemented in ArrayIterator, DirectoryIterator, SimpleXMLIterator, DbaReader, DualIterator, AppendIterator, CachingIterator, EmptyIterator, < FilterIterator >, IteratorIterator, LimitIterator, RecursiveIteratorIterator, SplFileObject, and SplObjectStorage.
RecursiveRegexIterator::$ref [private] |
Definition at line 58 of file recursiveregexiterator.inc.
const RegexIterator::ALL_MATCHES = 2 [inherited] |
const RegexIterator::GET_MATCH = 1 [inherited] |
const RegexIterator::MATCH = 0 [inherited] |
const RegexIterator::REPLACE = 4 [inherited] |
const RegexIterator::SPLIT = 3 [inherited] |
const RegexIterator::USE_KEY = 0x00000001 [inherited] |
If present in $flags the the key is used rather then the current value.
Definition at line 22 of file regexiterator.inc.
1.5.2