-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathFormatterContainer.php
More file actions
39 lines (32 loc) · 888 Bytes
/
FormatterContainer.php
File metadata and controls
39 lines (32 loc) · 888 Bytes
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
<?php
namespace IonBazan\ComposerDiff\Formatter;
use Symfony\Component\Console\Output\OutputInterface;
class FormatterContainer
{
const DEFAULT_FORMATTER = 'mdtable';
/**
* @var array<string, Formatter>
*/
private $formatters;
public function __construct(OutputInterface $output)
{
$this->formatters = array(
'mdtable' => new MarkdownTableFormatter($output),
'mdlist' => new MarkdownListFormatter($output),
'github' => new GitHubFormatter($output),
'json' => new JsonFormatter($output),
);
}
/**
* @param string $name
*
* @return Formatter
*/
public function getFormatter($name)
{
if (!isset($this->formatters[$name])) {
return $this->formatters[self::DEFAULT_FORMATTER];
}
return $this->formatters[$name];
}
}