Total Complexity | 5 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class PrependBlocks implements MutatorInterface, RenderableInterface |
||
13 | { |
||
14 | use RenderableTrait; |
||
15 | |||
16 | /** @var RenderBlock */ |
||
17 | private $renderBlock; |
||
18 | |||
19 | /** @var Block[] */ |
||
20 | private $blocks = []; |
||
21 | |||
22 | public function __construct(RenderBlock $renderBlock) |
||
25 | } |
||
26 | |||
27 | public function mutate(Handler $ajaxcom): Handler |
||
28 | { |
||
29 | foreach ($this->blocks as $block) { |
||
30 | try { |
||
31 | $html = $this->renderBlock->render($block, $this->view, $this->parameters); |
||
32 | $ajaxcom->container('#'.$block->getId())->prepend($html); |
||
33 | } catch (AjaxcomException $e) { |
||
34 | continue; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | return $ajaxcom; |
||
39 | } |
||
40 | |||
41 | public function add(string $selector): self |
||
46 | } |
||
47 | } |
||
48 |