2
2
3
3
namespace Happypixels \Shopr \Cart ;
4
4
5
- use Illuminate \ Support \ Collection ;
5
+ use Happypixels \ Shopr \ Contracts \ Shoppable ;
6
6
use Happypixels \Shopr \Models \Order ;
7
7
use Happypixels \Shopr \Money \Formatter ;
8
- use Happypixels \ Shopr \ Contracts \ Shoppable ;
8
+ use Illuminate \ Support \ Collection ;
9
9
10
10
abstract class Cart
11
11
{
@@ -28,7 +28,7 @@ abstract public function persist($data);
28
28
*
29
29
* @return Collection
30
30
*/
31
- public function getAllItems () : Collection
31
+ public function getAllItems (): Collection
32
32
{
33
33
return collect ($ this ->get ());
34
34
}
@@ -38,7 +38,7 @@ public function getAllItems() : Collection
38
38
*
39
39
* @return Collection
40
40
*/
41
- public function items () : Collection
41
+ public function items (): Collection
42
42
{
43
43
return $ this ->getAllItems ()->filter (function ($ item ) {
44
44
return $ item ->shoppable ->isDiscount () === false ;
@@ -50,7 +50,7 @@ public function items() : Collection
50
50
*
51
51
* @return Collection
52
52
*/
53
- public function discounts () : Collection
53
+ public function discounts (): Collection
54
54
{
55
55
return $ this ->getAllItems ()->filter (function ($ item ) {
56
56
return $ item ->shoppable ->isDiscount () === true ;
@@ -62,7 +62,7 @@ public function discounts() : Collection
62
62
*
63
63
* @return Collection
64
64
*/
65
- public function relativeDiscounts () : Collection
65
+ public function relativeDiscounts (): Collection
66
66
{
67
67
return $ this ->discounts ()->filter (function ($ discount ) {
68
68
return ! $ discount ->shoppable ->is_fixed ;
@@ -203,7 +203,7 @@ public function addDiscount(Shoppable $coupon)
203
203
* @param string $code
204
204
* @return bool
205
205
*/
206
- public function hasDiscount ($ code = null ) : bool
206
+ public function hasDiscount ($ code = null ): bool
207
207
{
208
208
foreach ($ this ->discounts () as $ item ) {
209
209
if (! $ code ) {
@@ -290,7 +290,7 @@ public function convertToOrder($gateway, $data = [])
290
290
* @param float|null $price
291
291
* @return Happypixels\Shopr\Cart\CartItem
292
292
*/
293
- public function addItem ($ shoppableType , $ shoppableId , $ quantity = 1 , $ options = [], $ subItems = [], $ price = null ) : CartItem
293
+ public function addItem ($ shoppableType , $ shoppableId , $ quantity = 1 , $ options = [], $ subItems = [], $ price = null ): CartItem
294
294
{
295
295
$ quantity = (is_numeric ($ quantity ) && $ quantity > 0 ) ? $ quantity : 1 ;
296
296
0 commit comments