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

RateUp::_itemDropUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 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
}