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

Roll   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A put() 0 5 1
A spin() 0 3 1
A getItem() 0 4 1
A dropUp() 0 5 1
A putDropUp() 0 5 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
	private static $return;
0 ignored issues
show
introduced by
The private property $return is not used, and could be removed.
Loading history...
15
16
	public static function put($items)
17
	{
18
		self::$items = $items;
19
20
		return new static();
21
	}
22
	public static function spin() 
23
	{
24
		return self::getItem();
25
	}
26
	public static function dropUp($items, $rate)
27
	{
28
		$items_bucket = self::$items;
29
		self::putDropUp(self::itemDropUp($items_bucket, $items, $rate));
30
		return new static();
31
	}
32
	private static function getItem() {
33
		$ret = self::get(self::$items);
34
		self::$items = null;
35
		return $ret;
36
	}
37
	private static function putDropUp($arr){
38
		foreach($arr as $k => $v){
39
			self::$items[$k] = $v;
40
		}
41
		var_dump(self::$items);
0 ignored issues
show
Security Debugging Code introduced by
var_dump(self::items) looks like debug code. Are you sure you do not want to remove it?
Loading history...
42
	}
43
	
44
}