/** * Inject cells into an array from corresponding properties in an object * @param <type> $source The original object * @param <type> $target An associative array state representation of that object * @param <type> $fields The names of the object properties */ function fieldInject($source, $target, $fields) { foreach ($fields as $prop) { if (isset($source->{$prop})) { $target[$prop] = $source->html_entity_decode($prop); } } }