map as $index => $value) { if (isset($odoo[ $index ])) { if (is_string($value)) { $result[ $value ] = $odoo[ $index ]; } else { $result[ $value[ 'attribute' ] ] = call_user_func($value[ 'artbox' ], $odoo[ $index ]); } } } return $result; } /** * Map artbox array to odoo array * * @param array $artbox * * @return array */ public function toOdoo(array $artbox): array { $result = []; foreach ($this->map as $index => $value) { if (is_string($value)) { if (isset($artbox[ $value ])) { $result[ $index ] = $artbox[ $value ]; } } else { if (isset($artbox[ $value[ 'attribute' ] ])) { $result[ $index ] = call_user_func($value[ 'odoo' ], $artbox[ $value[ 'attribute' ] ]); } } } return $result; } }