PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.6
Kubio AI Page Builder v2.8.6
2.9.0 2.8.6 2.8.5 2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / vendor / symfony / var-dumper / Command / Descriptor / CliDescriptor.php
kubio / vendor / symfony / var-dumper / Command / Descriptor Last commit date
CliDescriptor.php 1 year ago DumpDescriptorInterface.php 4 years ago HtmlDescriptor.php 4 years ago
CliDescriptor.php
80 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\VarDumper\Command\Descriptor;
13
14 use Symfony\Component\Console\Input\ArrayInput;
15 use Symfony\Component\Console\Output\OutputInterface;
16 use Symfony\Component\Console\Style\SymfonyStyle;
17 use Symfony\Component\VarDumper\Cloner\Data;
18 use Symfony\Component\VarDumper\Dumper\CliDumper;
19
20 /**
21 * Describe collected data clones for cli output.
22 *
23 * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
24 *
25 * @final
26 */
27 class CliDescriptor implements DumpDescriptorInterface
28 {
29 private $dumper;
30 private $lastIdentifier;
31
32 public function __construct(CliDumper $dumper)
33 {
34 $this->dumper = $dumper;
35 }
36
37 public function describe(OutputInterface $output, Data $data, array $context, int $clientId): void
38 {
39 $io = $output instanceof SymfonyStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
40 $this->dumper->setColors($output->isDecorated());
41
42 $rows = [['date', date('r', (int) $context['timestamp'])]];
43 $lastIdentifier = $this->lastIdentifier;
44 $this->lastIdentifier = $clientId;
45
46 $section = "Received from client #$clientId";
47 if (isset($context['request'])) {
48 $request = $context['request'];
49 $this->lastIdentifier = $request['identifier'];
50 $section = sprintf('%s %s', $request['method'], $request['uri']);
51 if ($controller = $request['controller']) {
52 $rows[] = ['controller', rtrim($this->dumper->dump($controller, true), "\n")];
53 }
54 } elseif (isset($context['cli'])) {
55 $this->lastIdentifier = $context['cli']['identifier'];
56 $section = '$ '.$context['cli']['command_line'];
57 }
58
59 if ($this->lastIdentifier !== $lastIdentifier) {
60 $io->section($section);
61 }
62
63 if (isset($context['source'])) {
64 $source = $context['source'];
65 $sourceInfo = sprintf('%s on line %d', $source['name'], $source['line']);
66 if ($fileLink = $source['file_link'] ?? null) {
67 $sourceInfo = sprintf('<href=%s>%s</>', $fileLink, $sourceInfo);
68 }
69 $rows[] = ['source', $sourceInfo];
70 $file = $source['file_relative'] ?? $source['file'];
71 $rows[] = ['file', $file];
72 }
73
74 $io->table([], $rows);
75
76 $this->dumper->dump($data);
77 $io->newLine();
78 }
79 }
80