for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace EWW\Dpf\ViewHelpers;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
* The TYPO3 project - inspiring people to share!
*/
use EWW\Dpf\Domain\Workflow\DocumentWorkflow;
class GetStatusColorViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
{
/**
* Gets the related color for alias states.
* @param string $status
* @return string
public function render($status)
$aliasState = DocumentWorkflow::getAliasStateByLocalOrRepositoryState($status);
switch ($aliasState) {
case DocumentWorkflow::ALIAS_STATE_NEW:
return 'secondary';
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
return
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
case DocumentWorkflow::ALIAS_STATE_REGISTERED:
case DocumentWorkflow::ALIAS_STATE_IN_PROGRESS:
return 'primary';
case DocumentWorkflow::ALIAS_STATE_RELEASED:
return 'success';
case DocumentWorkflow::ALIAS_STATE_DISCARDED:
return 'warning';
case DocumentWorkflow::ALIAS_STATE_POSTPONED:
return 'info';
default:
return 'light';
}
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.