Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
haitv282 committed Feb 25, 2019
1 parent 890e3d2 commit a955b92
Show file tree
Hide file tree
Showing 170 changed files with 1,238 additions and 1,000 deletions.
6 changes: 3 additions & 3 deletions Block/Adminhtml/Author/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Edit extends Container

/**
* Edit constructor.
*
* @param \Magento\Backend\Block\Widget\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param array $data
Expand All @@ -46,8 +47,7 @@ public function __construct(
Context $context,
Registry $coreRegistry,
array $data = []
)
{
) {
$this->coreRegistry = $coreRegistry;

parent::__construct($context, $data);
Expand All @@ -60,7 +60,7 @@ public function __construct(
*/
protected function _construct()
{
$this->_objectId = 'user_id';
$this->_objectId = 'user_id';
$this->_blockGroup = 'Mageplaza_Blog';
$this->_controller = 'adminhtml_author';

Expand Down
8 changes: 4 additions & 4 deletions Block/Adminhtml/Author/Edit/Tab/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Author extends Generic implements TabInterface

/**
* Author constructor.
*
* @param Config $wysiwygConfig
* @param Store $systemStore
* @param Context $context
Expand All @@ -70,11 +71,10 @@ public function __construct(
FormFactory $formFactory,
ImageHelper $imageHelper,
array $data = []
)
{
) {
$this->wysiwygConfig = $wysiwygConfig;
$this->systemStore = $systemStore;
$this->imageHelper = $imageHelper;
$this->systemStore = $systemStore;
$this->imageHelper = $imageHelper;

parent::__construct($context, $registry, $formFactory, $data);
}
Expand Down
6 changes: 3 additions & 3 deletions Block/Adminhtml/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class Category extends Container
*/
protected function _construct()
{
$this->_controller = 'adminhtml_category';
$this->_blockGroup = 'Mageplaza_Blog';
$this->_headerText = __('Categories');
$this->_controller = 'adminhtml_category';
$this->_blockGroup = 'Mageplaza_Blog';
$this->_headerText = __('Categories');
$this->_addButtonLabel = __('Create New Blog Category');

parent::_construct();
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Category/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Edit extends Container
*/
protected function _construct()
{
$this->_objectId = 'id';
$this->_objectId = 'id';
$this->_blockGroup = 'Mageplaza_Blog';
$this->_controller = 'adminhtml_category';

Expand Down
25 changes: 16 additions & 9 deletions Block/Adminhtml/Category/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Form extends AbstractCategory

/**
* Form constructor.
*
* @param Context $context
* @param Tree $categoryTree
* @param Registry $registry
Expand All @@ -72,12 +73,11 @@ public function __construct(
BlogCategoryFactory $blogCategoryFactory,
EncoderInterface $jsonEncoder,
array $data = []
)
{
) {
parent::__construct($context, $categoryTree, $registry, $categoryFactory, $data);

$this->jsonEncoder = $jsonEncoder;
$this->_categoryTree = $blogCategoryTree;
$this->jsonEncoder = $jsonEncoder;
$this->_categoryTree = $blogCategoryTree;
$this->_categoryFactory = $blogCategoryFactory;
}

Expand All @@ -86,7 +86,7 @@ public function __construct(
*/
protected function _prepareLayout()
{
$category = $this->getCategory();
$category = $this->getCategory();
$categoryId = (int)$category->getId(); // 0 when we create Blog Category, otherwise some value for editing Blog Category

$this->setChild('tabs', $this->getLayout()->createBlock('Mageplaza\Blog\Block\Adminhtml\Category\Edit\Tabs', 'tabs'));
Expand All @@ -112,9 +112,9 @@ protected function _prepareLayout()
'id' => 'delete',
'label' => __('Delete Category'),
'onclick' => "categoryDelete('" . $this->getUrl(
'mageplaza_blog/*/delete',
['_current' => true]
) . "')",
'mageplaza_blog/*/delete',
['_current' => true]
) . "')",
'class' => 'delete'
]);
}
Expand Down Expand Up @@ -156,6 +156,7 @@ public function isAjax()

/**
* @param array $args
*
* @return string
*/
public function getSaveUrl(array $args = [])
Expand All @@ -177,6 +178,7 @@ public function getEditUrl()
/**
* @param $alias
* @param $config
*
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
Expand All @@ -202,6 +204,7 @@ public function addAdditionalButton($alias, $config)
* Remove additional button
*
* @param string $alias
*
* @return $this
*/
public function removeAdditionalButton($alias)
Expand Down Expand Up @@ -241,6 +244,7 @@ public function getHeader()

