-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigProperties.php
More file actions
50 lines (46 loc) · 1.32 KB
/
Copy pathConfigProperties.php
File metadata and controls
50 lines (46 loc) · 1.32 KB
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
<?php
/**
* Arikaim
*
* @link http://www.arikaim.com
* @copyright Copyright (c) Intersoft <info@arikaim.com>
* @license http://www.arikaim.com/license
*
*/
namespace Arikaim\Core\Console;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\Table;
use Arikaim\Core\Collection\PropertiesFactory;
use Arikaim\Core\Collection\Interfaces\PropertiesInterface;
/**
* Config properties console helper
*/
class ConfigProperties
{
/**
* Create console table
*
* @param PropertiesInterface|array $properties
* @param OutputInterface $output
* @return Table
*/
public static function createPropertiesTable($properties, $output): Table
{
if (\is_array($properties) == true) {
$properties = PropertiesFactory::createFromArray($properties);
}
$table = new Table($output);
$table->setHeaders(['Key','Title','Value','Default']);
$table->setStyle('compact');
foreach($properties as $item) {
$row = [
$item['name'],
$item['title'],
$item['value'],
$item['default']
];
$table->addRow($row);
}
return $table;
}
}