Skip to content

Commit

Permalink
Only migrate PHP files, and exclude the vendor folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
blunket committed Jul 6, 2018
1 parent e0ed25d commit 10a2a94
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/PhpSpreadsheet/Helper/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +248,22 @@ public function getMapping()
private function recursiveReplace($path)
{
$patterns = [
'/*.md',
'/*.php',
'/*.phpt',
'/*.php3',
'/*.php4',
'/*.php5',
'/*.phtml',
'/*.txt',
'/*.TXT',
];

$from = array_keys($this->getMapping());
$to = array_values($this->getMapping());

foreach ($patterns as $pattern) {
foreach (glob($path . $pattern) as $file) {
if (strpos($path, '/vendor/') !== false) {
continue;
}
$original = file_get_contents($file);
$converted = str_replace($from, $to, $original);

Expand Down

0 comments on commit 10a2a94

Please sign in to comment.