/**
* @param array $args
*
* @return string
*/
public function getDeleteUrl(array $args = [])
Expand All @@ -255,6 +259,7 @@ public function getDeleteUrl(array $args = [])
* Return URL for refresh input element 'path' in form
*
* @param array $args
*
* @return string
*/
public function getRefreshPathUrl(array $args = [])
Expand Down Expand Up @@ -288,12 +293,13 @@ public function getCategoryId()
/**
* @param $buttonId
* @param array $data
*
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function addButton($buttonId, array $data)
{
$childBlockId = $buttonId . '_button';
$button = $this->getButtonChildBlock($childBlockId);
$button = $this->getButtonChildBlock($childBlockId);
$button->setData($data);
$block = $this->getLayout()->getBlock('page.actions.toolbar');
if ($block) {
Expand All @@ -315,6 +321,7 @@ public function hasToolbarBlock()
/**
* @param $childId
* @param null $blockClassName
*
* @return \Magento\Framework\View\Element\BlockInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
Expand Down
12 changes: 6 additions & 6 deletions Block/Adminhtml/Category/Edit/Tab/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class Category extends Generic implements TabInterface

/**
* Category constructor.
*
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Data\FormFactory $formFactory
Expand All @@ -89,13 +90,12 @@ public function __construct(
Robots $metaRobotsOptions,
Store $systemStore,
array $data = []
)
{
$this->wysiwygConfig = $wysiwygConfig;
$this->booleanOptions = $booleanOptions;
$this->enableDisable = $enableDisable;
) {
$this->wysiwygConfig = $wysiwygConfig;
$this->booleanOptions = $booleanOptions;
$this->enableDisable = $enableDisable;
$this->metaRobotsOptions = $metaRobotsOptions;
$this->systemStore = $systemStore;
$this->systemStore = $systemStore;

parent::__construct($context, $registry, $formFactory, $data);
}
Expand Down
12 changes: 7 additions & 5 deletions Block/Adminhtml/Category/Edit/Tab/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Post extends Extended implements TabInterface

/**
* Post constructor.
*
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Backend\Helper\Data $backendHelper
Expand All @@ -66,11 +67,10 @@ public function __construct(
PostFactory $postFactory,
CollectionFactory $postCollectionFactory,
array $data = []
)
{
) {
$this->postCollectionFactory = $postCollectionFactory;
$this->coreRegistry = $coreRegistry;
$this->postFactory = $postFactory;
$this->coreRegistry = $coreRegistry;
$this->postFactory = $postFactory;

parent::__construct($context, $backendHelper, $data);
}
Expand Down Expand Up @@ -186,6 +186,7 @@ public function getSelectedPosts()

/**
* @param \Mageplaza\Blog\Model\Post|\Magento\Framework\Object $item
*
* @return string
*/
public function getRowUrl($item)
Expand Down Expand Up @@ -213,6 +214,7 @@ public function getCategory()

/**
* @param \Magento\Backend\Block\Widget\Grid\Column $column
*
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
Expand All @@ -225,7 +227,7 @@ protected function _addColumnFilterToCollection($column)
}
if ($column->getFilter()->getValue()) {
$this->getCollection()->addFieldToFilter('main_table.post_id', ['in' => $postIds]);
} else if ($postIds) {
} elseif ($postIds) {
$this->getCollection()->addFieldToFilter('main_table.post_id', ['nin' => $postIds]);
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions Block/Adminhtml/Category/Edit/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs

/**
* Tabs constructor.
*
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
Expand All @@ -56,8 +57,7 @@ public function __construct(
EncoderInterface $jsonEncoder,
Session $authSession,
array $data = []
)
{
) {
$this->coreRegistry = $coreRegistry;

parent::__construct($context, $jsonEncoder, $authSession, $data);
Expand Down
17 changes: 10 additions & 7 deletions Block/Adminhtml/Category/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\Tree

/**
* Tree constructor.
*
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Catalog\Model\ResourceModel\Category\Tree $categoryTree
* @param \Magento\Framework\Registry $registry
Expand All @@ -68,12 +69,11 @@ public function __construct(
BlogTreeResource $blogCategoryTree,
CategoryFactory $blogCategoryFactory,
array $data = []
)
{
) {
parent::__construct($context, $categoryTree, $registry, $categoryFactory, $jsonEncoder, $resourceHelper, $backendSession, $data);

$this->_categoryTree = $blogCategoryTree;
$this->_categoryFactory = $blogCategoryFactory;
$this->_categoryTree = $blogCategoryTree;
$this->_categoryFactory = $blogCategoryFactory;
$this->_withProductCount = false;
}

Expand All @@ -95,6 +95,7 @@ public function getMoveUrl()

/**
* @param array $args
*
* @return string
*/
public function getSaveUrl(array $args = [])
Expand All @@ -119,6 +120,7 @@ public function getEditUrl()
/**
* @param null $parentNodeCategory
* @param null $store
*
* @return array
*/
public function getTree($parentNodeCategory = null, $store = null)
Expand All @@ -133,6 +135,7 @@ public function getTree($parentNodeCategory = null, $store = null)
*
* @param \Magento\Framework\Data\Tree\Node|array $node
* @param int $level
*
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
Expand All @@ -152,10 +155,10 @@ protected function _getNodeJson($node, $level = 0)
$node->setIsActive(true);

