* * 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:----rjgIXCaFiDymmdlLgYUTZInDWATsqKyB6b0/7XsaU+5Y47rqwVowRgCT7+YN+ZPrc9ZJ0nFA1klyUA1SklRamwDnJX9qLAWh84aC7DavdddyeDhpRFUCJO5SpCBBgopMzYIgtSnMixovqLc+F6uiRtA2Fp/3jRwVjWbXvfb+HFKj73qxKE1bI5sEuDm5k3n5Sxh+v1a1loEQmSsaHaJQzj4J0CgEpeyqWPMonCjNSEZCERL5mMcLinMVbh0lB+jMgn5l5hgqWxLAoxp2fe7tt3S6EGe6p+Gq0X5TJsDXiYyOfn5SsYifv0ic5kDOHOhEgLOd4Ko7S4JCWUEwzLtc1AxO/PGb0blYnkxjIUFKyQ5dFAlixz36fB7h52yYiWTF0495y4DZan1gGTkZmPHPhit56UZo41hyXHakGanz9o0YvkhBQpdKF4cEoNhyat24dZvatUsUc3Iyi0vgGu+lg93uA8Zq2Tboh4lEFdHj+pvdkgvgTVeAbTYt1+PknxKXe9rR+y00rIPTlE10/Tf1s+KLmvAcGnbBopY3l2ZaBQXoKDBRXHKCofejhnqLJThKm2kN1aL4jLzs9VoB0OnboRb2wpGmtVd+MmkT5Dj3N4IxEugxHhUo8sPzls9Zt7Ge5AmYsNrRo1kvi60jzd0U8CYxD1fwj47mPwwZLjyPpgA=----ATTACHMENT:----ODczODI1NTkwNDk1NDkyMCA0MTMyNDUxOTk0ODY0MDgyIDM5ODc2Njg3MzA4NjY0MTg=