- Timestamp:
- 12/06/2021 09:29:00 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/Requests/Utility/FilteredIterator.php
r52244 r52328 3 3 * Iterator for arrays requiring filtered values 4 4 * 5 * @package Requests\Utilities 5 * @package Requests 6 * @subpackage Utilities 6 7 */ 7 8 namespace WpOrg\Requests\Utility;9 10 use ArrayIterator;11 use ReturnTypeWillChange;12 use WpOrg\Requests\Exception\InvalidArgument;13 use WpOrg\Requests\Utility\InputValidator;14 8 15 9 /** 16 10 * Iterator for arrays requiring filtered values 17 11 * 18 * @package Requests\Utilities 12 * @package Requests 13 * @subpackage Utilities 19 14 */ 20 final classFilteredIterator extends ArrayIterator {15 class Requests_Utility_FilteredIterator extends ArrayIterator { 21 16 /** 22 17 * Callback to run as a filter … … 24 19 * @var callable 25 20 */ 26 pr ivate$callback;21 protected $callback; 27 22 28 23 /** … … 31 26 * @param array $data 32 27 * @param callable $callback Callback to be called on each value 33 *34 * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data argument is not iterable.35 28 */ 36 29 public function __construct($data, $callback) { 37 if (InputValidator::is_iterable($data) === false) {38 throw InvalidArgument::create(1, '$data', 'iterable', gettype($data));39 }40 41 30 parent::__construct($data); 42 31 43 if (is_callable($callback)) { 44 $this->callback = $callback; 45 } 46 } 47 48 /** 49 * @inheritdoc 50 * 51 * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound 52 */ 53 #[ReturnTypeWillChange] 54 public function __unserialize($data) {} 55 // phpcs:enable 56 57 public function __wakeup() { 58 unset($this->callback); 32 $this->callback = $callback; 59 33 } 60 34 … … 64 38 * @return string 65 39 */ 66 #[ReturnTypeWillChange]67 40 public function current() { 68 41 $value = parent::current(); … … 78 51 * @inheritdoc 79 52 */ 80 #[ReturnTypeWillChange] 81 public function unserialize($data) {} 53 public function unserialize($serialized) {} 54 55 /** 56 * @inheritdoc 57 * 58 * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound 59 */ 60 public function __unserialize($serialized) {} 61 62 public function __wakeup() { 63 unset($this->callback); 64 } 82 65 }
Note: See TracChangeset
for help on using the changeset viewer.