for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace GFG\Mapper\Data\Type\Assoc;
use GFG\Mapper\Data\MapperInterface;
use GFG\Mapper\Data\Type;
class Single extends Type\Single
{
public function run(&$data, $key = null)
$new = [];
foreach ($data as $key => $value) {
if (!is_array($value)) { // check for single to be sure!
$oldKey = $key;
parent::run($key);
if ($this->options['use'] == 'raw') {
parent::run($value, $oldKey . '_' . $value);
} else {
parent::run($value, $key . '_' . $value);
}
unset($data[$oldKey]);
$new[$key] = $value;
$data += $new; // yep, union operator here!