Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
43 | public function toRequestParams(Profile $profile) |
||
44 | { |
||
45 | $params = new ParameterBag(); |
||
46 | |||
47 | foreach (get_class_methods(get_class($profile)) as $method) { |
||
48 | if ('get' === substr($method, 0, 3)) { |
||
49 | $property = strtolower(preg_replace( |
||
50 | '/([a-z])([A-Z])/', |
||
51 | '\$1_\$2', |
||
52 | substr($method, 3) |
||
53 | )); |
||
54 | $params->set($property, $profile->$method()); |
||
55 | } |
||
56 | } |
||
57 | |||
58 | return $params; |
||
59 | } |
||
60 | } |
||
61 |