Skip to content

Commit

Permalink
Remove a global function.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Jun 1, 2014
1 parent c6259c5 commit 6d0ceb2
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions build.php
Expand Up @@ -17,7 +17,21 @@
$phar->setSignatureAlgorithm(\Phar::SHA1);
$phar->startBuffering();

foreach (findFiles('src') as $path) {
$findFiles = function ($dir) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::CHILD_FIRST);

$files = array();
foreach ($iterator as $path) {
if ($path->isFile()) {
$files[] = $path->getPath().DIRECTORY_SEPARATOR.$path->getFilename();
}
}

return $files;
};

foreach ($findFiles('src') as $path) {
$phar->addFromString($path, file_get_contents(__DIR__.'/'.$path));
}

Expand All @@ -39,17 +53,3 @@
STUB
);
$phar->stopBuffering();

function findFiles($dir) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::CHILD_FIRST);

$files = array();
foreach ($iterator as $path) {
if ($path->isFile()) {
$files[] = $path->getPath().DIRECTORY_SEPARATOR.$path->getFilename();
}
}

return $files;
}

0 comments on commit 6d0ceb2

Please sign in to comment.