/** * @param $key * @param $value * * @return mixed */ public function decorateAttribute($key, $value) { $decorations = $this->getDecorations($key); $value = array_reduce($decorations, function ($input, $decoration) { return static::$decorator->decorate($decoration, $input); }, $value); return $value; }
public function test_it_can_decorate_name() { $decorator = new DecoratorFactory(); $this->assertEquals('Rahul Kadyan', $decorator->decorate('name', 'rahul kadyan')); }