Last active
December 12, 2015 01:08
-
-
Save AmyStephen/4689192 to your computer and use it in GitHub Desktop.
Freaking dots.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Discovery retrieves folder and file names | |
* | |
* @param $path | |
* | |
* @return void | |
* @since 1.0 | |
*/ | |
public function discovery($path) | |
{ | |
$this->directories = array(); | |
$this->files = array(); | |
if (is_file($path)) { | |
$this->files[] = $path; | |
return; | |
} | |
if (is_dir($path)) { | |
} else { | |
return; | |
} | |
$this->directories[] = $path; | |
$objects = new RecursiveIteratorIterator ( | |
new RecursiveDirectoryIterator($path), | |
RecursiveIteratorIterator::SELF_FIRST); | |
foreach ($objects as $name => $object) { | |
if (is_file($name)) { | |
$this->files[] = $name; | |
} elseif (is_dir($name)) { | |
if (basename($name) == '.' || basename($name) == '..' ) { | |
} else { | |
$this->directories[] = $name; | |
} | |
} | |
} | |
return; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment