Passed
Push — master ( 08b4be...8d11b6 )
by IRFA
01:57 queued 10s
created

Roll   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 15
c 3
b 0
f 0
dl 0
loc 33
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A put() 0 5 1
A spin() 0 3 1
A getItem() 0 4 1
A jsonSpin() 0 4 1
A dropUp() 0 5 1
A putDropUp() 0 3 2
1
<?php 
2
/* 
3
	Author:Irfa Ardiansyah <[email protected]>
4
	Simple Items Gatcha with PHP
5
*/
6
namespace Irfa\Gatcha;
7
8
use Irfa\Gatcha\Roulette\Roulette;
9
use Exception;
10
11
class Roll extends Roulette {
12
13
	private static $items;
14
15
	public static function put($items)
16
	{
17
		self::$items = $items;
18
19
		return new static();
20
	}
21
	public static function spin() 
22
	{
23
		return self::getItem();
24
	}
25
	public static function jsonSpin() 
26
	{
27
		$ret = self::getItem();
28
		return self::jsonItem($ret);
29
	}
30
	public static function dropUp($items, $rate)
31
	{
32
		$items_bucket = self::$items;
33
		self::putDropUp(self::itemDropUp($items_bucket, $items, $rate));
34
		return new static();
35
	}
36
	private static function getItem() {
37
		$ret = self::get(self::$items);
38
		self::$items = null;
39
		return $ret;
40
	}
41
	private static function putDropUp($arr) {
42
		foreach ($arr as $k => $v) {
43
			self::$items[$k] = $v;
44
		}
45
	}
46
	
47
}