1 | <?php |
||
7 | trait HasLicenses |
||
8 | { |
||
9 | /** |
||
10 | * Attempt to allocate unused licenses. |
||
11 | * |
||
12 | * @param string $class The License class you want to work with |
||
13 | * @param int $quantity The amount of licenses you want to attempt to use |
||
14 | * @param boolean $add If true then it will increase the maximum available licenses |
||
15 | * @return self |
||
16 | */ |
||
17 | public function licensesAllocate($class, $quantity, $add = false) |
||
23 | |||
24 | /** |
||
25 | * Returns the amount of unused licenses. |
||
26 | * |
||
27 | * @param string $class The License class you want to work with |
||
28 | * @return int |
||
29 | */ |
||
30 | public function licensesRemaining($class) |
||
35 | |||
36 | /** |
||
37 | * Returns the amount of used licenses |
||
38 | * |
||
39 | * @param string $class The License class you want to work with |
||
40 | * @return int |
||
41 | */ |
||
42 | public function licensesUsed($class) |
||
47 | |||
48 | /** |
||
49 | * Increase the maximum amount of licenses |
||
50 | * |
||
51 | * @param string $class The License class you want to work with |
||
52 | * @param integer $quantity |
||
53 | * @return self |
||
54 | */ |
||
55 | public function licensesAdd($class, $quantity = 1) |
||
62 | |||
63 | /** |
||
64 | * Decreases the maximum amount of licenses available |
||
65 | * |
||
66 | * @param string $class The License class you want to work with |
||
67 | * @param integer $quantity |
||
68 | * @return self |
||
69 | */ |
||
70 | public function licensesSub($class, $quantity = 1) |
||
77 | |||
78 | /** |
||
79 | * Sets the maximum amount of licenses to a specific value |
||
80 | * |
||
81 | * @param string $class The License class you want to work with |
||
82 | * @param integer $quantity |
||
83 | * @return self |
||
84 | */ |
||
85 | public function licensesSet($class, $quantity) |
||
92 | |||
93 | /** |
||
94 | * Creates an instance of License from the supplied classname string |
||
95 | * |
||
96 | * @param string $class The License class you want to work with |
||
97 | * @return License |
||
98 | */ |
||
99 | private function getLicenseInstance($class) |
||
107 | } |
||
108 |