Skip to content

Commit

Permalink
Fit to PHP coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
vpietri committed Apr 22, 2016
1 parent 6a2d2a6 commit 8d78815
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 84 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.buildpath
.project
.settings/
4 changes: 2 additions & 2 deletions Block/Tab/Content/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class Event extends \ADM\QuickDevBar\Block\Tab\DefaultContent

public function __construct(\Magento\Framework\View\Element\Template\Context $context,
\ADM\QuickDevBar\Helper\Register $qdbHelperRegister,
array $data = [])
{
array $data = []
) {

$this->_qdbHelperRegister = $qdbHelperRegister;

Expand Down
16 changes: 0 additions & 16 deletions Block/Tab/Content/General.php

This file was deleted.

14 changes: 7 additions & 7 deletions Block/Tab/Content/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Layout extends \ADM\QuickDevBar\Block\Tab\DefaultContent
{
protected $_elements = array();
protected $_elements = [];


/**
Expand Down Expand Up @@ -38,7 +38,7 @@ public function getTreeBlocksHierarchy()
if ($this->_elements) {
$treeBlocks = $this->buildTreeBlocks();
} else {
$treeBlocks = array();
$treeBlocks = [];
}

return $treeBlocks;
Expand All @@ -54,20 +54,20 @@ protected function buildTreeBlocks($name = 'root', $alias = '')
{
$element = $this->getElementByName($name);
if ($element) {
$treeBlocks = array(
$treeBlocks = [
'name' =>$name,
'alias' =>$alias,
'type' => $element['type'],
'label' => isset($element['label']) ? $element['label'] : ''
);
];

if (isset($element['children'])) {
foreach ($element['children'] as $childName => $childAlias) {
$treeBlocks['children'][] = $this->buildTreeBlocks($childName, $childAlias);
}
}
} else {
$treeBlocks = array();
$treeBlocks = [];
}

return $treeBlocks;
Expand All @@ -91,10 +91,10 @@ public function getElementByName($name)
*
* @return string
*/
public function getHtmlBlocksHierarchy($treeBlocks=array(), $level=0)
public function getHtmlBlocksHierarchy($treeBlocks=[], $level=0)
{
if(empty($treeBlocks)) {
$treeBlocks = array($this->getTreeBlocksHierarchy());
$treeBlocks = [$this->getTreeBlocksHierarchy()];
}

$html = '<ul ' . (($level==1) ? 'class="tree"' : '') . '>';
Expand Down
8 changes: 4 additions & 4 deletions Block/Tab/Content/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class Log extends \ADM\QuickDevBar\Block\Tab\DefaultContent
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Json\Helper\Data $jsonHelper,
\ADM\QuickDevBar\Helper\Data $qdbHelper,
array $data = []
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Json\Helper\Data $jsonHelper,
\ADM\QuickDevBar\Helper\Data $qdbHelper,
array $data = []
) {
$this->_jsonHelper = $jsonHelper;

Expand Down
24 changes: 12 additions & 12 deletions Block/Tab/Content/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ public function getRequestData()
$request = $this->getRequest();


$requestData[] = array('name'=>'Base Url', 'value'=>$request->getDistroBaseUrl());
$requestData[] = array('name'=>'Path Info', 'value'=>$request->getPathInfo());
$requestData[] = array('name'=>'Module Name', 'value'=>$request->getModuleName());
$requestData[] = array('name'=>'Controller', 'value'=>$request->getControllerName());
$requestData[] = array('name'=>'Action', 'value'=>$request->getActionName());
$requestData[] = array('name'=>'Full Action', 'value'=>$request->getFullActionName());
$requestData[] = array('name'=>'Route', 'value'=>$request->getRouteName());
$requestData[] = ['name'=>'Base Url', 'value'=>$request->getDistroBaseUrl()];
$requestData[] = ['name'=>'Path Info', 'value'=>$request->getPathInfo()];
$requestData[] = ['name'=>'Module Name', 'value'=>$request->getModuleName()];
$requestData[] = ['name'=>'Controller', 'value'=>$request->getControllerName()];
$requestData[] = ['name'=>'Action', 'value'=>$request->getActionName()];
$requestData[] = ['name'=>'Full Action', 'value'=>$request->getFullActionName()];
$requestData[] = ['name'=>'Route', 'value'=>$request->getRouteName()];

if ($request->getBeforeForwardInfo()) {
$requestData[] = array('name'=>'Before Forward', 'value'=>$request->getBeforeForwardInfo());
$requestData[] = ['name'=>'Before Forward', 'value'=>$request->getBeforeForwardInfo()];
}

if ($request->getParams()) {
$requestData[] = array('name'=>'Params', 'value'=>$request->getParams());
$requestData[] = ['name'=>'Params', 'value'=>$request->getParams()];
}
$requestData[] = array('name'=>'Client IP', 'value'=>$request->getClientIp());
$requestData[] = array('name'=>'Magento', 'value'=>\Magento\Framework\AppInterface::VERSION);
$requestData[] = array('name'=>'Mage Mode', 'value'=>$this->_appState->getMode());
$requestData[] = ['name'=>'Client IP', 'value'=>$request->getClientIp()];
$requestData[] = ['name'=>'Magento', 'value'=>\Magento\Framework\AppInterface::VERSION];
$requestData[] = ['name'=>'Mage Mode', 'value'=>$this->_appState->getMode()];


return $requestData;
Expand Down
2 changes: 1 addition & 1 deletion Block/Tab/Content/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getQueryProfiles()
if ($profiler) {
return $profiler->getQueryProfiles();
} else {
return array();
return [];
}
}

Expand Down
2 changes: 1 addition & 1 deletion Block/Tab/DefaultContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getTabUrl()
if ($this->getData('ajax_url')) {
return $this->getUrl($this->getData('ajax_url'));
} elseif ($this->getData('is_ajax')) {
return $this->getUrl('quickdevbar/tab/index', array('block'=>$this->getNameInLayout())) . '?isAjax=1';
return $this->getUrl('quickdevbar/tab/index', ['block'=>$this->getNameInLayout()]) . '?isAjax=1';
} else {
return '#'.$this->getId();
}
Expand Down
4 changes: 2 additions & 2 deletions Block/Tab/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public function getUiTabClass()

protected function _getTabConfig()
{
$config = array( "active"=>$this->_tab_active,
$config = [ "active"=>$this->_tab_active,
"openedState"=>$this->_tab_openState,
"collapsibleElement"=>"[data-role=collapsible".$this->getSubTabSuffix()."]",
"content"=>"[data-role=content".$this->getSubTabSuffix()."]",
"collapsible" => $this->_tab_collapsible,
"ajaxContent" => true
);
];

return $config;
}
Expand Down
5 changes: 0 additions & 5 deletions Controller/Action/ConfigSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,13 @@ public function __construct(
) {
parent::__construct($context, $qdbHelper, $resultRawFactory, $layoutFactory);

//$this->_configStructure = $configStructure;

$this->_tabs = $configStructure->getTabs();
}



public function execute()
{
//$tabs = $this->_configStructure->getTabs();

var_dump(get_class($this->_tabs));
$this->_tabs->rewind();
foreach ($this->_tabs as $tab) {
echo $tab->getLabel();
Expand Down
2 changes: 1 addition & 1 deletion Controller/Action/ConfigUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function execute()
$configKey = $config['key'];
}

$scopeList = array('default', 'websites', 'stores', 'auto');
$scopeList = ['default', 'websites', 'stores', 'auto'];
if (empty($config['scope']) or !in_array($config['scope'], $scopeList)) {
throw new \Exception('Scope is missing');
} else {
Expand Down
8 changes: 4 additions & 4 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
*
* @var array
*/
protected $_defaultLogFiles = array('exception'=>'exception.log', 'system'=>'system.log', 'debug'=>'debug.log');
protected $_defaultLogFiles = ['exception'=>'exception.log', 'system'=>'system.log', 'debug'=>'debug.log'];

/**
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
Expand Down Expand Up @@ -96,15 +96,15 @@ public function isToolbarAccessAllowed()

public function getLogFiles($key=false)
{
$logFiles = array();
$logFiles = [];
foreach ($this->_defaultLogFiles as $fileKey=>$fileName) {
$filepath = BP . '/var/log/' . $fileName;
$logFiles[$fileKey] = array('id'=>$fileName
$logFiles[$fileKey] = ['id'=>$fileName
, 'name' => $fileName
, 'path' => $filepath
, 'reset' => $this->_canResetFile($filepath)
, 'size' => $this->_getFileSize($filepath)
);
];
}

if (!$key) {
Expand Down
8 changes: 4 additions & 4 deletions Helper/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public function getObservers()
public function addEvent($eventName, $data)
{
if (!isset($this->_events[$eventName])) {
$this->_events[$eventName] = array('event'=>$eventName,
$this->_events[$eventName] = ['event'=>$eventName,
'nbr'=>0,
'args'=>array_keys($data)
);
];
}
$this->_events[$eventName]['nbr']++;

Expand Down Expand Up @@ -70,7 +70,7 @@ public function addCollection($collection)
{
$class = get_class($collection);
if (empty($this->_collections[$class])) {
$this->_collections[$class] = array('name'=>$class, 'nbr'=>0);
$this->_collections[$class] = ['name'=>$class, 'nbr'=>0];
}
$this->_collections[$class]['nbr']++;
}
Expand All @@ -85,7 +85,7 @@ public function addModel($model)
{
$class = get_class($model);
if (empty($this->_models[$class])) {
$this->_models[$class] = array('name'=>$class, 'nbr'=>0);
$this->_models[$class] = ['name'=>$class, 'nbr'=>0];
}
$this->_models[$class]['nbr']++;
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Plugin/Event/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
* @param array $data
*/
//public function beforeDispatch($interceptor, $eventName, $data)
public function beforeDispatch($interceptor, $eventName, $data=array())
public function beforeDispatch($interceptor, $eventName, $data=[])
{
$this->_qdbHelperRegister->addEvent($eventName, $data);
}
Expand Down
8 changes: 0 additions & 8 deletions Model/Profiler/Driver.php

This file was deleted.

10 changes: 0 additions & 10 deletions Model/Profiler/Driver/Output.php

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ php bin/magento cache:flush

# Changelog

0.1.5.2
* Fit to PHP coding standards

0.1.5.1
* Fix tab bug in backoffice

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vpietri/adm-quickdevbar",
"description": "QuickDevBar is a developer toolbar for magento 2",
"type": "magento2-module",
"version": "0.1.5.1",
"version": "0.1.5.2",
"minimum-stability": "beta",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="ADM_QuickDevBar" setup_version="0.1.5.1"/>
<module name="ADM_QuickDevBar" setup_version="0.1.5.2"/>
<!-- Sequence allow to control load order module -->
<sequence>
</sequence>
Expand Down
Loading

0 comments on commit 8d78815

Please sign in to comment.