mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Optimized code a bit
This commit is contained in:
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user