| Conditions | 5 | 
| Paths | 5 | 
| Total Lines | 27 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 30 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 48 | public function guess($field, $value)  | 
            ||
| 49 |     { | 
            ||
| 50 |         if (!$this->supports($field)) { | 
            ||
| 51 |             throw new \BadMethodCallException(sprintf('Config field "%s" is not supported', $field)); | 
            ||
| 52 | }  | 
            ||
| 53 | |||
| 54 | $values = $this->getConfigValues($field);  | 
            ||
| 55 | |||
| 56 | // already matched?  | 
            ||
| 57 |         if (is_numeric($value)) { | 
            ||
| 58 | $value = (int) $value;  | 
            ||
| 59 |             if (!array_key_exists($value, $values)) { | 
            ||
| 60 | throw new \OutOfBoundsException(  | 
            ||
| 61 |                     sprintf('Value "%d" for field "%s" already seems a key, but it is not a valid one', $value, $field) | 
            ||
| 62 | );  | 
            ||
| 63 | }  | 
            ||
| 64 | |||
| 65 | return $value;  | 
            ||
| 66 | }  | 
            ||
| 67 | |||
| 68 | // look for an exact match first  | 
            ||
| 69 |         if (false !== $key = array_search(mb_strtolower($value), $values)) { | 
            ||
| 70 | return $key;  | 
            ||
| 71 | }  | 
            ||
| 72 | |||
| 73 | return $this->matcher->match($field, $value);  | 
            ||
| 74 | }  | 
            ||
| 75 | |||
| 86 |