Server IP : 127.0.0.2 / Your IP : 52.14.93.216 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/symfony/finder/Tests/Iterator/ |
Upload File : |
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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; } }