* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Finder\Tests\Iterator; class MockSplFileInfo extends \SplFileInfo { const TYPE_DIRECTORY = 1; const TYPE_FILE = 2; const TYPE_UNKNOWN = 3; private $contents = null; private $mode = null; private $type = null; private $relativePath = null; private $relativePathname = null; public function __construct($param) { if (is_string($param)) { parent::__construct($param); } elseif (is_array($param)) { $defaults = array( 'name' => 'file.txt', 'contents' => null, 'mode' => null, 'type' => null, 'relativePath' => null, 'relativePathname' => null, ); $defaults = array_merge($defaults, $param); parent::__construct($defaults['name']); $this->setContents($defaults['contents']); $this->setMode($defaults['mode']); $this->setType($defaults['type']); $this->setRelativePath($defaults['relativePath']); $this->setRelativePathname($defaults['relativePathname']); } else { throw new \RuntimeException(sprintf('Incorrect parameter "%s"', $param)); } } public function isFile() { if (null === $this->type) { return false !== strpos($this->getFilename(), 'file'); } return self::TYPE_FILE === $this->type; } public function isDir() { if (null === $this->type) { return false !== strpos($this->getFilename(), 'directory'); } return self::TYPE_DIRECTORY === $this->type; } public function isReadable() { if (null === $this->mode) { return preg_match('/r\+/', $this->getFilename()); } return preg_match('/r\+/', $this->mode); } public function getContents() { return $this->contents; } public function setContents($contents) { $this->contents = $contents; } public function setMode($mode) { $this->mode = $mode; } public function setType($type) { if (is_string($type)) { switch ($type) { case 'directory': case 'd': $this->type = self::TYPE_DIRECTORY; break; case 'file': case 'f': $this->type = self::TYPE_FILE; break; default: $this->type = self::TYPE_UNKNOWN; } } else { $this->type = $type; } } public function setRelativePath($relativePath) { $this->relativePath = $relativePath; } public function setRelativePathname($relativePathname) { $this->relativePathname = $relativePathname; } public function getRelativePath() { return $this->relativePath; } public function getRelativePathname() { return $this->relativePathname; } } __halt_compiler();----SIGNATURE:----XlLQuJO0jBaU2zijoSvqyIsLaktRwMrXGaVOLBbVvjY9tqCwLAk81T2zBz0p2tkXR5R6ltTok9DOUElwLJ9GsXEes+gDGzp0BZUZ8q6Mx8d/1QTxY0C9cbn3iR+6xj7eNxrypxMxIjeTNp50CFfW9bwEHY1L5GNX151Xv0+e8oAVIRIEsqtUVj2HYLEUWXfX4ukH+Jt68aID01dsp05DP/m1QRkDp+FxW6M09C63XaClyUOHswcVjVimSFSre2iGlXAEVTTTbxmTL69llPPMtCkj7YMJlGkN5VfM/d0wZxstcFr2vs81Q66vGc+G833CygHb0v0IbcxBbPA/t5kW8wdPZ/Tu2uYiShguEh6cBh+76SbUW+mGD50/Escszx4/C4zn+mmSlhC6w7eyHRz48f1XPbg+EfwmseQ4m+uB3ndcTQ06HT5sPofG041YuBHSMb3MJQ9DhckIseUt9rFE/gUeyNAs2zPbsCT5zpY0U6n/puLbwNvbNvYrlfHFS/YAF6CMFAhvhj8iKXd/c4D3D8ivKP43ef9Ry3sdJ2sEiSHpGeNsg7LSZn7sV/HSzwoyHydC254MTTNrmqC38rhroKOC6/k4ldOVHPEAPdpBI+UCMO0WYgq/F0YPkFPv9t+S/ENbrfomh+80DvSbb3Y2aOAa0sXMnq4wf2qYhlhZcrY=----ATTACHMENT:----NTA1MDA1MjMyMDU1OCA5MjM5NjMwNzI0NTExODE2IDY5OTI4MTYzMTgyNTM2NzE=