HashidsIntegerDriver::decode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace ElfSundae\Laravel\Hashid;
4
5
class HashidsIntegerDriver extends HashidsDriver
6
{
7
    /**
8
     * Decode the data.
9
     *
10
     * @param  mixed  $data
11
     * @return int
12
     */
13 4
    public function decode($data)
14
    {
15 4
        $decoded = parent::decode($data);
16
17 4
        return 1 === count($decoded) ? reset($decoded) : 0;
18
    }
19
}
20