We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 6 | 
| Total Lines | 48 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 7 | trait HandleFileNaming  | 
            ||
| 8 | { | 
            ||
| 9 | /**  | 
            ||
| 10 | * Developer provided filename.  | 
            ||
| 11 | *  | 
            ||
| 12 | * @var null|string|\Closure  | 
            ||
| 13 | */  | 
            ||
| 14 | public $fileName = null;  | 
            ||
| 15 | |||
| 16 | /**  | 
            ||
| 17 | * The file name generator.  | 
            ||
| 18 | * @var FileNameGeneratorInterface  | 
            ||
| 19 | */  | 
            ||
| 20 | public $fileNameGenerator;  | 
            ||
| 21 | |||
| 22 | /**  | 
            ||
| 23 | * Returns the file generator class  | 
            ||
| 24 | *  | 
            ||
| 25 | * @param null|string $fileNameGenerator  | 
            ||
| 26 | * @return void  | 
            ||
| 27 | */  | 
            ||
| 28 | private function setFileNameGenerator($fileNameGenerator)  | 
            ||
| 29 |     { | 
            ||
| 30 |         $fileGeneratorClass = $fileNameGenerator ?? config('backpack.crud.file_name_generator'); | 
            ||
| 31 | |||
| 32 |         if (! class_exists($fileGeneratorClass)) { | 
            ||
| 33 |             throw new \Exception("The file name generator class [{$fileGeneratorClass}] does not exist."); | 
            ||
| 34 | }  | 
            ||
| 35 | |||
| 36 |         if(! class_implements($fileGeneratorClass, FileNameGeneratorInterface::class)) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 37 |             throw new \Exception("The file name generator class [{$fileGeneratorClass}] must implement the [".FileNameGeneratorInterface::class."] interface."); | 
            ||
| 38 | }  | 
            ||
| 39 | |||
| 40 | $this->fileNameGenerator = new $fileGeneratorClass();  | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 | /**  | 
            ||
| 44 | * Return the file name  | 
            ||
| 45 | *  | 
            ||
| 46 | * @param string|UploadedFile $file  | 
            ||
| 47 | * @return string  | 
            ||
| 48 | */  | 
            ||
| 49 |     public function getFileName($file) { | 
            ||
| 55 | }  | 
            ||
| 56 | |||
| 57 | }  |