本文整理匯總了PHP中Iterator::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Iterator::__construct方法的具體用法?PHP Iterator::__construct怎麽用?PHP Iterator::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Iterator
的用法示例。
在下文中一共展示了Iterator::__construct方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($declarations_string, Rule $rule)
{
parent::__construct();
$pairs = DeclarationList::parse($declarations_string);
foreach ($pairs as $index => $pair) {
list($prop, $value) = $pair;
// Directives.
if ($prop === 'extends') {
$rule->setExtendSelectors($value);
unset($pairs[$index]);
} elseif ($prop === 'name') {
if (!$rule->name) {
$rule->name = $value;
}
unset($pairs[$index]);
}
}
// Build declaration list.
foreach ($pairs as $index => &$pair) {
list($prop, $value) = $pair;
if (trim($value) !== '') {
if ($prop === 'mixin') {
$this->flattened = false;
$this->store[] = $pair;
} else {
// Only store to $this->data if the value does not itself make a
// this() call to avoid circular references.
if (!preg_match(Regex::$patt->thisFunction, $value)) {
$this->data[strtolower($prop)] = $value;
}
$this->add($prop, $value, $index);
}
}
}
}
示例2: __construct
public function __construct($selectorString, Rule $rule)
{
parent::__construct();
$selectorString = trim(Util::stripCommentTokens($selectorString));
foreach (Util::splitDelimList($selectorString) as $selector) {
if (preg_match(Regex::$patt->abstract, $selector, $m)) {
$rule->name = strtolower($m['name']);
$rule->isAbstract = true;
} else {
$this->add(new Selector($selector));
}
}
}
示例3: __construct
/**
* @param string $chunk
* @param int $stackSize
*/
public function __construct($chunk, $stackSize = 8)
{
parent::__construct(new \ArrayIterator(StringUtils::toArray($chunk)), $stackSize);
}
示例4: __construct
public function __construct(IIterator $iterator)
{
parent::__construct();
$this->outerIterator = $iterator;
}