Commit 1e291ec4 by Alexander Makarov

Optimized code a bit

parent dd621958
...@@ -296,22 +296,20 @@ class FixtureController extends Controller ...@@ -296,22 +296,20 @@ class FixtureController extends Controller
private function findFixtures(array $fixtures) private function findFixtures(array $fixtures)
{ {
$fixturesPath = Yii::getAlias($this->fixturePath); $fixturesPath = Yii::getAlias($this->fixturePath);
$filesToSearch = [];
$files = [];
if ($this->needToApplyAll($fixtures[0])) { if ($this->needToApplyAll($fixtures[0])) {
$files = FileHelper::findFiles($fixturesPath, ['only' => ['.php']]); $filesToSearch = ['.php'];
} else { } else {
$filesToSearch = [];
foreach ($fixtures as $fileName) { foreach ($fixtures as $fileName) {
$filesToSearch[] = $fileName . '.php'; $filesToSearch[] = $fileName . '.php';
} }
$files = FileHelper::findFiles($fixturesPath, ['only' => $filesToSearch]);
} }
$files = FileHelper::findFiles($fixturesPath, ['only' => $filesToSearch]);
$foundFixtures = []; $foundFixtures = [];
foreach($files as $fixture) { foreach ($files as $fixture) {
$foundFixtures[] = basename($fixture , '.php'); $foundFixtures[] = basename($fixture , '.php');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment