@@ -105,21 +105,15 @@ public static function getInstance()
105105 * @param string $suffix
106106 * @param string $prefix
107107 * @param string $group
108- * @param boolean $check
109- * @throws RuntimeException
110108 */
111- public function addDirectoryToBlacklist ($ directory , $ suffix = '.php ' , $ prefix = '' , $ group = 'DEFAULT ' , $ check = TRUE )
109+ public function addDirectoryToBlacklist ($ directory , $ suffix = '.php ' , $ prefix = '' , $ group = 'DEFAULT ' )
112110 {
113- if (!$ check || file_exists ($ directory )) {
114- $ files = File_Iterator_Factory::getFileIterator (
115- $ directory , $ suffix , $ prefix
116- );
111+ $ files = File_Iterator_Factory::getFileIterator (
112+ $ directory , $ suffix , $ prefix
113+ );
117114
118- foreach ($ files as $ file ) {
119- $ this ->addFileToBlacklist ($ file ->getPathName (), $ group , FALSE );
120- }
121- } else {
122- throw new RuntimeException ($ directory . ' does not exist ' );
115+ foreach ($ files as $ file ) {
116+ $ this ->addFileToBlacklist ($ file ->getPathName (), $ group , FALSE );
123117 }
124118 }
125119
@@ -128,29 +122,22 @@ public function addDirectoryToBlacklist($directory, $suffix = '.php', $prefix =
128122 *
129123 * @param string $filename
130124 * @param string $group
131- * @param boolean $check
132- * @throws RuntimeException
133125 */
134- public function addFileToBlacklist ($ filename , $ group = 'DEFAULT ' , $ check = TRUE )
126+ public function addFileToBlacklist ($ filename , $ group = 'DEFAULT ' )
135127 {
136- if (!$ check || file_exists ($ filename )) {
137- $ this ->blacklistedFiles [$ group ][realpath ($ filename )] = TRUE ;
138- } else {
139- throw new RuntimeException ($ filename . ' does not exist ' );
140- }
128+ $ this ->blacklistedFiles [$ group ][realpath ($ filename )] = TRUE ;
141129 }
142130
143131 /**
144132 * Adds files to the blacklist.
145133 *
146134 * @param array $files
147135 * @param string $group
148- * @param boolean $check
149136 */
150- public function addFilesToBlacklist (array $ files , $ group = 'DEFAULT ' , $ check = TRUE )
137+ public function addFilesToBlacklist (array $ files , $ group = 'DEFAULT ' )
151138 {
152139 foreach ($ files as $ file ) {
153- $ this ->addFileToBlacklist ($ file , $ group, $ check );
140+ $ this ->addFileToBlacklist ($ file , $ group );
154141 }
155142 }
156143
@@ -161,21 +148,15 @@ public function addFilesToBlacklist(array $files, $group = 'DEFAULT', $check = T
161148 * @param string $suffix
162149 * @param string $prefix
163150 * @param string $group
164- * @param boolean $check
165- * @throws RuntimeException
166151 */
167- public function removeDirectoryFromBlacklist ($ directory , $ suffix = '.php ' , $ prefix = '' , $ group = 'DEFAULT ' , $ check = TRUE )
152+ public function removeDirectoryFromBlacklist ($ directory , $ suffix = '.php ' , $ prefix = '' , $ group = 'DEFAULT ' )
168153 {
169- if (!$ check || file_exists ($ directory )) {
170- $ files = File_Iterator_Factory::getFileIterator (
171- $ directory , $ suffix , $ prefix
172- );
154+ $ files = File_Iterator_Factory::getFileIterator (
155+ $ directory , $ suffix , $ prefix
156+ );
173157
174- foreach ($ files as $ file ) {
175- $ this ->removeFileFromBlacklist ($ file ->getPathName (), $ group );
176- }
177- } else {
178- throw new RuntimeException ($ directory . ' does not exist ' );
158+ foreach ($ files as $ file ) {
159+ $ this ->removeFileFromBlacklist ($ file ->getPathName (), $ group );
179160 }
180161 }
181162
@@ -200,21 +181,15 @@ public function removeFileFromBlacklist($filename, $group = 'DEFAULT')
200181 * @param string $directory
201182 * @param string $suffix
202183 * @param string $prefix
203- * @param boolean $check
204- * @throws RuntimeException
205184 */
206- public function addDirectoryToWhitelist ($ directory , $ suffix = '.php ' , $ prefix = '' , $ check = TRUE )
185+ public function addDirectoryToWhitelist ($ directory , $ suffix = '.php ' , $ prefix = '' )
207186 {
208- if (!$ check || file_exists ($ directory )) {
209- $ files = File_Iterator_Factory::getFileIterator (
210- $ directory , $ suffix , $ prefix
211- );
187+ $ files = File_Iterator_Factory::getFileIterator (
188+ $ directory , $ suffix , $ prefix
189+ );
212190
213- foreach ($ files as $ file ) {
214- $ this ->addFileToWhitelist ($ file ->getPathName (), FALSE );
215- }
216- } else {
217- throw new RuntimeException ($ directory . ' does not exist ' );
191+ foreach ($ files as $ file ) {
192+ $ this ->addFileToWhitelist ($ file ->getPathName (), FALSE );
218193 }
219194 }
220195
@@ -225,28 +200,21 @@ public function addDirectoryToWhitelist($directory, $suffix = '.php', $prefix =
225200 * When the whitelist is not empty, whitelisting is used.
226201 *
227202 * @param string $filename
228- * @param boolean $check
229- * @throws RuntimeException
230203 */
231- public function addFileToWhitelist ($ filename, $ check = TRUE )
204+ public function addFileToWhitelist ($ filename )
232205 {
233- if (!$ check || file_exists ($ filename )) {
234- $ this ->whitelistedFiles [realpath ($ filename )] = TRUE ;
235- } else {
236- throw new RuntimeException ($ filename . ' does not exist ' );
237- }
206+ $ this ->whitelistedFiles [realpath ($ filename )] = TRUE ;
238207 }
239208
240209 /**
241210 * Adds files to the whitelist.
242211 *
243212 * @param array $files
244- * @param boolean $check
245213 */
246- public function addFilesToWhitelist (array $ files, $ check = TRUE )
214+ public function addFilesToWhitelist (array $ files )
247215 {
248216 foreach ($ files as $ file ) {
249- $ this ->addFileToWhitelist ($ file, TRUE );
217+ $ this ->addFileToWhitelist ($ file );
250218 }
251219 }
252220
@@ -256,21 +224,15 @@ public function addFilesToWhitelist(array $files, $check = TRUE)
256224 * @param string $directory
257225 * @param string $suffix
258226 * @param string $prefix
259- * @param boolean $check
260- * @throws RuntimeException
261227 */
262- public function removeDirectoryFromWhitelist ($ directory , $ suffix = '.php ' , $ prefix = '' , $ check = TRUE )
228+ public function removeDirectoryFromWhitelist ($ directory , $ suffix = '.php ' , $ prefix = '' )
263229 {
264- if (!$ check || file_exists ($ directory )) {
265- $ files = File_Iterator_Factory::getFileIterator (
266- $ directory , $ suffix , $ prefix
267- );
230+ $ files = File_Iterator_Factory::getFileIterator (
231+ $ directory , $ suffix , $ prefix
232+ );
268233
269- foreach ($ files as $ file ) {
270- $ this ->removeFileFromWhitelist ($ file ->getPathName ());
271- }
272- } else {
273- throw new RuntimeException ($ directory . ' does not exist ' );
234+ foreach ($ files as $ file ) {
235+ $ this ->removeFileFromWhitelist ($ file ->getPathName ());
274236 }
275237 }
276238
0 commit comments