/** * @test */ public function descendAllKeepsArrayIndexes() { $array = array(array('name' => 'Foo', 'secret' => TRUE), array('name' => 'Bar', 'secret' => TRUE)); $this->view->assign('value', $array); $this->view->setConfiguration(array('value' => array('_descendAll' => array('_descendAll' => array())))); $expectedResult = '[{"name":"Foo","secret":true},{"name":"Bar","secret":true}]'; $actualResult = $this->view->render(); $this->assertEquals($expectedResult, $actualResult); }
/** * @inheritdoc * @return string */ public function render() { if (count($this->variablesToRender) === 1) { $variableName = current($this->variablesToRender); $valueToRender = isset($this->variables[$variableName]) ? $this->variables[$variableName] : null; if ($valueToRender instanceof \JsonSerializable) { return json_encode($valueToRender); } } return parent::render(); }
/** * Show update comments for extensions that can be updated. * Fetches update comments for all versions between the current * installed and the highest version. * * @return void */ protected function updateCommentForUpdatableVersionsAction() { $extensionKey = $this->request->getArgument('extension'); $versionStart = $this->request->getArgument('integerVersionStart'); $versionStop = $this->request->getArgument('integerVersionStop'); $updateComments = []; /** @var Extension[] $updatableVersions */ $updatableVersions = $this->extensionRepository->findByVersionRangeAndExtensionKeyOrderedByVersion($extensionKey, $versionStart, $versionStop, false); $highestPossibleVersion = false; foreach ($updatableVersions as $updatableVersion) { if ($highestPossibleVersion === false) { $highestPossibleVersion = $updatableVersion->getVersion(); } $updateComments[$updatableVersion->getVersion()] = $updatableVersion->getUpdateComment(); } $this->view->assign('value', ['updateComments' => $updateComments, 'url' => $this->uriBuilder->uriFor('updateExtension', ['extension' => $extensionKey, 'version' => $highestPossibleVersion])]); }
/** * Action List * * @return void */ public function listAction() { $this->view->setVariablesToRender([$this->resourceArgumentName . 's']); $this->view->assign($this->resourceArgumentName . 's', $this->resourceRepository->findAll()); }