Conditions | 6 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function transform( iterable $list, string $key, string $prop ) : \Aimeos\MW\MapIface |
||
31 | { |
||
32 | $result = []; |
||
33 | |||
34 | foreach( $list as $entry ) |
||
35 | { |
||
36 | if( is_object( $entry ) && method_exists( $entry, 'toArray' ) ) { |
||
37 | $entry = $entry->toArray(); |
||
38 | } |
||
39 | |||
40 | if( array_key_exists( $key, $entry ) && array_key_exists( $prop, $entry ) ) { |
||
41 | $result[$entry[$key]] = $entry[$prop]; |
||
42 | } |
||
43 | } |
||
44 | |||
45 | return \Aimeos\MW\Map::from( $result ); |
||
46 | } |
||
48 |