Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | 36 | public function parse($key, $line_num) |
|
42 | { |
||
43 | 36 | $key = trim($key); |
|
44 | |||
45 | 36 | if ($this->startsWith('#', $key)) { |
|
46 | 3 | return false; |
|
47 | } |
||
48 | |||
49 | 36 | if (!ctype_alnum(str_replace('_', '', $key))) { |
|
50 | 6 | throw new ParseException( |
|
51 | 6 | sprintf('Key can only contain alphanumeric and underscores: %s', $key), |
|
52 | 6 | $this->origin_exception, |
|
53 | 6 | $this->file, |
|
54 | 6 | $key, |
|
55 | $line_num |
||
56 | 6 | ); |
|
57 | } |
||
58 | |||
59 | 30 | return $key; |
|
60 | } |
||
61 | } |