Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 175 lines (146 sloc) 3.504 kb
5259120 @jfsimon [2.2] [WIP] [Finder] Adding native finders implementations
jfsimon authored
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Finder\Adapter;
13
14 /**
15 * Interface for finder engine implementations.
16 *
17 * @author Jean-François Simon <contact@jfsimon.fr>
18 */
19 abstract class AbstractAdapter implements AdapterInterface
20 {
21 protected $followLinks = false;
22 protected $mode = 0;
23 protected $minDepth = 0;
24 protected $maxDepth = INF;
25 protected $exclude = array();
26 protected $names = array();
27 protected $notNames = array();
28 protected $contains = array();
29 protected $notContains = array();
30 protected $sizes = array();
31 protected $dates = array();
32 protected $filters = array();
33 protected $sort = false;
34
35 /**
36 * {@inheritdoc}
37 */
38 public function setFollowLinks($followLinks)
39 {
40 $this->followLinks = $followLinks;
41
42 return $this;
43 }
44
45 /**
46 * {@inheritdoc}
47 */
48 public function setMode($mode)
49 {
50 $this->mode = $mode;
51
52 return $this;
53 }
54
55 /**
56 * {@inheritdoc}
57 */
58 public function setDepths(array $depths)
59 {
60 $this->minDepth = 0;
61 $this->maxDepth = INF;
62
63 foreach ($depths as $comparator) {
64 switch ($comparator->getOperator()) {
65 case '>':
66 $this->minDepth = $comparator->getTarget() + 1;
67 break;
68 case '>=':
69 $this->minDepth = $comparator->getTarget();
70 break;
71 case '<':
72 $this->maxDepth = $comparator->getTarget() - 1;
73 break;
74 case '<=':
75 $this->maxDepth = $comparator->getTarget();
76 break;
77 default:
78 $this->minDepth = $this->maxDepth = $comparator->getTarget();
79 }
80 }
81
82 return $this;
83 }
84
85 /**
86 * {@inheritdoc}
87 */
88 public function setExclude(array $exclude)
89 {
90 $this->exclude = $exclude;
91
92 return $this;
93 }
94
95 /**
96 * {@inheritdoc}
97 */
98 public function setNames(array $names)
99 {
100 $this->names = $names;
101
102 return $this;
103 }
104
105 /**
106 * {@inheritdoc}
107 */
108 public function setNotNames(array $notNames)
109 {
110 $this->notNames = $notNames;
111
112 return $this;
113 }
114
115 /**
116 * {@inheritdoc}
117 */
118 public function setContains(array $contains)
119 {
120 $this->contains = $contains;
121
122 return $this;
123 }
124
125 /**
126 * {@inheritdoc}
127 */
128 public function setNotContains(array $notContains)
129 {
130 $this->notContains = $notContains;
131
132 return $this;
133 }
134
135 /**
136 * {@inheritdoc}
137 */
138 public function setSizes(array $sizes)
139 {
140 $this->sizes = $sizes;
141
142 return $this;
143 }
144
145 /**
146 * {@inheritdoc}
147 */
148 public function setDates(array $dates)
149 {
150 $this->dates = $dates;
151
152 return $this;
153 }
154
155 /**
156 * {@inheritdoc}
157 */
158 public function setFilters(array $filters)
159 {
160 $this->filters = $filters;
161
162 return $this;
163 }
164
165 /**
166 * {@inheritdoc}
167 */
168 public function setSort($sort)
169 {
170 $this->sort = $sort;
171
172 return $this;
173 }
174 }
Something went wrong with that request. Please try again.