From 7518d890e16ce53d67e2bf6c92e54169399a3c5c Mon Sep 17 00:00:00 2001
From: Dave Hall <skwashd@gmail.com>
Date: Sat, 18 Jun 2016 19:34:44 +1000
Subject: [PATCH] Issue #2751381 by skwashd: Fix issues found by
 PHP_CodeSniffer

---
 commerce_popup_cart.admin.inc           |  25 +++--
 css/cart-popup.css                      | 190 +++++++++++++++++---------------
 js/cart-popup.js                        |  47 ++++----
 theme/commerce_popup_cart_cart.tpl.php  |   8 +-
 theme/commerce_popup_cart_empty.tpl.php |  10 +-
 5 files changed, 157 insertions(+), 123 deletions(-)

diff --git a/commerce_popup_cart.admin.inc b/commerce_popup_cart.admin.inc
index 511ae64..3629039 100644
--- a/commerce_popup_cart.admin.inc
+++ b/commerce_popup_cart.admin.inc
@@ -1,6 +1,17 @@
 <?php
 
-function commerce_popup_cart_admin_form() {  
+/**
+ * @file
+ * Commerce Popup Cart module admin functions.
+ */
+
+/**
+ * Page callback for commerce popup cart configuration form.
+ *
+ * @return array
+ *   Structure of the configuration form.
+ */
+function commerce_popup_cart_admin_form() {
   $form['text'] = array(
     '#type' => 'fieldset',
     '#title' => t('Commerce Popup Cart Configuration'),
@@ -10,12 +21,12 @@ function commerce_popup_cart_admin_form() {
     '#title' => t('Empty Cart Message'),
     '#default_value' => variable_get('commerce_popup_cart_empty_cart_msg', 'Your cart is empty.'),
     '#description' => 'Enter the text to be displayed in the popup when the cart is empty.',
-  ); 
+  );
   $form['options']['commerce_popup_cart_show_empty_cart'] = array(
     '#type'  => 'checkbox',
-    '#title' => t('Show the cart icon when empty?'),    
-    '#default_value' => variable_get('commerce_popup_cart_show_empty_cart', 0),    
-    '#description' => t('When this option is enabled the cart icon will be displayed even if their is nothing in the cart.'),    
-  );  
+    '#title' => t('Show the cart icon when empty?'),
+    '#default_value' => variable_get('commerce_popup_cart_show_empty_cart', 0),
+    '#description' => t('When this option is enabled the cart icon will be displayed even if their is nothing in the cart.'),
+  );
   return system_settings_form($form);
-}
\ No newline at end of file
+}
diff --git a/css/cart-popup.css b/css/cart-popup.css
index 7a271cc..a263d38 100644
--- a/css/cart-popup.css
+++ b/css/cart-popup.css
@@ -1,138 +1,152 @@
-#block-commerce-popup-cart-commerce-popup-cart{
-  float:right;  
+/**
+ * @file
+ * Commerce Popup Cart stylesheet
+ */
+
+#block-commerce-popup-cart-commerce-popup-cart {
+  float: right;
 }
 
-#block-commerce-popup-cart-commerce-popup-cart .wrapper{
+#block-commerce-popup-cart-commerce-popup-cart .wrapper {
   position: relative;
 }
 
-#block-commerce-popup-cart-commerce-popup-cart a{
-  color:#333;
+#block-commerce-popup-cart-commerce-popup-cart a {
+  color: #333;
 }
 
-
-#block-commerce-popup-cart-commerce-popup-cart table{
-  margin:0;
-  font-size:12px;
+#block-commerce-popup-cart-commerce-popup-cart table {
+  margin: 0;
+  font-size: 12px;
   letter-spacing: -1px;
-  width:100%;
+  width: 100%;
 }
-#block-commerce-popup-cart-commerce-popup-cart table td{
-  background-color:#333;
+
+#block-commerce-popup-cart-commerce-popup-cart table td {
+  background-color: #333;
 }
-#block-commerce-popup-cart-commerce-popup-cart table td a{color:#fff;}
-#block-commerce-popup-cart-commerce-popup-cart .line-item-summary{
-  font-size:13px;
-  color:#fff;  
+
+#block-commerce-popup-cart-commerce-popup-cart table td a {
+  color: #fff;
 }
 
