@@ 109-122 (lines=14) @@ | ||
106 | * |
|
107 | * @return File |
|
108 | */ |
|
109 | public function parent() |
|
110 | { |
|
111 | $pattern = $this->getPattern(); |
|
112 | $dir = $this->getDir(); |
|
113 | ||
114 | if ($this->find($pattern)->in($dir)->has() === false) { |
|
115 | $dir = dirname($dir); |
|
116 | $this->file_list = $this->find($pattern)->in($dir)->get(); |
|
117 | } else { |
|
118 | $this->file_list = $this->find($pattern)->in($dir)->get(); |
|
119 | } |
|
120 | ||
121 | return $this; |
|
122 | } |
|
123 | ||
124 | /** |
|
125 | * Alias of the up() method |
|
@@ 133-147 (lines=15) @@ | ||
130 | * |
|
131 | * @return File |
|
132 | */ |
|
133 | public function parents() |
|
134 | { |
|
135 | $dir = $this->getDir(); |
|
136 | $pattern = $this->getPattern(); |
|
137 | ||
138 | if ($this->find($pattern)->in($dir)->has() === false) { |
|
139 | $dir = dirname($dir); |
|
140 | ||
141 | $this->file_list = $this->find($pattern)->in($dir)->up()->get(); |
|
142 | } else { |
|
143 | $this->file_list = $this->find($pattern)->in($dir)->get(); |
|
144 | } |
|
145 | ||
146 | return $this; |
|
147 | } |
|
148 | ||
149 | /** |
|
150 | * Sets the directory to start search in. |
|
@@ 176-189 (lines=14) @@ | ||
173 | * |
|
174 | * @return File |
|
175 | */ |
|
176 | public function upOne() |
|
177 | { |
|
178 | $dir = $this->getDir(); |
|
179 | $pattern = $this->getPattern(); |
|
180 | ||
181 | if ($this->find($pattern)->in($dir)->has() === false) { |
|
182 | $dir = dirname($dir); |
|
183 | $this->file_list = $this->find($pattern)->in($dir)->get(); |
|
184 | } else { |
|
185 | $this->file_list = $this->find($pattern)->in($dir)->get(); |
|
186 | } |
|
187 | ||
188 | return $this; |
|
189 | } |
|
190 | ||
191 | /** |
|
192 | * Recursively searches parent directories. |
|
@@ 198-212 (lines=15) @@ | ||
195 | * |
|
196 | * @return File |
|
197 | */ |
|
198 | public function up() |
|
199 | { |
|
200 | $dir = $this->getDir(); |
|
201 | $pattern = $this->getPattern(); |
|
202 | ||
203 | if ($this->find($pattern)->in($dir)->has() === false) { |
|
204 | $dir = dirname($dir); |
|
205 | ||
206 | $this->file_list = $this->find($pattern)->in($dir)->up()->get(); |
|
207 | } else { |
|
208 | $this->file_list = $this->find($pattern)->in($dir)->get(); |
|
209 | } |
|
210 | ||
211 | return $this; |
|
212 | } |
|
213 | ||
214 | /** |
|
215 | * Return specified amount of files |