for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Genkgo\Camt\Decoder\Factory\DTO\Behavior;
use SimpleXMLElement;
trait Mapping
{
/**
* @param object $object
* @param SimpleXMLElement $xml
*/
public static function map($object, SimpleXMLElement $xml, array $mapping)
foreach ($mapping as $line) {
$setter = $line[0];
$xmlValue = $line[1];
if (isset($xml->$xmlValue)) {
$object->$setter((string) $xml->$xmlValue);
}