Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7451571
PrinterFactory.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PrinterFactory.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Phan\Output
;
use
Phan\Output\Printer\CheckstylePrinter
;
use
Phan\Output\Printer\CodeClimatePrinter
;
use
Phan\Output\Printer\CSVPrinter
;
use
Phan\Output\Printer\HTMLPrinter
;
use
Phan\Output\Printer\JSONPrinter
;
use
Phan\Output\Printer\PlainTextPrinter
;
use
Phan\Output\Printer\PylintPrinter
;
use
Phan\Output\Printer\VerbosePlainTextPrinter
;
use
Symfony\Component\Console\Output\OutputInterface
;
/**
* Class PrinterFactory
* Subject of future refactoring to be a bit more extensible
*/
class
PrinterFactory
{
/**
* @return list<string> the supported types of Printers
*/
public
function
getTypes
():
array
{
return
[
'text'
,
'verbose'
,
'json'
,
'csv'
,
'codeclimate'
,
'checkstyle'
,
'pylint'
,
'html'
];
}
/**
* Return an IssuePrinterInterface of type $type that outputs issues to $output
* @param ?string $type the configured type of printer
*/
public
function
getPrinter
(?
string
$type
,
OutputInterface
$output
):
IssuePrinterInterface
{
switch
(
$type
)
{
case
'codeclimate'
:
$printer
=
new
CodeClimatePrinter
();
break
;
case
'json'
:
$printer
=
new
JSONPrinter
();
break
;
case
'checkstyle'
:
$printer
=
new
CheckstylePrinter
();
break
;
case
'csv'
:
$printer
=
new
CSVPrinter
();
break
;
case
'pylint'
:
$printer
=
new
PylintPrinter
();
break
;
case
'html'
:
$printer
=
new
HTMLPrinter
();
break
;
case
'verbose'
:
$printer
=
new
VerbosePlainTextPrinter
();
break
;
case
'text'
:
default
:
$printer
=
new
PlainTextPrinter
();
break
;
}
$printer
->
configureOutput
(
$output
);
return
$printer
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 21:31 (2 d, 3 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c7/60/a9bf54177146a37104f3903fc682
Default Alt Text
PrinterFactory.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment