for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cekta\DI\Reflection;
class ParamTranfromer
{
/**
* @var string
*/
private $prefix;
* @var array
private $replace;
public function __construct(string $prefix, array $replace)
$this->prefix = $prefix;
$this->replace = $replace;
}
public function transform(string $name, array $params): array
if (strpos($name, $this->prefix) === 0) {
$params = $this->transformParam($params);
return $params;
private function transformParam(array $params): array
foreach ($params as $key => $value) {
if (array_key_exists($value, $this->replace)) {
$params[$key] = $this->replace[$value];