Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Drupal\Component\FileSystem; /** * Iterates over files whose names matc..
Decoded Output download
<?php
namespace Drupal\Component\FileSystem;
/**
* Iterates over files whose names match a regular expression in a directory.
*/
class RegexDirectoryIterator extends \FilterIterator {
/**
* The regular expression to match.
*
* @var string
*/
protected $regex;
/**
* 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;
}
/**
* Implements \FilterIterator::accept().
*/
public function accept() {
/** @var \SplFileInfo $file_info */
$file_info = $this->getInnerIterator()->current();
return $file_info->isFile() && preg_match($this->regex, $file_info->getFilename());
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\Component\FileSystem;
/**
* Iterates over files whose names match a regular expression in a directory.
*/
class RegexDirectoryIterator extends \FilterIterator {
/**
* The regular expression to match.
*
* @var string
*/
protected $regex;
/**
* 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;
}
/**
* Implements \FilterIterator::accept().
*/
public function accept() {
/** @var \SplFileInfo $file_info */
$file_info = $this->getInnerIterator()->current();
return $file_info->isFile() && preg_match($this->regex, $file_info->getFilename());
}
}
Function Calls
None |
Stats
MD5 | e8d404a78dd61c08cf5a87a36f674b8e |
Eval Count | 0 |
Decode Time | 100 ms |