-#block-commerce-popup-cart-commerce-popup-cart:hover{
-  cursor:pointer;
+#block-commerce-popup-cart-commerce-popup-cart .line-item-summary {
+  font-size: 13px;
+  color: #fff;
 }
 
-.cart-icon{
-  float:left;
+#block-commerce-popup-cart-commerce-popup-cart: hover {
+  cursor: pointer;
 }
-.cart_popup_count{
+
+.cart-icon {
+  float: left;
+}
+
+.cart_popup_count {
   float: left;
   font-size: 16px;
   line-height: .85;
   margin-top: 5px;
-  margin-left:5px;
-  color:#555;
+  margin-left: 5px;
+  color: #555;
 }
 
 #cart-popup {
-    background: url("images/cart-nav-bg.png") repeat-x scroll 0 100% white;
-    border: 1px solid #D2D5D2;
-    margin: 0 0 10px 0;
-    padding: 10px 10px 40px 10px;
-    position: absolute;
-    right: 10px;
-    top: 55px;
-    z-index: 10000;
-    font-size:12px;
-    line-height:12px;
-    width:300px;
-  
-}
-#cart-popup  .view-footer .line-item-quantity,
-#cart-popup  .view-footer .line-item-total{display:none;}
-#cart-popup .view-commerce-cart-block ul.links li.line-item-summary-view-cart
-{
-  font-size:12px;
-} 
+  background: url("images/cart-nav-bg.png") repeat-x scroll 0 100% white;
+  border: 1px solid #d2d5d2;
+  margin: 0 0 10px 0;
+  padding: 10px 10px 40px 10px;
+  position: absolute;
+  right: 10px;
+  top: 55px;
+  z-index: 10000;
+  font-size: 12px;
+  line-height: 12px;
+  width: 300px;
+}
+
+#cart-popup .view-footer .line-item-quantity,
+#cart-popup .view-footer .line-item-total {
+  display: none;
+}
+
+
+#cart-popup .view-commerce-cart-block ul.links li.line-item-summary-view-cart {
+  font-size: 12px;
+}
 
 #cart-popup .views-field-product-attributes .field,
-#cart-popup .views-field-product-attributes .field-label{
-  font-size:10px;
+#cart-popup .views-field-product-attributes .field-label {
+  font-size: 10px;
 }
 
 .popup-arrow {
-    background: url("images/cart-popup-arrow.png") no-repeat scroll transparent;
-    height: 9px;
-    right: 30px;
-    top: -9px;
-    width: 17px;
-    position: absolute;
+  background: url("images/cart-popup-arrow.png") no-repeat scroll transparent;
+  height: 9px;
+  right: 30px;
+  top: -9px;
+  width: 17px;
+  position: absolute;
 }
 
-
-#cart-popup .line-item-summary .links {    
-    position: relative;
-    right: -10px;
-    top: 15px;
+#cart-popup .line-item-summary .links {
+  position: relative;
+  right: -10px;
+  top: 15px;
 }
 
 #cart-popup table th,
 #cart-popup table td {
-    border-color: #4B565C;
-    border-image: none;
-    border-style: solid solid none;
-    border-width: 1px 1px medium;
-    color: #FFFFFF;    
-    margin:0;
-    
+  border-color: #4b565c;
+  border-image: none;
+  border-style: solid solid none;
+  border-width: 1px 1px medium;
+  color: #fff;
+  margin: 0;
 }
 
-#cart-popup table{margin:0;}
+#cart-popup table {
+  margin: 0;
+}
 
-#cart-popup table td a{
-  color:#fff;
+#cart-popup table td a {
+  color: #fff;
 }
 
 #cart-popup table th a:link,
-#cart-popup table th a:visited{
-  color:#fff;
+#cart-popup table th a:visited {
+  color: #fff;
   text-decoration: underline;
 }
 
-#cart-popup table th.active{
-  background-color:#000;
+#cart-popup table th.active {
+  background-color: #000;
 }
 
