blessing-skin-server/app/Listeners/CleanUpFrontEndLocaleFiles.php

28 lines
623 B
PHP

<?php
namespace App\Listeners;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Finder\SplFileInfo;
class CleanUpFrontEndLocaleFiles
{
/** @var Filesystem */
protected $filesystem;
public function __construct(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
}
public function handle()
{
$files = $this->filesystem->allFiles(public_path('lang'));
array_walk($files, function (SplFileInfo $file) {
if ($file->getExtension() === 'js') {
$this->filesystem->delete($file->getPathname());
}
});
}
}