Test Failed
Push — master ( 7454bf...877323 )
by Gianluca
14:23 queued 07:38
created
src/Libraries/Template.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
 class Template
17 17
 {
18
-    public static function getStructureCategories(){
18
+    public static function getStructureCategories() {
19 19
 
20 20
         $categories = Category::with('children')->whereNull('parent_id')->get();
21 21
         $tree = [];
22
-        foreach($categories as $category){
22
+        foreach ($categories as $category) {
23 23
             $tree[] = [
24 24
                 'id' => $category->id,
25 25
                 'text' => $category->name,
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
         return $tree;
31 31
     }
32 32
 
33
-    private static function recursiveChildren($childrens){
33
+    private static function recursiveChildren($childrens) {
34 34
         $childs = [];
35
-        foreach ($childrens as $children){
35
+        foreach ($childrens as $children) {
36 36
             $childs[] = [
37 37
                 'id' => $children->id,
38 38
                 'text' => $children->name,
@@ -48,34 +48,34 @@  discard block
 block discarded – undo
48 48
      * @param Int $id
49 49
      * @return Product
50 50
      */
51
-    public static function getProducts($id = null){
52
-        if($id === null){
51
+    public static function getProducts($id = null) {
52
+        if ($id === null) {
53 53
             $products = Product::all();
54
-        }else{
54
+        } else {
55 55
             $products = Category::find($id)->products;
56 56
         }
57 57
         return $products;
58 58
     }
59 59
 
60
-    public static function getDetailsFields(Product $product,$product_item_id){
60
+    public static function getDetailsFields(Product $product, $product_item_id) {
61 61
         $element = '<div class="row">';
62 62
 
63
-        foreach($product->details->groupBy('product_detail_id') as $key => $details){
63
+        foreach ($product->details->groupBy('product_detail_id') as $key => $details) {
64 64
 
65
-            $element.= self::generateDetailHtml(Detail::find($key),$details->groupBy('product_detail_value_id'),$product->id,$product_item_id);
65
+            $element .= self::generateDetailHtml(Detail::find($key), $details->groupBy('product_detail_value_id'), $product->id, $product_item_id);
66 66
         }
67
-        $element.= '<p class="show_error_product" style="color: red; display: none;">Prodotto non disponibile</p>';
67
+        $element .= '<p class="show_error_product" style="color: red; display: none;">Prodotto non disponibile</p>';
68 68
         $element .= '</div>';
69 69
         return $element;
70 70
     }
71 71
 
72
-    public static function generateHtmlField($type,$value,$label){
73
-        if($type !== 'textarea'){
72
+    public static function generateHtmlField($type, $value, $label) {
73
+        if ($type !== 'textarea') {
74 74
             $html = '';
75 75
             $html .= "<label>{$label}</label>";
76 76
             $html .= "<input class='form-control' type='{$type}' value='{$value}'>";
77 77
             return $html;
78
-        }else{
78
+        } else {
79 79
             $html = '';
80 80
             $html .= "<label>{$label}</label>";
81 81
             $html .= "<textarea class='form-control'>{$value}</textarea>";
@@ -83,40 +83,40 @@  discard block
 block discarded – undo
83 83
         }
84 84
     }
85 85
 
86
-    public static function getConfigurationFields($product_item_id){
87
-        $configurationFields = ProductConfigurationField::where('product_item_id',$product_item_id)->get();
86
+    public static function getConfigurationFields($product_item_id) {
87
+        $configurationFields = ProductConfigurationField::where('product_item_id', $product_item_id)->get();
88 88
         $element = '';
89
-        foreach ($configurationFields as $field){
89
+        foreach ($configurationFields as $field) {
90 90
                 $element .= '<div class="row">';
91
-                $element .= self::generateHtmlField($field->field->type,$field->value,$field->field->name);
91
+                $element .= self::generateHtmlField($field->field->type, $field->value, $field->field->name);
92 92
                 $element .= '</div>';
93 93
             }
94 94
         return $element;
95 95
     }
96 96
 
97
-    public static function buttonCart($product_item_id){
97
+    public static function buttonCart($product_item_id) {
98 98
         return "<button onclick='addToCart(this)' data-product_item_id='{$product_item_id}' class='btn btn-primary mt-3'>Salva nel carrello</button>";
99 99
     }
100 100
 
101
-    public static function generateDetailHtml($detail,$values,$product_id,$product_item_id){
101
+    public static function generateDetailHtml($detail, $values, $product_id, $product_item_id) {
102 102
 
103 103
         $type = $detail->type;
104 104
         $html = '';
105
-        if($type === 'select'){
105
+        if ($type === 'select') {
106 106
             $html = '<label>'.$detail->name.'</label>';
107
-            $html .= '<select onchange="getVariationProduct()" data-product_id="'.$product_id.'" data-detail_id="'.$detail->id .'" class="form-control mongifield_into_product">';
107
+            $html .= '<select onchange="getVariationProduct()" data-product_id="'.$product_id.'" data-detail_id="'.$detail->id.'" class="form-control mongifield_into_product">';
108 108
             $selected = '';
109 109
 
110
-            $details = ProductItemDetail::where('product_item_id',$product_item_id)->get();
110
+            $details = ProductItemDetail::where('product_item_id', $product_item_id)->get();
111 111
             $filter = [];
112
-            foreach ($details as $_detail){
112
+            foreach ($details as $_detail) {
113 113
                 $filter[$_detail->product_detail_id] = $_detail->product_detail_value_id;
114 114
             }
115
-            foreach ($values as $detail_value_id =>$value){
116
-                if(isset($filter[$detail->id])){
117
-                    if($filter[$detail->id] == $detail_value_id){
115
+            foreach ($values as $detail_value_id =>$value) {
116
+                if (isset($filter[$detail->id])) {
117
+                    if ($filter[$detail->id] == $detail_value_id) {
118 118
                         $selected = 'selected';
119
-                    }else{
119
+                    } else {
120 120
                         $selected = '';
121 121
                     }
122 122
                 }
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
         return $html;
130 130
     }
131 131
 
132
-    public static function MoveSessionToCart($user_id){
132
+    public static function MoveSessionToCart($user_id) {
133 133
         $user = User::find($user_id);
134 134
         $elements_in_cart = session('cart');
135
-        if(!empty($elements_in_cart)){
136
-            if(Cart::where('user_id',$user->id)->count() <= 0){
137
-                foreach($elements_in_cart as $product_id => $count){
135
+        if (!empty($elements_in_cart)) {
136
+            if (Cart::where('user_id', $user->id)->count() <= 0) {
137
+                foreach ($elements_in_cart as $product_id => $count) {
138 138
                     $cart = new Cart();
139 139
                     $cart->user_id = $user->id;
140 140
                     $cart->product_item_id = $product_id;
Please login to merge, or discard this patch.
src/Http/Controllers/admin/AdminClientsController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
 
8 8
 class AdminClientsController extends Controller
9 9
 {
10
-    public function page(){
11
-        $clients = User::where('admin',false)->get();
12
-        return view('mongicommerce::admin.pages.clients',compact('clients'));
10
+    public function page() {
11
+        $clients = User::where('admin', false)->get();
12
+        return view('mongicommerce::admin.pages.clients', compact('clients'));
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
src/Http/Controllers/admin/AdminOrderDetailsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 
9 9
 class AdminOrderDetailsController
10 10
 {
11
-    public function page($order_id){
11
+    public function page($order_id) {
12 12
         $order = Order::find($order_id);
13 13
         $cliente = $order->user;
14 14
         $products = $order->products;
15 15
         $statuses = OrderStatus::all();
16
-        return view('mongicommerce::admin.pages.orders.order_details',compact('cliente','products','order','statuses'));
16
+        return view('mongicommerce::admin.pages.orders.order_details', compact('cliente', 'products', 'order', 'statuses'));
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
src/Http/Controllers/admin/DashboardController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 class DashboardController extends Controller
7 7
 {
8
-    public function page(){
8
+    public function page() {
9 9
         return view('mongicommerce::admin.pages.dashboard');
10 10
     }
11 11
 }
Please login to merge, or discard this patch.
src/Http/Controllers/admin/AdminOrdersController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
 
9 9
 class AdminOrdersController
10 10
 {
11
-    public function page(){
11
+    public function page() {
12 12
         $orders = Order::all();
13 13
         $statuses = OrderStatus::all();
14
-        return view('mongicommerce::admin.pages.orders.orders_list',['orders' => $orders,'statuses'=> $statuses]);
14
+        return view('mongicommerce::admin.pages.orders.orders_list', ['orders' => $orders, 'statuses'=> $statuses]);
15 15
     }
16 16
 }
Please login to merge, or discard this patch.
src/Http/Controllers/shop/ShopShipmentController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 class ShopShipmentController extends Controller
14 14
 {
15
-    public function page(){
15
+    public function page() {
16 16
         //if logged in
17 17
         $piva = '';
18 18
         $rag_soc = '';
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $province = '';
26 26
         $city = '';
27 27
         $cap = '';
28
-        if(Auth::check()){
28
+        if (Auth::check()) {
29 29
                 $user = Auth::user();
30 30
                 $piva = $user->piva;
31 31
                 $rag_soc = $user->company;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
                 Template::MoveSessionToCart($user->id);
42 42
         }
43 43
 
44
-        return view('mongicommerce.pages.shipment',compact(
44
+        return view('mongicommerce.pages.shipment', compact(
45 45
             'piva',
46 46
             'rag_soc',
47 47
             'first_name',
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
         $city = $r->get('city');
84 84
         $cap = $r->get('cap');
85 85
 
86
-        $user = User::where('email',$email_sped)->first();
86
+        $user = User::where('email', $email_sped)->first();
87 87
         //if user exist
88
-        if($user){
88
+        if ($user) {
89 89
                 $user->piva = $piva;
90 90
                 $user->company = $rag_soc;
91 91
                 $user->first_name = $first_name;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 $user->cap = $cap;
99 99
                 $user->save();
100 100
         //if user doesn't exist
101
-        }else{
101
+        } else {
102 102
             $user = new User();
103 103
             $user->piva = $piva;
104 104
             $user->company = $rag_soc;
Please login to merge, or discard this patch.
src/Http/Controllers/shop/DefaultController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 class DefaultController extends Controller
6 6
 {
7
-    public function page(){
7
+    public function page() {
8 8
         return view('mongicommerce.pages.default');
9 9
     }
10 10
 }
Please login to merge, or discard this patch.
src/Http/Controllers/shop/ShopOrdersController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 
7 7
 class ShopOrdersController extends Controller
8 8
 {
9
-    public function page(){
9
+    public function page() {
10 10
         $user = Auth::user();
11
-        $orders = Order::where('user_id',$user->id)->get();
12
-        return view('mongicommerce.pages.user_orders',compact('user','orders'));
11
+        $orders = Order::where('user_id', $user->id)->get();
12
+        return view('mongicommerce.pages.user_orders', compact('user', 'orders'));
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
src/Http/Controllers/shop/ShopUserController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class ShopUserController extends Controller
7 7
 {
8
-    public function page(){
8
+    public function page() {
9 9
         $user = Auth::user();
10 10
         $piva = $user->piva;
11 11
         $rag_soc = $user->company;
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $province = $user->province;
19 19
         $city = $user->city;
20 20
         $cap = $user->cap;
21
-        return view('mongicommerce.pages.user_settings',compact('piva',
21
+        return view('mongicommerce.pages.user_settings', compact('piva',
22 22
             'rag_soc',
23 23
             'first_name',
24 24
             'last_name',
Please login to merge, or discard this patch.