-#cart-popup .line-item-summary-checkout a{  
-    background: url("images/cart-orange.png") repeat-x scroll;
-    color: #FFFFFF;    
-    font-weight: bold;
-    padding:3px;
-    overflow: hidden;
-    text-decoration: none;    
-    -webkit-border-radius: 5px;
-    -moz-border-radius: 5px;
-    border-radius: 5px;
-    border:1px solid #fff;
+#cart-popup .line-item-summary-checkout a {
+  background: url("images/cart-orange.png") repeat-x scroll;
+  color: #fff;
+  font-weight: bold;
+  padding: 3px;
+  overflow: hidden;
+  text-decoration: none;
+  -webkit-border-radius: 5px;
+  -moz-border-radius: 5px;
+  border-radius: 5px;
+  border: 1px solid #fff;
 }
 
-#cart-popup td{
-  padding:3px 6px;
+#cart-popup td {
+  padding: 3px 6px;
 }
-#cart-popup .view-footer{
-  margin:0 1em;
+
+#cart-popup .view-footer {
+  margin: 0 1em;
 }
 
-.cart-icon{
-  background: url("images/popup-cart-icon.png") no-repeat;  
-  width:50px;
-  height:50px;
+.cart-icon {
+  background: url("images/popup-cart-icon.png") no-repeat;
+  width: 50px;
+  height: 50px;
 }
diff --git a/js/cart-popup.js b/js/cart-popup.js
index 78af2ee..117e427 100644
--- a/js/cart-popup.js
+++ b/js/cart-popup.js
@@ -1,29 +1,26 @@
-(function ($, Drupal, window, document, undefined) {
+/**
+ * @file
+ * Commerce Popup Cart javascript functions.
+ */
 
-Drupal.behaviors.cartpopup_behavior = {
-  attach: function(context, settings) {
-    
-    // Shopping cart block contents
-    if ( $.isFunction($.fn.hoverIntent) ) {            
-      $("#block-commerce-popup-cart-commerce-popup-cart").hoverIntent({
-          sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
-          interval: 50,   // number = milliseconds of polling interval
-          over: function () {          
-              
-                var wrapper = $(this).find('#cart-popup');
-                wrapper.show();
-              
-        },  // function = onMouseOver callback (required)
-          timeout: 500,   // number = milliseconds delay before onMouseOut function call
+(function ($, Drupal, window, document, undefined) {
+  Drupal.behaviors.cartpopup_behavior = {
+    attach: function(context, settings) {
+      // Shopping cart block contents.
+      if ($.isFunction($.fn.hoverIntent)) {
+        $("#block-commerce-popup-cart-commerce-popup-cart").hoverIntent({
+          sensitivity: 7,
+          interval: 50,
+          over: function () {
+            var wrapper = $(this).find('#cart-popup');
+            wrapper.show();
+          },
+          timeout: 500,
           out: function () {
-             $('#cart-popup').hide();
-        }    // function = onMouseOut callback (required)
-      });
-    }           
-    
-
+            $('#cart-popup').hide();
+          }
+        });
+      }
+    }
   }
-};
-
-
 })(jQuery, Drupal, this, this.document);
diff --git a/theme/commerce_popup_cart_cart.tpl.php b/theme/commerce_popup_cart_cart.tpl.php
index 14137e5..bab4ceb 100644
--- a/theme/commerce_popup_cart_cart.tpl.php
+++ b/theme/commerce_popup_cart_cart.tpl.php
@@ -1,7 +1,13 @@
+<?php
+/**
+ * @file
+ * Shopping cart template.
+ */
+?>
 <div class="wrapper">
   <div class="cart-icon"></div>
   <span class="cart_popup_count"><?php print $product_count; ?></span>
   <div id="cart-popup" style="display:none;">
     <?php print theme('commerce_cart_block', $variables['variables']); ?>
     <div class="popup-arrow"></div></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/theme/commerce_popup_cart_empty.tpl.php b/theme/commerce_popup_cart_empty.tpl.php
index 0bef238..39869d1 100644
--- a/theme/commerce_popup_cart_empty.tpl.php
+++ b/theme/commerce_popup_cart_empty.tpl.php
@@ -1,7 +1,13 @@
+<?php
+/**
+ * @file
+ * Empty shopping cart template.
+ */
+?>
 <div class="wrapper">
   <div class="cart-icon"></div><span class="cart_popup_count"></span>
     <div id="cart-popup" style="display:none;">
       <?php print $empty_cart_message; ?>
     <div class="popup-arrow"></div>
-  </div>   
-</div>
\ No newline at end of file
+  </div>
+</div>
-- 
2.9.0

