12 namespace Symfony\Component\Finder\Tests\Iterator;
28 if (is_string($param)) {
29 parent::__construct($param);
30 }
elseif (is_array($param)) {
36 'relativePath' => null,
37 'relativePathname' => null,
39 $defaults = array_merge($defaults, $param);
40 parent::__construct($defaults[
'name']);
42 $this->
setMode($defaults[
'mode']);
43 $this->
setType($defaults[
'type']);
47 throw new \RuntimeException(sprintf(
'Incorrect parameter "%s"', $param));
53 if (null === $this->type) {
54 return false !== strpos($this->getFilename(),
'file');
62 if (null === $this->type) {
63 return false !== strpos($this->getFilename(),
'directory');
71 if (null === $this->mode) {
72 return preg_match(
'/r\+/', $this->getFilename());
75 return preg_match(
'/r\+/', $this->mode);
95 if (is_string(
$type)) {
98 $this->type = self::TYPE_DIRECTORY;
100 $this->type = self::TYPE_DIRECTORY;
103 $this->type = self::TYPE_FILE;
105 $this->type = self::TYPE_FILE;
108 $this->type = self::TYPE_UNKNOWN;