菜谱项目

FakeFile.php 832B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpFoundation\Tests\File;
  11. use Symfony\Component\HttpFoundation\File\File as OrigFile;
  12. class FakeFile extends OrigFile
  13. {
  14. private $realpath;
  15. public function __construct($realpath, $path)
  16. {
  17. $this->realpath = $realpath;
  18. parent::__construct($path, false);
  19. }
  20. public function isReadable()
  21. {
  22. return true;
  23. }
  24. public function getRealpath()
  25. {
  26. return $this->realpath;
  27. }
  28. public function getSize()
  29. {
  30. return 42;
  31. }
  32. public function getMTime()
  33. {
  34. return time();
  35. }
  36. }