if ($item = parent::_getNodeJson($node, $level)) {
$item['url'] = $node->getData('url_key');
$item['storeIds'] = $node->getData('store_ids');
$item['url'] = $node->getData('url_key');
$item['storeIds'] = $node->getData('store_ids');
$item['allowDrag'] = $this->_isCategoryMoveable($node) && ($node->getLevel() == 0 ? false : true);
$item['enabled'] = $node->getData('enabled');
$item['enabled'] = $node->getData('enabled');

return $item;
}
Expand Down
4 changes: 2 additions & 2 deletions Block/Adminhtml/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class Comment extends Container
*/
protected function _construct()
{
$this->_controller = 'adminhtml_comment';
$this->_blockGroup = 'Mageplaza_Blog';
$this->_controller = 'adminhtml_comment';
$this->_blockGroup = 'Mageplaza_Blog';
$this->_addButtonLabel = __('New Comment');

parent::_construct();
Expand Down
3 changes: 1 addition & 2 deletions Block/Adminhtml/Comment/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public function __construct(
Registry $coreRegistry,
Context $context,
array $data = []
)
{
) {
$this->coreRegistry = $coreRegistry;

parent::__construct($context, $data);
Expand Down
14 changes: 7 additions & 7 deletions Block/Adminhtml/Comment/Edit/Tab/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Comment extends Generic implements TabInterface

/**
* Comment constructor.
*
* @param Context $context
* @param Registry $registry
* @param FormFactory $formFactory
Expand All @@ -77,12 +78,11 @@ public function __construct(
Status $commentStatus,
Store $systemStore,
array $data = []
)
{
$this->_commentStatus = $commentStatus;
) {
$this->_commentStatus = $commentStatus;
$this->_customerRepository = $customerRepository;
$this->_postFactory = $postFactory;
$this->systemStore = $systemStore;
$this->_postFactory = $postFactory;
$this->systemStore = $systemStore;

parent::__construct($context, $registry, $formFactory, $data);
}
Expand All @@ -108,12 +108,12 @@ protected function _prepareForm()
$fieldset->addField('comment_id', 'hidden', ['name' => 'comment_id']);
}

$post = $this->_postFactory->create()->load($comment->getPostId());
$post = $this->_postFactory->create()->load($comment->getPostId());
$postText = '<a href="' . $this->getUrl('mageplaza_blog/post/edit', ['id' => $comment->getPostId()]) . '" onclick="this.target=\'blank\'">' . $this->escapeHtml($post->getName()) . '</a>';
$fieldset->addField('post_name', 'note', ['text' => $postText, 'label' => __('Post'), 'name' => 'post_name']);

if ($comment->getEntityId() > 0) {
$customer = $this->_customerRepository->getById($comment->getEntityId());
$customer = $this->_customerRepository->getById($comment->getEntityId());
$customerText = '<a href="' . $this->getUrl('customer/index/edit', ['id' => $customer->getId(), 'active_tab' => 'review']) . '" onclick="this.target=\'blank\'">' . $this->escapeHtml($customer->getFirstname() . ' ' . $customer->getLastname()) . '</a> <a href="mailto:%4">(' . $customer->getEmail() . ')</a>';
} else {
$customerText = 'Guest';
Expand Down
Loading

0 comments on commit a955b92

Please sign in to comment.