Public Member Functions | |
| __construct (Iterator $it, $callback, $mode=self::USE_VALUE, $flags=0) | |
| accept () | |
| current () | |
| getFlags () | |
| getMode () | |
| key () | |
| setFlags ($flags) | |
| setMode ($mode) | |
Public Attributes | |
| const | REPLACE = 0x00000001 |
| const | USE_BOTH = 4 |
| const | USE_FALSE = 0 |
| const | USE_KEY = 3 |
| const | USE_TRUE = 1 |
| const | USE_VALUE = 2 |
Private Attributes | |
| $callback | |
| $current | |
| $flags | |
| $key | |
| $mode | |
Definition at line 19 of file callbackfilteriterator.inc.
| CallbackFilterIterator::__construct | ( | Iterator $ | it, | |
| $ | callback, | |||
| $ | mode = self::USE_VALUE, |
|||
| $ | flags = 0 | |||
| ) |
Construct a CallbackFilterIterator.
| it | inner iterator (iterator to filter) | |
| callback | callback function | |
| mode | any of USE_VALUE, USE_KEY, USE_BOTH | |
| flags | any of 0, REPLACE |
Definition at line 42 of file callbackfilteriterator.inc.
References $callback, $flags, $it, and $mode.
00043 { 00044 parent::__construct($it); 00045 $this->callback = $callback; 00046 $this->mode = $mode; 00047 $this->flags = $flags; 00048 }
| CallbackFilterIterator::accept | ( | ) |
Call the filter callback.
Definition at line 53 of file callbackfilteriterator.inc.
References current(), and key().
00054 { 00055 $this->key = parent::key(); 00056 $this->current = parent::current(); 00057 00058 switch($this->mode) { 00059 default: 00060 case self::USE_FALSE; 00061 return false; 00062 case self::USE_TRUE: 00063 return true; 00064 case self::USE_VALUE: 00065 if($this->flags & self::REPLACE) { 00066 return (bool) call_user_func($this->callback, &$this->current); 00067 } else { 00068 return (bool) call_user_func($this->callback, $this->current); 00069 } 00070 case self::USE_KEY: 00071 if($this->flags & self::REPLACE) { 00072 return (bool) call_user_func($this->callback, &$this->key); 00073 } else { 00074 return (bool) call_user_func($this->callback, $this->key); 00075 } 00076 case SELF::USE_BOTH: 00077 if($this->flags & self::REPLACE) { 00078 return (bool) call_user_func($this->callback, &$this->key, &$this->current); 00079 } else { 00080 return (bool) call_user_func($this->callback, $this->key, $this->current); 00081 } 00082 } 00083 }
Here is the call graph for this function:

| CallbackFilterIterator::current | ( | ) |
Definition at line 92 of file callbackfilteriterator.inc.
Referenced by accept().
00093 { 00094 return $this->current; 00095 }
| CallbackFilterIterator::getFlags | ( | ) |
| CallbackFilterIterator::getMode | ( | ) |
| CallbackFilterIterator::key | ( | ) |
Definition at line 86 of file callbackfilteriterator.inc.
Referenced by accept().
00087 { 00088 return $this->key; 00089 }
| CallbackFilterIterator::setFlags | ( | $ | flags | ) |
| $flags | set new flags, |
Definition at line 116 of file callbackfilteriterator.inc.
References $flags.
00117 { 00118 $this->flags = $flags; 00119 }
| CallbackFilterIterator::setMode | ( | $ | mode | ) |
| $mode | set new mode, |
Definition at line 104 of file callbackfilteriterator.inc.
References $mode.
00105 { 00106 $this->mode = $mode; 00107 }
CallbackFilterIterator::$callback [private] |
callback to use
Definition at line 29 of file callbackfilteriterator.inc.
Referenced by __construct().
CallbackFilterIterator::$current [private] |
CallbackFilterIterator::$flags [private] |
flags (REPLACE)
Definition at line 31 of file callbackfilteriterator.inc.
Referenced by __construct(), and setFlags().
CallbackFilterIterator::$key [private] |
CallbackFilterIterator::$mode [private] |
mode any of USE_VALUE, USE_KEY, USE_BOTH
Definition at line 30 of file callbackfilteriterator.inc.
Referenced by __construct(), and setMode().
| const CallbackFilterIterator::REPLACE = 0x00000001 |
| const CallbackFilterIterator::USE_BOTH = 4 |
| const CallbackFilterIterator::USE_FALSE = 0 |
| const CallbackFilterIterator::USE_KEY = 3 |
| const CallbackFilterIterator::USE_TRUE = 1 |
| const CallbackFilterIterator::USE_VALUE = 2 |
1.5.2