for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of plumphp/plum.
*
* (c) Florian Eckerstorfer <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Plum\Plum\Converter;
* HeaderConverter.
* @author Sebastian Göttschkes <[email protected]>
* @copyright 2014-2016 Florian Eckerstorfer
class HeaderConverter implements ConverterInterface
{
/** @var string[]|null */
private $header = null;
* {@inheritdoc}
public function convert($item)
if ($this->header === null) {
$this->header = $item;
return $item;
}
$newItem = [];
foreach ($item as $key => $value) {
if (isset($this->header[$key])) {
$key = $this->header[$key];
$newItem[$key] = $value;
return $newItem;