Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Composite.php
Go to the documentation of this file.
1 <?php
9 
11 
12 class Composite implements RendererInterface
13 {
17  protected $_renderers;
18 
23  public function __construct(array $renderers)
24  {
25  foreach ($renderers as $renderer) {
26  if (!$renderer instanceof RendererInterface) {
27  throw new \InvalidArgumentException(
28  sprintf('Instance of the phrase renderer is expected, got %s instead.', get_class($renderer))
29  );
30  }
31  }
32  $this->_renderers = $renderers;
33  }
34 
42  public function render(array $source, array $arguments = [])
43  {
44  $result = $source;
45  foreach ($this->_renderers as $render) {
46  $result[] = $render->render($result, $arguments);
47  }
48  return end($result);
49  }
50 }
render(array $source, array $arguments=[])
Definition: Composite.php:42
$source
Definition: source.php:23
$arguments