Replace magic numbers with constants (#754)

* Replace magic numbers with constants
This commit is contained in:
Lance Pioch 2017-11-12 18:16:54 -05:00 committed by Dane Everitt
parent 6043114f38
commit f94e4c15b0
3 changed files with 10 additions and 3 deletions

View file

@ -18,6 +18,9 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
{
use Searchable;
const THRESHOLD_PERCENTAGE_LOW = 75;
const THRESHOLD_PERCENTAGE_MEDIUM = 90;
/**
* {@inheritdoc}
*/
@ -56,7 +59,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
'value' => number_format($value),
'max' => number_format($maxUsage),
'percent' => $percent,
'css' => ($percent <= 75) ? 'green' : (($percent > 90) ? 'red' : 'yellow'),
'css' => ($percent <= self::THRESHOLD_PERCENTAGE_LOW) ? 'green' : (($percent > self::THRESHOLD_PERCENTAGE_MEDIUM) ? 'red' : 'yellow'),
],
];
})