From f9facdab6810f808f940d63823648877e92d02a0 Mon Sep 17 00:00:00 2001 From: farid saravi Date: Sat, 19 Sep 2020 17:20:09 +0430 Subject: [PATCH] fix: rename ModelFinder to MorphModelFinder --- app/Console/Commands/CacheMorphMap.php | 18 +++++++++--------- app/Console/Commands/ClearCachedMorphMap.php | 14 +++++++------- .../{ModelFinder.php => MorphModelFinder.php} | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) rename app/Services/{ModelFinder.php => MorphModelFinder.php} (99%) diff --git a/app/Console/Commands/CacheMorphMap.php b/app/Console/Commands/CacheMorphMap.php index 17e751f..a2db64d 100644 --- a/app/Console/Commands/CacheMorphMap.php +++ b/app/Console/Commands/CacheMorphMap.php @@ -2,7 +2,7 @@ namespace App\Console\Commands; -use App\Services\ModelFinder; +use App\Services\MorphModelFinder; use Illuminate\Console\Command; class CacheMorphMap extends Command @@ -22,20 +22,20 @@ class CacheMorphMap extends Command protected $description = 'Create a cache file for faster morph mapping'; /** - * @var ModelFinder + * @var MorphModelFinder */ - private $modelFinder; + private $morphModelFinder; /** * Create a new command instance. * - * @param ModelFinder $modelFinder + * @param MorphModelFinder $morphModelFinder */ - public function __construct(ModelFinder $modelFinder) + public function __construct(MorphModelFinder $morphModelFinder) { parent::__construct(); - $this->modelFinder = $modelFinder; + $this->morphModelFinder = $morphModelFinder; } /** @@ -45,10 +45,10 @@ class CacheMorphMap extends Command */ public function handle(): void { - $cache = $this->modelFinder->getCachePath(); + $cache = $this->morphModelFinder->getCachePath(); - $models = $this->modelFinder->getModels(); - $map = $this->modelFinder->getModelMap($models); + $models = $this->morphModelFinder->getModels(); + $map = $this->morphModelFinder->getModelMap($models); file_put_contents( $cache, diff --git a/app/Console/Commands/ClearCachedMorphMap.php b/app/Console/Commands/ClearCachedMorphMap.php index 2996222..02fcb78 100644 --- a/app/Console/Commands/ClearCachedMorphMap.php +++ b/app/Console/Commands/ClearCachedMorphMap.php @@ -2,7 +2,7 @@ namespace App\Console\Commands; -use App\Services\ModelFinder; +use App\Services\MorphModelFinder; use Illuminate\Console\Command; class ClearCachedMorphMap extends Command @@ -22,20 +22,20 @@ class ClearCachedMorphMap extends Command protected $description = 'Remove the morph map cache file'; /** - * @var ModelFinder + * @var MorphModelFinder */ - private $modelFinder; + private $morphModelFinder; /** * Create a new command instance. * - * @param ModelFinder $modelFinder + * @param MorphModelFinder $morphModelFinder */ - public function __construct(ModelFinder $modelFinder) + public function __construct(MorphModelFinder $morphModelFinder) { parent::__construct(); - $this->modelFinder = $modelFinder; + $this->morphModelFinder = $morphModelFinder; } /** @@ -45,7 +45,7 @@ class ClearCachedMorphMap extends Command */ public function handle(): void { - @unlink($this->modelFinder->getCachePath()); + @unlink($this->morphModelFinder->getCachePath()); $this->info('Morph map models cache cleared!'); } diff --git a/app/Services/ModelFinder.php b/app/Services/MorphModelFinder.php similarity index 99% rename from app/Services/ModelFinder.php rename to app/Services/MorphModelFinder.php index 60c6cb8..a66f1bc 100644 --- a/app/Services/ModelFinder.php +++ b/app/Services/MorphModelFinder.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Relation; -class ModelFinder +class MorphModelFinder { /** * Scan all model directories and automatically alias the polymorphic types of Eloquent models.