ElfSundae / laravel-hashid

Obfuscate your data by generating reversible, non-sequential, URL-safe identifiers.
MIT License
407 stars 36 forks source link

[Insight] Usage of a function in loops should be avoided - in src/Console/AlphabetGenerateCommand.php, line 31 #1

Closed ElfSundae closed 6 years ago

ElfSundae commented 6 years ago

in src/Console/AlphabetGenerateCommand.php, line 31

This loop uses a function. To avoid the overhead of executing the function n times, you should precalculate it before the loop.

     *
     * @return mixed
     */
    public function handle()
    {
        for ($i = 0; $i < $this->getTimes(); $i++) {
            $this->comment(
                $this->generateRandomAlphabet($this->option('characters'))
            );
        }
    }

Posted from SensioLabsInsight