Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace BestServedCold\PhalueObjects\Colour; |
||
7 | public function toRbg() |
||
8 | { |
||
9 | $hex = str_replace("#", "", $this->value); |
||
10 | |||
11 | if(strlen($hex) == 3) { |
||
12 | $r = hexdec($hex[0].$hex[0]); |
||
|
|||
13 | $g = hexdec($hex[1].$hex[1]); |
||
14 | $b = hexdec($hex[2].$hex[2]); |
||
15 | } else { |
||
16 | $r = hexdec($hex[0].$hex[1]); |
||
17 | $g = hexdec($hex[2].$hex[3]); |
||
18 | $b = hexdec($hex[4].$hex[5]); |
||
19 | } |
||
20 | |||
21 | return new Rgb(array($r, $g, $b)); |
||
22 | } |
||
23 | } |
||
24 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.