Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4.0119 |
Changes | 0 |
1 | <?php |
||
39 | 54 | public function parse($key) |
|
40 | { |
||
41 | 54 | $key = trim($key); |
|
42 | |||
43 | 54 | if ($this->parser->string_helper->startsWith('#', $key)) { |
|
44 | return false; |
||
45 | } |
||
46 | |||
47 | 54 | if (!ctype_alnum(str_replace('_', '', $key)) || $this->parser->string_helper->startsWithNumber($key)) { |
|
48 | 6 | throw new ParseException( |
|
49 | 6 | sprintf('Key can only contain alphanumeric and underscores and can not start with a number: %s', $key), |
|
50 | 6 | $key, |
|
51 | 6 | $this->parser->line_num |
|
52 | 6 | ); |
|
53 | } |
||
54 | |||
55 | 48 | return $key; |
|
56 | } |
||
57 | } |
||
58 |