Skip to content

Commit

Permalink
sensiolabs code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantus committed Oct 10, 2016
1 parent ffabd26 commit a0ff095
Show file tree
Hide file tree
Showing 70 changed files with 120 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
service_name: travis-ci
coverage_clover: build/logs/clover.xml
coverage_clover: build/logs/clover.xml
8 changes: 8 additions & 0 deletions .sensiolabs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
exclude_patterns:
- 'dev.php'
- '*.css.phtml'
- '*.js.phtml'

rules:
php.psr1:
enabled: false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ script:

after_success:
- cd $TRAVIS_BUILD_DIR
- travis_retry build/magento/vendor/bin/coveralls -v
- travis_retry build/magento/vendor/bin/coveralls -v
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
5 changes: 4 additions & 1 deletion app/code/community/Ecocode/Profiler/Block/Collector/Base.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class Ecocode_Profiler_Block_Collector_Base
*/
class Ecocode_Profiler_Block_Collector_Base
extends Mage_Core_Block_Template
{
Expand Down Expand Up @@ -39,4 +42,4 @@ public function renderBag($bag, array $data = [])

return $bagBlock->toHtml();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class Ecocode_Profiler_Block_Collector_Layout_Panel
*/
class Ecocode_Profiler_Block_Collector_Layout_Panel
extends Ecocode_Profiler_Block_Collector_Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/**
* Class Ecocode_Profiler_Block_Collector_Log_Panel
*
*/
class Ecocode_Profiler_Block_Collector_Log_Panel
extends Ecocode_Profiler_Block_Collector_Base
Expand Down Expand Up @@ -96,4 +95,4 @@ public function getLogTableRenderer()
}
return $this->logTableRenderer;
}
}
}
5 changes: 4 additions & 1 deletion app/code/community/Ecocode/Profiler/Block/Collector/Menu.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class Ecocode_Profiler_Block_Collector_Menu
*/
class Ecocode_Profiler_Block_Collector_Menu extends
Ecocode_Profiler_Block_Collector_Base
{
Expand All @@ -8,4 +11,4 @@ public function _construct()
parent::_construct();
$this->setTemplate('ecocode_profiler/collector/base/menu.phtml');
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class Ecocode_Profiler_Block_Collector_Mysql_Panel
*/
class Ecocode_Profiler_Block_Collector_Mysql_Panel
extends Ecocode_Profiler_Block_Collector_Base
{
Expand Down Expand Up @@ -177,4 +180,4 @@ public function getQueryTableRenderer()
}
return $this->queryTableRenderer;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/**
* Class Ecocode_Profiler_Block_Collector_Translation_Panel
*
*/
class Ecocode_Profiler_Block_Collector_Translation_Panel
extends Ecocode_Profiler_Block_Collector_Base
Expand Down Expand Up @@ -31,4 +30,4 @@ public function renderTable(array $messages)
$tableBlock->setData('messages', $messages);
return $tableBlock->toHtml();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class Ecocode_Profiler_Block_Profiler_Sidebar
*/
class Ecocode_Profiler_Block_Profiler_Sidebar
extends Mage_Core_Block_Template
{
Expand Down Expand Up @@ -27,4 +30,4 @@ public function getProfile()

return $this->profile;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class Ecocode_Profiler_Block_Profiler_Sidebar_Menu
*/
class Ecocode_Profiler_Block_Profiler_Sidebar_Menu extends Mage_Core_Block_Template
{
protected $profile = null;
Expand Down Expand Up @@ -39,4 +42,4 @@ public function getProfile()

return $this->profile;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/**
* Class Ecocode_Profiler_Block_Renderer_Log_LogTable
*
*/
class Ecocode_Profiler_Block_Renderer_Log_LogTable
extends Ecocode_Profiler_Block_Renderer_AbstractRenderer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/**
* Class Ecocode_Profiler_Block_Renderer_Context
*
*/
class Ecocode_Profiler_Block_Renderer_Mysql_QueryTable
extends Ecocode_Profiler_Block_Renderer_AbstractRenderer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ public function collect(Mage_Core_Controller_Request_Http $request, Mage_Core_Co
$sessionMetadata = [];
$sessionAttributes = [];
//@TODO get all magento session singletons to split them by namespace
$session = null;
$flashes = [];

/* if (false && $request->hasSession()) {
/*
$session = null
if (false && $request->hasSession()) {
$session = $request->getSession();
if ($session->isStarted()) {
$sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated());
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ecocode/Profiler/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function controllerFrontSendResponseBefore(Varien_Event_Observer $observe
$this->injectToolbar($response, $request, $token);
}

public function onTerminate(Varien_Event_Observer $observer)
public function onTerminate()
{
foreach ($this->profiles as $request) {
$this->getProfiler()->saveProfile($this->profiles[$request]);
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ecocode/Profiler/Model/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function saveProfile(Ecocode_Profiler_Model_Profile $profile)
}
}

if (!($ret = $this->getStorage()->write($profile))) {
if (!$this->getStorage()->write($profile)) {
throw new Exception('Unable to store the profiler information.', ['configured_storage' => get_class($this->storage)]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function write(Ecocode_Profiler_Model_Profile $profile)
$data = [
'token' => $profile->getToken(),
'parent' => $profile->getParentToken(),
'children' => array_map(function ($p) {
'children' => array_map(function (Ecocode_Profiler_Model_Profile $p) {
return $p->getToken();
}, $profile->getChildren()),
'data' => $profile->getCollectors(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Class Ecocode_Profiler_AbstractController
*/
class Ecocode_Profiler_Test_Dev_Controller_AbstractControllerTest
class Ecocode_Profiler_Tests_Dev_Controller_AbstractControllerTest
extends TestHelper
{
protected function tearDown()
Expand All @@ -21,7 +21,7 @@ protected function tearDown()
public function testAccessDenied()
{
$request = new Mage_Core_Controller_Request_Http();
$response = new Ecocode_Profiler_Test_Dev_Fixtures_ResponseHttp();
$response = new Ecocode_Profiler_Tests_Dev_Fixtures_ResponseHttp();
$controller = $this->getMockBuilder('Ecocode_Profiler_Controller_AbstractController')
->setMethods(['getApp'])
->setConstructorArgs([$request, $response])
Expand All @@ -38,7 +38,7 @@ public function testAccessDenied()
public function testAccessAllow()
{
$request = new Mage_Core_Controller_Request_Http();
$response = new Ecocode_Profiler_Test_Dev_Fixtures_ResponseHttp();
$response = new Ecocode_Profiler_Tests_Dev_Fixtures_ResponseHttp();
$controller = $this->getMockBuilder('Ecocode_Profiler_Controller_AbstractController')
->setMethods(['getApp', '_rewrite'])
->setConstructorArgs([$request, $response])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_DevModeTest
class Ecocode_Profiler_Tests_DevModeTest
extends TestHelper
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Fixtures_DummyCacheBackend
class Ecocode_Profiler_Tests_Dev_Fixtures_DummyCacheBackend
extends Zend_Cache_Backend
{
protected $_options = ['test_option' => 0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Fixtures_ResponseHttp
class Ecocode_Profiler_Tests_Dev_Fixtures_ResponseHttp
extends Mage_Core_Controller_Response_Http
{
public function canSendHeaders($throw = true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Helper_CodeTest
class Ecocode_Profiler_Tests_Dev_Helper_CodeTest
extends TestHelper
{
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Helper_ContextTest
class Ecocode_Profiler_Tests_Dev_Helper_ContextTest
extends TestHelper
{
public function testInit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Helper_DataTest
class Ecocode_Profiler_Tests_Dev_Helper_DataTest
extends TestHelper
{
public function testGetClassGroup()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Helper_RewriteTest
class Ecocode_Profiler_Tests_Dev_Helper_RewriteTest
extends TestHelper
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


class Ecocode_Profiler_Test_Dev_Helper_SqlTest extends \PHPUnit_Framework_TestCase
class Ecocode_Profiler_Tests_Dev_Helper_SqlTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Ecocode_Profiler_Helper_Sql
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Helper_ValueExporterTest
class Ecocode_Profiler_Tests_Dev_Helper_ValueExporterTest
extends TestHelper
{
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_CacheDataCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_CacheDataCollectorTest
extends TestHelper
{

Expand All @@ -15,7 +15,7 @@ public function testCollect()

$expectCacheList = json_decode('[{"id":"config","cache_type":"Configuration","description":"System(config.xml, local.xml) and modules configuration files(config.xml).","tags":"CONFIG","status":1},{"id":"layout","cache_type":"Layouts","description":"Layout building instructions.","tags":"LAYOUT_GENERAL_CACHE_TAG","status":1},{"id":"block_html","cache_type":"Blocks HTML output","description":"Page blocks HTML.","tags":"BLOCK_HTML","status":1},{"id":"translate","cache_type":"Translations","description":"Translation files.","tags":"TRANSLATE","status":1},{"id":"collections","cache_type":"Collections Data","description":"Collection data files.","tags":"COLLECTION_DATA","status":1},{"id":"eav","cache_type":"EAV types and attributes","description":"Entity types declaration cache.","tags":"EAV","status":1},{"id":"config_api","cache_type":"Web Services Configuration","description":"Web Services definition files (api.xml).","tags":"CONFIG_API","status":1},{"id":"config_api2","cache_type":"Web Services Configuration","description":"Web Services definition files (api2.xml).","tags":"CONFIG_API2","status":1}]', true);

$this->assertEquals('Ecocode_Profiler_Test_Dev_Fixtures_DummyCacheBackend', $collector->getBackendName());
$this->assertEquals('Ecocode_Profiler_Tests_Dev_Fixtures_DummyCacheBackend', $collector->getBackendName());
$this->assertEquals(['test_option' => 1], $collector->getBackendOptions());
$this->assertEquals($expectCacheList, $collector->getCacheList());
$this->assertEmpty($collector->getCacheCalls());
Expand Down Expand Up @@ -50,7 +50,7 @@ public function testLateCollect()

public function getMockedCollector($cacheTypes = [], $log = [])
{
$cacheBackend = new Ecocode_Profiler_Test_Dev_Fixtures_DummyCacheBackend(['test_option' => 1]);
$cacheBackend = new Ecocode_Profiler_Tests_Dev_Fixtures_DummyCacheBackend(['test_option' => 1]);

$cacheMock = $this->getMockBuilder('Ecocode_Profiler_Model_Core_Cache')
->setMethods(['getTypes', 'getBackend', 'getLog'])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_ConfigCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_ConfigCollectorTest
extends TestHelper
{

public function testCollect()
{
$token = 'XXX';
$response = new Ecocode_Profiler_Test_Dev_Fixtures_ResponseHttp();
$response = new Ecocode_Profiler_Tests_Dev_Fixtures_ResponseHttp();
$response->setHeader('X-Debug-Token', $token);
$collector = new Ecocode_Profiler_Model_Collector_ConfigDataCollector();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_ContextDataCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_ContextDataCollectorTest
extends TestHelper
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_CustomerDataCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_CustomerDataCollectorTest
extends TestHelper
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_EventDataCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_EventDataCollectorTest
extends TestHelper
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_LayoutDataCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_LayoutDataCollectorTest
extends TestHelper
{
public function testBeforeToHtmlNoParent()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_LogDataCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_LogDataCollectorTest
extends TestHelper
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class Ecocode_Profiler_Test_Dev_Model_Collector_MemoryDataCollectorTest
class Ecocode_Profiler_Tests_Dev_Model_Collector_MemoryDataCollectorTest
extends TestHelper
{

Expand Down

0 comments on commit a0ff095

Please sign in to comment.