1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58:
<?php
namespace Webmozart\Console\UI\Component;
use Webmozart\Console\Api\Config\ApplicationConfig;
use Webmozart\Console\Api\IO\IO;
use Webmozart\Console\UI\Component;
class NameVersion implements Component
{
private $config;
public function __construct(ApplicationConfig $config)
{
$this->config = $config;
}
public function render(IO $io, $indentation = 0)
{
if ($this->config->getDisplayName() && $this->config->getVersion()) {
$paragraph = new Paragraph("{$this->config->getDisplayName()} version <c1>{$this->config->getVersion()}</c1>");
} elseif ($this->config->getDisplayName()) {
$paragraph = new Paragraph("{$this->config->getDisplayName()}");
} else {
$paragraph = new Paragraph('Console Tool');
}
$paragraph->render($io, $indentation);
}
}