芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/vendor/laravel/tinker/ConfigShowCommand.php
argument('config'); if (! config()->has($config)) { $this->components->error("Configuration file `{$config}` does not exist."); return Command::FAILURE; } $this->newLine(); $this->render($config); $this->newLine(); return Command::SUCCESS; } /** * Render the configuration values. * * @param string $name * @return void */ public function render($name) { $data = config($name); if (! is_array($data)) { $this->title($name, $this->formatValue($data)); return; } $this->title($name); foreach (Arr::dot($data) as $key => $value) { $this->components->twoColumnDetail( $this->formatKey($key), $this->formatValue($value) ); } } /** * Render the title. * * @param string $title * @param string|null $subtitle * @return void */ public function title($title, $subtitle = null) { $this->components->twoColumnDetail( "
{$title}>", $subtitle, ); } /** * Format the given configuration key. * * @param string $key * @return string */ protected function formatKey($key) { return preg_replace_callback( '/(.*)\.(.*)$/', fn ($matches) => sprintf( '
%s ⇁> %s', str_replace('.', ' ⇁ ', $matches[1]), $matches[2] ), $key ); } /** * Format the given configuration value. * * @param mixed $value * @return string */ protected function formatValue($value) { return match (true) { is_bool($value) => sprintf('
%s>', $value ? 'true' : 'false'), is_null($value) => '
null>', is_numeric($value) => "
{$value}>", is_array($value) => '[]', is_object($value) => get_class($value), is_string($value) => $value, default => print_r($value, true), }; } }