@@ -26,6 +26,7 @@ protected function _getItemQtys()
2626 /**
2727 * Initialize shipment model instance
2828 *
29+ * @throws Exception
2930 * @throws Mage_Core_Exception
3031 * @return bool|Mage_Sales_Model_Order_Shipment
3132 */
@@ -110,6 +111,8 @@ protected function _saveShipment($shipment)
110111
111112 /**
112113 * Shipment information page
114+ *
115+ * @throws Mage_Core_Exception
113116 */
114117 public function viewAction ()
115118 {
@@ -143,6 +146,8 @@ public function startAction()
143146
144147 /**
145148 * Shipment create page
149+ *
150+ * @throws Mage_Core_Exception
146151 */
147152 public function newAction ()
148153 {
@@ -165,6 +170,8 @@ public function newAction()
165170 /**
166171 * Save shipment
167172 * We can save only new shipment. Existing shipments are not editable
173+ *
174+ * @throws Mage_Core_Exception
168175 */
169176 public function saveAction ()
170177 {
@@ -216,16 +223,16 @@ public function saveAction()
216223 $ this ->_getSession ()->addSuccess ($ isNeedCreateLabel ? $ shipmentCreatedMessage . ' ' . $ labelCreatedMessage
217224 : $ shipmentCreatedMessage );
218225 Mage::getSingleton ('adminhtml/session ' )->getCommentText (true );
219- } catch (Mage_Core_Exception $ e ) {
226+ } catch (Mage_Core_Exception $ mageCoreException ) {
220227 if ($ isNeedCreateLabel ) {
221228 $ responseAjax ->setError (true );
222- $ responseAjax ->setMessage ($ e ->getMessage ());
229+ $ responseAjax ->setMessage ($ mageCoreException ->getMessage ());
223230 } else {
224- $ this ->_getSession ()->addError ($ e ->getMessage ());
231+ $ this ->_getSession ()->addError ($ mageCoreException ->getMessage ());
225232 $ this ->_redirect ('*/*/new ' , ['order_id ' => $ this ->getRequest ()->getParam ('order_id ' )]);
226233 }
227- } catch (Exception $ e ) {
228- Mage::logException ($ e );
234+ } catch (Exception $ exception ) {
235+ Mage::logException ($ exception );
229236 if ($ isNeedCreateLabel ) {
230237 $ responseAjax ->setError (true );
231238 $ responseAjax ->setMessage (
@@ -264,8 +271,8 @@ public function emailAction()
264271
265272 $ this ->_getSession ()->addSuccess ($ this ->__ ('The shipment has been sent. ' ));
266273 }
267- } catch (Mage_Core_Exception $ e ) {
268- $ this ->_getSession ()->addError ($ e ->getMessage ());
274+ } catch (Mage_Core_Exception $ mageCoreException ) {
275+ $ this ->_getSession ()->addError ($ mageCoreException ->getMessage ());
269276 } catch (Exception ) {
270277 $ this ->_getSession ()->addError ($ this ->__ ('Cannot send shipment information. ' ));
271278 }
@@ -309,10 +316,10 @@ public function addTrackAction()
309316 'message ' => $ this ->__ ('Cannot initialize shipment for adding tracking number. ' ),
310317 ];
311318 }
312- } catch (Mage_Core_Exception $ e ) {
319+ } catch (Mage_Core_Exception $ mageCoreException ) {
313320 $ response = [
314321 'error ' => true ,
315- 'message ' => $ e ->getMessage (),
322+ 'message ' => $ mageCoreException ->getMessage (),
316323 ];
317324 } catch (Exception ) {
318325 $ response = [
@@ -438,10 +445,10 @@ public function addCommentAction()
438445
439446 $ this ->loadLayout (false );
440447 $ response = $ this ->getLayout ()->getBlock ('shipment_comments ' )->toHtml ();
441- } catch (Mage_Core_Exception $ e ) {
448+ } catch (Mage_Core_Exception $ mageCoreException ) {
442449 $ response = [
443450 'error ' => true ,
444- 'message ' => $ e ->getMessage (),
451+ 'message ' => $ mageCoreException ->getMessage (),
445452 ];
446453 $ response = Mage::helper ('core ' )->jsonEncode ($ response );
447454 } catch (Exception ) {
@@ -503,6 +510,9 @@ protected function _needToAddDummy($item, $qtys)
503510 /**
504511 * Create shipping label for specific shipment with validation.
505512 *
513+ * @throws Mage_Core_Exception
514+ * @throws Zend_Pdf_Exception
515+ * @throws Exception
506516 * @return bool
507517 */
508518 protected function _createShippingLabel (Mage_Sales_Model_Order_Shipment $ shipment )
@@ -564,11 +574,11 @@ public function createLabelAction()
564574 $ this ->_getSession ()->addSuccess (Mage::helper ('sales ' )->__ ('The shipping label has been created. ' ));
565575 $ response ->setOk (true );
566576 }
567- } catch (Mage_Core_Exception $ e ) {
577+ } catch (Mage_Core_Exception $ mageCoreException ) {
568578 $ response ->setError (true );
569- $ response ->setMessage ($ e ->getMessage ());
570- } catch (Exception $ e ) {
571- Mage::logException ($ e );
579+ $ response ->setMessage ($ mageCoreException ->getMessage ());
580+ } catch (Exception $ exception ) {
581+ Mage::logException ($ exception );
572582 $ response ->setError (true );
573583 $ response ->setMessage (Mage::helper ('sales ' )->__ ('An error occurred while creating shipping label. ' ));
574584 }
@@ -607,10 +617,10 @@ public function printLabelAction()
607617 'application/pdf ' ,
608618 );
609619 }
610- } catch (Mage_Core_Exception $ e ) {
611- $ this ->_getSession ()->addError ($ e ->getMessage ());
612- } catch (Exception $ e ) {
613- Mage::logException ($ e );
620+ } catch (Mage_Core_Exception $ mageCoreException ) {
621+ $ this ->_getSession ()->addError ($ mageCoreException ->getMessage ());
622+ } catch (Exception $ exception ) {
623+ Mage::logException ($ exception );
614624 $ this ->_getSession ()
615625 ->addError (Mage::helper ('sales ' )->__ ('An error occurred while creating shipping label. ' ));
616626 }
@@ -622,6 +632,9 @@ public function printLabelAction()
622632
623633 /**
624634 * Create pdf document with information about packages
635+ *
636+ * @throws Zend_Pdf_Exception
637+ * @throws Mage_Core_Exception
625638 */
626639 public function printPackageAction ()
627640 {
@@ -642,6 +655,8 @@ public function printPackageAction()
642655 /**
643656 * Batch print shipping labels for whole shipments.
644657 * Push pdf document with shipping labels to user browser
658+ *
659+ * @throws Zend_Pdf_Exception
645660 */
646661 public function massPrintShippingLabelAction ()
647662 {
@@ -700,6 +715,7 @@ public function massPrintShippingLabelAction()
700715 /**
701716 * Combine array of labels as instance PDF
702717 *
718+ * @throws Zend_Pdf_Exception
703719 * @return Zend_Pdf
704720 */
705721 protected function _combineLabelsPdf (array $ labelsContent )
@@ -726,6 +742,7 @@ protected function _combineLabelsPdf(array $labelsContent)
726742 * Create Zend_Pdf_Page instance with image from $imageString. Supports JPEG, PNG, GIF, WBMP, and GD2 formats.
727743 *
728744 * @param string $imageString
745+ * @throws Zend_Pdf_Exception
729746 * @return bool|Zend_Pdf_Page
730747 */
731748 protected function _createPdfPageFromImageString ($ imageString )
@@ -741,7 +758,7 @@ protected function _createPdfPageFromImageString($imageString)
741758
742759 imageinterlace ($ image , 0 );
743760 $ tmpFileName = sys_get_temp_dir () . DS . 'shipping_labels_ '
744- . uniqid (mt_rand ()) . time () . '.png ' ;
761+ . uniqid (( string ) mt_rand ()) . time () . '.png ' ;
745762 imagepng ($ image , $ tmpFileName );
746763 $ pdfImage = Zend_Pdf_Image::imageWithPath ($ tmpFileName );
747764 $ page ->drawImage ($ pdfImage , 0 , 0 , $ xSize , $ ySize );
@@ -752,6 +769,7 @@ protected function _createPdfPageFromImageString($imageString)
752769 /**
753770 * Return grid with shipping items for Ajax request
754771 *
772+ * @throws Mage_Core_Exception
755773 * @return Mage_Core_Controller_Response_Http
756774 */
757775 public function getShippingItemsGridAction ()
0 commit comments