Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
srenon committed May 5, 2020
1 parent 480aa6e commit 48079aa
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 162 deletions.
6 changes: 1 addition & 5 deletions Block/Adminhtml/System/Config/Form/Composer/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Filesystem\Directory\ReadFactory;

/**
* Class Version
* @package MagePal\GoogleTagManager\Block\Adminhtml\System\Config\Form\Composer
*/
class Version extends Field
{

Expand Down Expand Up @@ -115,7 +111,7 @@ public function getComposerVersion($moduleName)
return !empty($data->version) ? $data->version : __('Unknown');
}
} catch (Exception $e) {
//
return 'Unknown';
}

return 'Unknown';
Expand Down
10 changes: 0 additions & 10 deletions Block/Adminhtml/System/Config/Form/Field/ItemVariantFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,10 @@

use Magento\Framework\Option\ArrayInterface;

/**
* Class ItemVariantFormat
* @package MagePal\GoogleTagManager\Block\Adminhtml\System\Config\Form\Field
*/
class ItemVariantFormat implements ArrayInterface
{
/**
* Short format
*/
const SHORT_FORMAT = 1;

/**
* long format
*/
const LONG_FORMAT = 2;

const DEFAULT_FORMAT = self::SHORT_FORMAT;
Expand Down
76 changes: 0 additions & 76 deletions Block/Adminhtml/System/Config/Form/Module/Version.php

This file was deleted.

4 changes: 0 additions & 4 deletions Block/Data/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
use MagePal\GoogleTagManager\Model\Cart as GtmCartModel;
use MagePal\GoogleTagManager\Model\DataLayerEvent;

/**
* Class Cart
* @package MagePal\GoogleTagManager\Block\Data
*/
class Cart extends Template
{

Expand Down
4 changes: 0 additions & 4 deletions Block/Data/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
use MagePal\GoogleTagManager\DataLayer\CategoryData\CategoryProvider;
use MagePal\GoogleTagManager\Model\DataLayerEvent;

/**
* Class Category
* @package MagePal\GoogleTagManager\Block\Data
*/
class Category extends Template
{
/**
Expand Down
4 changes: 0 additions & 4 deletions Block/Data/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
use MagePal\GoogleTagManager\Model\Cart as GtmCartModel;
use MagePal\GoogleTagManager\Model\DataLayerEvent;

/**
* Class Checkout
* @package MagePal\GoogleTagManager\Block\Data
*/
class Checkout extends Template
{

Expand Down
4 changes: 0 additions & 4 deletions Block/Data/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
use MagePal\GoogleTagManager\Block\DataLayer;
use MagePal\GoogleTagManager\Model\Customer as GtmCustomerModel;

/**
* Class Customer
* @package MagePal\GoogleTagManager\Block\Data
*/
class Customer extends Template
{
/**
Expand Down
2 changes: 0 additions & 2 deletions Block/Data/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
use MagePal\GoogleTagManager\Block\DataLayer;

/**
* Class Order
* @package MagePal\GoogleTagManager\Block\Data
* @method Array setOrderIds(Array $orderIds)
* @method Array getOrderIds()
*/
Expand Down
8 changes: 2 additions & 6 deletions Block/DataLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
use MagePal\GoogleTagManager\Block\Data\Order;
use MagePal\GoogleTagManager\Model\Config\Source\GdprOption;

/**
* Class DataLayer
* @package MagePal\GoogleTagManager\Block
*/
class DataLayer extends DataLayerAbstract
{

Expand Down Expand Up @@ -72,7 +68,7 @@ public function getCookieRestrictionName($store_id = null)

/**
* @param null $store_id
* @return bool
* @return int
*/
public function isGdprEnabled($store_id = null)
{
Expand All @@ -81,7 +77,7 @@ public function isGdprEnabled($store_id = null)

/**
* @param null $store_id
* @return bool
* @return int
*/
public function addJsInHead($store_id = null)
{
Expand Down
6 changes: 2 additions & 4 deletions Block/DataLayerAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use MagePal\GoogleTagManager\Helper\Data as GtmHelper;

/**
* Class DataLayerAbstract
* @package MagePal\GoogleTagManager\Block
* @method getList()
*/
class DataLayerAbstract extends Template
Expand Down Expand Up @@ -247,7 +245,7 @@ public function getDataLayerName()
}

/**
* @return mixed
* @return string
* @throws NoSuchEntityException
*/
public function getStoreCurrencyCode()
Expand All @@ -258,7 +256,7 @@ public function getStoreCurrencyCode()
/**
* Return cookie restriction mode value.
*
* @return bool
* @return int
*/
public function isCookieRestrictionModeEnabled()
{
Expand Down
5 changes: 0 additions & 5 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;

/**
* Class Data
* @package MagePal\GoogleTagManager\Helper
*/
class Data extends AbstractHelper
{
/**
Expand Down Expand Up @@ -103,7 +99,6 @@ public function getGdprOption($store_id = null)
);
}


/**
* @param null $store_id
* @return int
Expand Down
4 changes: 0 additions & 4 deletions Helper/DataLayerItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
use Magento\Store\Model\ScopeInterface;
use MagePal\GoogleTagManager\Block\Adminhtml\System\Config\Form\Field\ItemVariantFormat;

/**
* Class Item
* @package MagePal\GoogleTagManager\Helper
*/
class DataLayerItem extends Data
{
/**
Expand Down
4 changes: 0 additions & 4 deletions Helper/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\UrlInterface;

/**
* Class Product
* @package MagePal\GoogleTagManager\Helper
*/
class Product extends AbstractHelper
{

Expand Down
5 changes: 0 additions & 5 deletions Model/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
use MagePal\GoogleTagManager\DataLayer\QuoteData\QuoteProvider;
use MagePal\GoogleTagManager\Helper\DataLayerItem as dataLayerItemHelper;

/**
* Class Cart
* @package MagePal\GoogleTagManager\Model
*/
class Cart extends DataObject
{

Expand Down Expand Up @@ -94,7 +90,6 @@ public function getCart()

if ($quote->getItemsCount()) {
$items = [];
/** @var Item $item */
foreach ($quote->getAllVisibleItems() as $item) {
$itemData = [
'sku' => $item->getSku(),
Expand Down
4 changes: 0 additions & 4 deletions Model/Config/Source/GdprOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@

use Magento\Framework\Option\ArrayInterface;

/**
* Class GdprType
* @package MagePal\GmailSmtpApp\Model\Config\Source
*/
class GdprOption implements ArrayInterface
{
const USE_COOKIE_RESTRICTION_MODE = 1;
Expand Down
4 changes: 0 additions & 4 deletions Model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use Magento\Customer\Model\Session;
use Magento\Framework\DataObject;

/**
* Class Customer
* @package MagePal\GoogleTagManager\Model
*/
class Customer extends DataObject
{

Expand Down
4 changes: 0 additions & 4 deletions Model/DataLayerEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

namespace MagePal\GoogleTagManager\Model;

/**
* Class DataLayerEvent
* @package MagePal\GoogleTagManager\Model
*/
class DataLayerEvent
{
const ADD_TO_CART_EVENT = 'addToCart';
Expand Down
6 changes: 1 addition & 5 deletions Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
use MagePal\GoogleTagManager\Helper\DataLayerItem;

/**
* Class Order
* @package MagePal\GoogleTagManager\Model
* @method $this setOrderIds(Array $orderIds)
* @method Array getOrderIds()
*/
Expand Down Expand Up @@ -249,7 +247,7 @@ public function getOrderDataLayer(SalesOrder $order)
->getData();
}

$transaction = [
return [
'order_id' => $order->getIncrementId(),
'store_name' => $this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
'total' => $this->gtmHelper->formatPrice($order->getBaseGrandTotal()),
Expand All @@ -265,8 +263,6 @@ public function getOrderDataLayer(SalesOrder $order)
'is_guest_checkout' => $order->getCustomerIsGuest() ? true : false,
'items' => $products
];

return $transaction;
}

/**
Expand Down
4 changes: 0 additions & 4 deletions Observer/Frontend/OrderSuccessPageViewObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use Magento\Framework\Event\Observer as EventObserver;
use Magento\Framework\Event\ObserverInterface;

/**
* Class OrderSuccessPageViewObserver
* @package MagePal\GoogleTagManager\Observer\Frontend
*/
class OrderSuccessPageViewObserver implements ObserverInterface
{
/**
Expand Down
4 changes: 0 additions & 4 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@
</style>
]]>
</comment>
<field id="module_version" translate="label" type="label" sortOrder="0" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Module Version</label>
<frontend_model>MagePal\GoogleTagManager\Block\Adminhtml\System\Config\Form\Module\Version</frontend_model>
</field>
<field id="composer_version" translate="label" type="label" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Composer Version</label>
<frontend_model>MagePal\GoogleTagManager\Block\Adminhtml\System\Config\Form\Composer\Version</frontend_model>
Expand Down

0 comments on commit 48079aa

Please sign in to comment.