comparison vendor/psy/psysh/src/Command/ListCommand.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
176 if ($result === null) { 176 if ($result === null) {
177 return; 177 return;
178 } 178 }
179 179
180 foreach ($result as $label => $items) { 180 foreach ($result as $label => $items) {
181 $names = array_map([$this, 'formatItemName'], $items); 181 $names = \array_map([$this, 'formatItemName'], $items);
182 $output->writeln(sprintf('<strong>%s</strong>: %s', $label, implode(', ', $names))); 182 $output->writeln(\sprintf('<strong>%s</strong>: %s', $label, \implode(', ', $names)));
183 } 183 }
184 } 184 }
185 185
186 /** 186 /**
187 * Write the list items to $output. 187 * Write the list items to $output.
199 199
200 $table = $this->getTable($output); 200 $table = $this->getTable($output);
201 201
202 foreach ($result as $label => $items) { 202 foreach ($result as $label => $items) {
203 $output->writeln(''); 203 $output->writeln('');
204 $output->writeln(sprintf('<strong>%s:</strong>', $label)); 204 $output->writeln(\sprintf('<strong>%s:</strong>', $label));
205 205
206 $table->setRows([]); 206 $table->setRows([]);
207 foreach ($items as $item) { 207 foreach ($items as $item) {
208 $table->addRow([$this->formatItemName($item), $item['value']]); 208 $table->addRow([$this->formatItemName($item), $item['value']]);
209 } 209 }
223 * 223 *
224 * @return string 224 * @return string
225 */ 225 */
226 private function formatItemName($item) 226 private function formatItemName($item)
227 { 227 {
228 return sprintf('<%s>%s</%s>', $item['style'], OutputFormatter::escape($item['name']), $item['style']); 228 return \sprintf('<%s>%s</%s>', $item['style'], OutputFormatter::escape($item['name']), $item['style']);
229 } 229 }
230 230
231 /** 231 /**
232 * Validate that input options make sense, provide defaults when called without options. 232 * Validate that input options make sense, provide defaults when called without options.
233 * 233 *