本文整理汇总了PHP中FilterIterator::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP FilterIterator::__construct方法的具体用法?PHP FilterIterator::__construct怎么用?PHP FilterIterator::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterIterator
的用法示例。
在下文中一共展示了FilterIterator::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Takes both a directory iterator and a file extension and only returns
* results matching the particular extension.
*
* @access public
*/
public function __construct(DirectoryIterator $it, $ext, $whitelisted = false)
{
parent::__construct($it);
$this->_it = $it;
$this->_ext = $ext;
$this->_whitelisted = $whitelisted;
}
示例2: __construct
/**
* __construct
*
* Creates a new DirectoryIterator that can be used in a foreach loop
* (providing an SplFileInfo object in each loop pass.)
*
* @access public
* @throws Exception If the provided path is not a directory or not readable.
* @param string $path A filesystem path to a directory on which to operate.
* @param array $allowedExtensions Optional indexed array of allowed file extensions, without the leading '.'s.
*/
public function __construct($path, $allowedExtensions = null)
{
parent::__construct(new DirectoryIterator($path));
if (!is_null($allowedExtensions)) {
$this->allowed = $allowedExtensions;
}
}
示例3: __construct
public function __construct($sFolderPath, $sLanguage = null, $sCountry = null, $sLibName = null)
{
$this->sLanguage = $sLanguage;
$this->sCountry = $sCountry;
$this->sLibName = $sLibName;
parent::__construct(new \DirectoryIterator($sFolderPath));
}
示例4: __construct
/**
* Prepares filter with the iterator and the maximum age of session
* files we want to compare to.
*
* @param \Iterator $iterator The iterator with the files we want to compare to
* @param integer $maximumAge The maximum age of the session files we want to load
*/
public function __construct(\Iterator $iterator, $maximumAge)
{
// call parent constructor
parent::__construct($iterator);
// initialize the maximum age of the session files we want to load
$this->maximumAge = $maximumAge;
}
示例5: foreach
function __construct(\Iterator $iterator, array $filters)
{
foreach ($filters as $filter) {
$this->filters[] = $filter;
}
parent::__construct($iterator);
}
示例6: __construct
/**
* Initializes an instance of <b>OfTypeIterator</b>.
*
* @param Iterator $iterator
* @param string $type
*/
public function __construct(Iterator $iterator, $type)
{
parent::__construct($iterator);
switch (strtolower($type)) {
case 'int':
case 'integer':
$this->acceptCallback = function ($current) {
return is_int($current);
};
break;
case 'float':
case 'double':
$this->acceptCallback = function ($current) {
return is_float($current);
};
break;
case 'string':
$this->acceptCallback = function ($current) {
return is_string($current);
};
break;
case 'bool':
case 'boolean':
$this->acceptCallback = function ($current) {
return is_bool($current);
};
break;
default:
$this->acceptCallback = function ($current) use($type) {
return $current instanceof $type;
};
}
}
示例7: __construct
/**
* @param \Traversable $transitions
* @param object $subject
* @param \ArrayAccess $context
* @param EventInterface $event
*/
public function __construct(\Traversable $transitions, $subject, \ArrayAccess $context, EventInterface $event = null)
{
parent::__construct(new \IteratorIterator($transitions));
$this->subject = $subject;
$this->context = $context;
$this->event = $event;
}
示例8: __construct
/** Construct a Sns_Callback_Filter_Iterator
*
* @param it inner iterator (iterator to filter)
* @param callback callback function
* @param mode any of USE_VALUE, USE_KEY, USE_BOTH
* @param flags any of 0, REPLACE
*/
public function __construct(Iterator $it, $callback, $mode = self::USE_VALUE, $flags = 0)
{
parent::__construct($it);
$this->callback = $callback;
$this->mode = $mode;
$this->flags = $flags;
}
示例9: foreach
function __construct(\Iterator $iterator, array $ignored)
{
parent::__construct($iterator);
foreach ($ignored as $folder) {
$this->ignored[] = $folder;
}
}
示例10: __construct
/**
* RegexDirectoryIterator constructor.
*
* @param string $path
* The path to scan.
* @param string $regex
* The regular expression to match, including delimiters. For example,
* /\.yml$/ would list only files ending in .yml.
*/
public function __construct($path, $regex)
{
// Use FilesystemIterator to not iterate over the the . and .. directories.
$iterator = new \FilesystemIterator($path);
parent::__construct($iterator);
$this->regex = $regex;
}
示例11: __construct
/**
* Creates a FilterIterator for Zym_Navigation_Iterator_Dfs
*
* @param Zym_Navigation_Iterator_Dfs $iterator iterator to iterate
* @param bool $parentDependent [optional] whether page should be
* invisible if parent is invisible,
* defaults to true
*/
public function __construct(Zym_Navigation_Iterator_Dfs $iterator, $parentDependent = null)
{
parent::__construct($iterator);
if (is_bool($parentDependent)) {
$this->_parentDependent = $parentDependent;
}
}
示例12: __construct
/**
* @param \Iterator $sourceIterator Iterator to wrap and filter
* @param \Iterator $targetIterator Iterator used to compare against the source iterator
* @param FilenameConverterInterface $sourceConverter Key converter to convert source to target keys
* @param FilenameConverterInterface $targetConverter Key converter to convert target to source keys
*/
public function __construct(\Iterator $sourceIterator, \Iterator $targetIterator, FilenameConverterInterface $sourceConverter, FilenameConverterInterface $targetConverter)
{
$this->targetIterator = $targetIterator;
$this->sourceConverter = $sourceConverter;
$this->targetConverter = $targetConverter;
parent::__construct($sourceIterator);
}
示例13:
function __construct(array $ignore, $path, $it, $role)
{
$this->ignore = $ignore;
$this->path = $path;
$this->role = $role;
parent::__construct($it);
}
示例14: __construct
/**
* Constructor.
*
* @param \Iterator $iterator The Iterator to filter
* @param array $directories An array of directories to exclude
*/
public function __construct(\Iterator $iterator, array $directories)
{
foreach ($directories as $directory) {
$this->patterns[] = '#(^|/)' . preg_quote($directory, '#') . '(/|$)#';
}
parent::__construct($iterator);
}
示例15: __construct
/**
* Constructor.
*
* @param \RecursiveIteratorIterator $iterator The Iterator to filter
* @param array $comparators An array of \NumberComparator instances
*/
public function __construct(\RecursiveIteratorIterator $iterator, array $comparators)
{
$minDepth = 0;
$maxDepth = INF;
foreach ($comparators as $comparator) {
switch ($comparator->getOperator()) {
case '>':
$minDepth = $comparator->getTarget() + 1;
break;
case '>=':
$minDepth = $comparator->getTarget();
break;
case '<':
$maxDepth = $comparator->getTarget() - 1;
break;
case '<=':
$maxDepth = $comparator->getTarget();
break;
default:
$minDepth = $maxDepth = $comparator->getTarget();
}
}
$this->minDepth = $minDepth;
$iterator->setMaxDepth(INF === $maxDepth ? -1 : $maxDepth);
parent::__construct($iterator);
}