Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit cd61a9f

Browse files
committed
Minor changes for readability
1 parent bdcf3a7 commit cd61a9f

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/ZendViewRenderer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,10 @@ private function getNamespacedResolver(AggregateResolver $aggregate)
295295
*/
296296
private function mergeViewModel($name, ModelInterface $model)
297297
{
298-
$variables = $model->getVariables();
299-
$params = $this->mergeParams($name, $this->normalizeParams($variables));
298+
$params = $this->mergeParams(
299+
$name,
300+
$this->normalizeParams($model->getVariables())
301+
);
300302
$model->setVariables($params);
301303
$model->setTemplate($name);
302304
return $model;

test/ZendViewRendererTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,21 +474,26 @@ public function testCanRenderWithChildViewModel()
474474
$path = __DIR__ . '/TestAsset';
475475
$renderer = new ZendViewRenderer();
476476
$renderer->addPath($path);
477-
$viewModelParent = new ViewModel();
477+
478478
$viewModelChild = new ViewModel();
479479
$viewModelChild->setTemplate('zendview-null');
480+
481+
$viewModelParent = new ViewModel();
480482
$viewModelParent->setVariables([
481-
'layout' => 'zendview-layout',
483+
'layout' => 'zendview-layout',
482484
]);
483485
$viewModelParent->addChild($viewModelChild, 'name');
486+
484487
$result = $renderer->render('zendview', $viewModelParent);
485488

486-
$content = file_get_contents("$path/zendview-null.phtml");
487-
$contentParent = file_get_contents("$path/zendview.phtml");
488-
$contentParentLayout = file_get_contents("$path/zendview-layout.phtml");
489-
//trim is used here, because rendering engine is trimming content too
489+
$content = file_get_contents(sprintf('%s/zendview-null.phtml', $path));
490+
$contentParent = file_get_contents(sprintf('%s/zendview.phtml', $path));
491+
$contentParentLayout = file_get_contents(sprintf('%s/zendview-layout.phtml', $path));
492+
493+
// trim is used here, because rendering engine is trimming content too
490494
$content = trim(str_replace('<?php echo $name ?>', $content, $contentParent));
491495
$content = str_replace('<?= $this->content ?>', $content, $contentParentLayout);
496+
492497
$this->assertEquals($content, $result);
493498
}
494499
}

0 commit comments

Comments
 (0)