Passed
Push — master ( 8b5b84...34c143 )
by IRFA
01:51
created

RateUp   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _itemDropUp() 0 4 1
A calc_rate() 0 13 3
1
<?php 
2
/* 
3
	Author:Irfa Ardiansyah <[email protected]>
4
	Simple Items Gatcha with PHP
5
*/
6
namespace Irfa\Gatcha\Roulette;
7
8
use Exception;
9
10
class RateUp {
11
12
	protected static function _itemDropUp($item_list, $items, $rate)
13
	{
14
		$rt = new RateUp();
15
		return $rt->calc_rate($item_list, $items, $rate);		
16
	}
17
	private function calc_rate($item_list, $items, $rate)
18
	{
19
		$item=[];
20
		if (is_array($items))
21
		{
22
			foreach ($items as $itm)
23
			{
24
				$item[$itm] = $item_list[$itm] * ($rate / 100);
25
			}
26
		} else {
27
				$item[$items] = $item_list[$items] * ($rate / 100);
28
		}
29
		return $item;
30
	}
31
}