HashMakeCommand::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace LaravelPlus\Extension\Commands;
4
5
use Illuminate\Console\Command;
6
7
/**
8
 * @author Fumio Furukawa <[email protected]>
9
 */
10
class HashMakeCommand extends Command
11
{
12
    /**
13
     * The console command signature.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'hash:make
18
        {string : Plain string.}
19
        {--cost=10 : Cost of generate.}
20
    ';
21
22
    /**
23
     * The console command description.
24
     *
25
     * @var string
26
     */
27
    protected $description = '[+] Make hashed value';
28
29
    /**
30
     * Execute the console command.
31
     *
32
     * @return mixed
33
     */
34 2
    public function handle()
35
    {
36 2
        $cost = $this->option('cost');
37
38 2
        $hashed = app('hash')->make($this->argument('string'), [
39 2
            'rounds' => $cost,
40
        ]);
41
42 2
        $this->info(sprintf('Generated hash: "%s"', $hashed));
43 2
    }
44
}
45