for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the hogosha-monitor package
*
* Copyright (c) 2016 Guillaume Cavana
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* Feel free to edit as you please, and have fun.
* @author Guillaume Cavana <[email protected]>
*/
namespace Hogosha\Monitor\Renderer;
use Hogosha\Monitor\Monitor;
use Webmozart\Console\Api\IO\IO;
/**
class RendererFactory
{
* create.
* @param string $type
* @param IO $io
* @return RendererInterface
public static function create($type, IO $io)
switch ($type) {
case Monitor::RENDERER_TYPE_TABLE:
return new TableRenderer($io);
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case Monitor::RENDERER_TYPE_CSV:
return new CsvRenderer($io);
default:
return new ListRenderer($io);
}
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.