Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
php:
- "8.1"
- "8.2"
- "8.3"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -23,7 +24,7 @@ jobs:
tools: composer:v2

- name: "Cache Composer dependencies"
uses: "actions/cache@v2"
uses: "actions/cache@v4"
with:
path: "/tmp/composer-cache"
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
6 changes: 1 addition & 5 deletions Console/Command/DatabaseProfilerDisableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@

class DatabaseProfilerDisableCommand extends Command
{
private \ClawRock\Debug\Model\Config\Database\ProfilerWriter $profilerWriter;

public function __construct(
\ClawRock\Debug\Model\Config\Database\ProfilerWriter $profilerWriter
private \ClawRock\Debug\Model\Config\Database\ProfilerWriter $profilerWriter
) {
parent::__construct('debug:db-profiler:disable');

$this->profilerWriter = $profilerWriter;
}

protected function configure(): void
Expand Down
6 changes: 1 addition & 5 deletions Console/Command/DatabaseProfilerEnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@

class DatabaseProfilerEnableCommand extends Command
{
private \ClawRock\Debug\Model\Config\Database\ProfilerWriter $profilerWriter;

public function __construct(
\ClawRock\Debug\Model\Config\Database\ProfilerWriter $profilerWriter
private \ClawRock\Debug\Model\Config\Database\ProfilerWriter $profilerWriter
) {
parent::__construct('debug:db-profiler:enable');

$this->profilerWriter = $profilerWriter;
}

protected function configure(): void
Expand Down
13 changes: 3 additions & 10 deletions Controller/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,10 @@

abstract class Cache implements HttpGetActionInterface
{
protected \Magento\Framework\Controller\ResultFactory $resultFactory;
protected \Magento\Framework\App\RequestInterface $request;
protected \Magento\Framework\App\Cache\Manager $cacheManager;

public function __construct(
\Magento\Framework\Controller\ResultFactory $resultFactory,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\App\Cache\Manager $cacheManager
protected \Magento\Framework\Controller\ResultFactory $resultFactory,
protected \Magento\Framework\App\RequestInterface $request,
protected \Magento\Framework\App\Cache\Manager $cacheManager
) {
$this->resultFactory = $resultFactory;
$this->request = $request;
$this->cacheManager = $cacheManager;
}
}
21 changes: 5 additions & 16 deletions Controller/Profiler/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,13 @@

class Info implements HttpGetActionInterface
{
private \Magento\Framework\View\LayoutInterface $layout;
private \ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository;
private \ClawRock\Debug\Model\Storage\ProfileMemoryStorage $profileMemoryStorage;
private \Magento\Framework\Controller\ResultFactory $resultFactory;
private \Magento\Framework\App\RequestInterface $request;

public function __construct(
\Magento\Framework\Controller\ResultFactory $resultFactory,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\View\LayoutInterface $layout,
\ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository,
\ClawRock\Debug\Model\Storage\ProfileMemoryStorage $profileMemoryStorage
private \Magento\Framework\Controller\ResultFactory $resultFactory,
private \Magento\Framework\App\RequestInterface $request,
private \Magento\Framework\View\LayoutInterface $layout,
private \ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository,
private \ClawRock\Debug\Model\Storage\ProfileMemoryStorage $profileMemoryStorage
) {
$this->resultFactory = $resultFactory;
$this->request = $request;
$this->layout = $layout;
$this->profileRepository = $profileRepository;
$this->profileMemoryStorage = $profileMemoryStorage;
}

public function execute(): ?ResultInterface
Expand Down
5 changes: 1 addition & 4 deletions Controller/Profiler/PHPInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@

class PHPInfo implements HttpGetActionInterface
{
private \Magento\Framework\Controller\ResultFactory $resultFactory;

public function __construct(
\Magento\Framework\Controller\ResultFactory $resultFactory
private \Magento\Framework\Controller\ResultFactory $resultFactory
) {
$this->resultFactory = $resultFactory;
}

public function execute(): ?ResultInterface
Expand Down
17 changes: 4 additions & 13 deletions Controller/Profiler/Purge.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@

class Purge implements HttpGetActionInterface
{
private \ClawRock\Debug\Model\Storage\ProfileFileStorage $profileFileStorage;
private \ClawRock\Debug\Logger\Logger $logger;
private \Magento\Framework\Controller\ResultFactory $resultFactory;
private \Magento\Framework\App\Response\RedirectInterface $redirect;

public function __construct(
\Magento\Framework\Controller\ResultFactory $resultFactory,
\Magento\Framework\App\Response\RedirectInterface $redirect,
\ClawRock\Debug\Model\Storage\ProfileFileStorage $profileFileStorage,
\ClawRock\Debug\Logger\Logger $logger
private \Magento\Framework\Controller\ResultFactory $resultFactory,
private \Magento\Framework\App\Response\RedirectInterface $redirect,
private \ClawRock\Debug\Model\Storage\ProfileFileStorage $profileFileStorage,
private \Psr\Log\LoggerInterface $logger
) {
$this->resultFactory = $resultFactory;
$this->redirect = $redirect;
$this->profileFileStorage = $profileFileStorage;
$this->logger = $logger;
}

public function execute(): ?ResultInterface
Expand Down
17 changes: 4 additions & 13 deletions Controller/Profiler/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,12 @@

class Search implements HttpGetActionInterface
{
private \Magento\Framework\Controller\ResultFactory $resultFactory;
private \Magento\Framework\App\RequestInterface $request;
private \Magento\Framework\View\LayoutInterface $layout;
private \ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository;

public function __construct(
\Magento\Framework\Controller\ResultFactory $resultFactory,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\View\LayoutInterface $layout,
\ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository
private \Magento\Framework\Controller\ResultFactory $resultFactory,
private \Magento\Framework\App\RequestInterface $request,
private \Magento\Framework\View\LayoutInterface $layout,
private \ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository
) {
$this->resultFactory = $resultFactory;
$this->request = $request;
$this->layout = $layout;
$this->profileRepository = $profileRepository;
}

public function execute(): ?ResultInterface
Expand Down
17 changes: 4 additions & 13 deletions Controller/Profiler/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,12 @@

class Toolbar implements HttpGetActionInterface
{
private \ClawRock\Debug\Model\Storage\ProfileMemoryStorage $profileMemoryStorage;
private \ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository;
private \Magento\Framework\Controller\ResultFactory $resultFactory;
private \Magento\Framework\App\RequestInterface $request;

public function __construct(
\Magento\Framework\Controller\ResultFactory $resultFactory,
\Magento\Framework\App\RequestInterface $request,
\ClawRock\Debug\Model\Storage\ProfileMemoryStorage $profileMemoryStorage,
\ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository
private \Magento\Framework\Controller\ResultFactory $resultFactory,
private \Magento\Framework\App\RequestInterface $request,
private \ClawRock\Debug\Model\Storage\ProfileMemoryStorage $profileMemoryStorage,
private \ClawRock\Debug\Api\ProfileRepositoryInterface $profileRepository
) {
$this->resultFactory = $resultFactory;
$this->request = $request;
$this->profileMemoryStorage = $profileMemoryStorage;
$this->profileRepository = $profileRepository;
}

public function execute(): ?\Magento\Framework\Controller\ResultInterface
Expand Down
21 changes: 5 additions & 16 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,13 @@ class Config
public const CONFIG_COLLECTOR_TRANSLATION = 'clawrock_debug/collector/translation';
public const COLLECTORS = 'clawrock_debug/profiler/collectors';

private \Magento\Framework\PhraseFactory $phraseFactory;
private \Magento\Framework\App\State $appState;
private \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig;
private \Magento\Framework\App\DeploymentConfig $deploymentConfig;
private \ClawRock\Debug\Model\Storage\HttpStorage $httpStorage;

public function __construct(
\Magento\Framework\PhraseFactory $phraseFactory,
\Magento\Framework\App\State $appState,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\App\DeploymentConfig $deploymentConfig,
\ClawRock\Debug\Model\Storage\HttpStorage $httpStorage
private \Magento\Framework\PhraseFactory $phraseFactory,
private \Magento\Framework\App\State $appState,
private \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
private \Magento\Framework\App\DeploymentConfig $deploymentConfig,
private \ClawRock\Debug\Model\Storage\HttpStorage $httpStorage
) {
$this->phraseFactory = $phraseFactory;
$this->appState = $appState;
$this->scopeConfig = $scopeConfig;
$this->deploymentConfig = $deploymentConfig;
$this->httpStorage = $httpStorage;
}

public function getErrorHandler(): string
Expand Down
4 changes: 1 addition & 3 deletions Helper/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

class Database
{
private \Magento\Framework\App\ResourceConnection $resourceConnection;
private array $formatterCache = [];

public function __construct(
\Magento\Framework\App\ResourceConnection $resourceConnection
private \Magento\Framework\App\ResourceConnection $resourceConnection
) {
$this->resourceConnection = $resourceConnection;
}

public function getQueryId(\Zend_Db_Profiler_Query $query): string
Expand Down
4 changes: 1 addition & 3 deletions Helper/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

class File
{
private \Magento\Framework\App\Filesystem\DirectoryList $directoryList;

public function __construct(
\Magento\Framework\App\Filesystem\DirectoryList $directoryList
private \Magento\Framework\App\Filesystem\DirectoryList $directoryList
) {
$this->directoryList = $directoryList;
}
Expand Down
5 changes: 1 addition & 4 deletions Helper/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@

class Formatter
{
private \ClawRock\Debug\Helper\Config $config;

public function __construct(
\ClawRock\Debug\Helper\Config $config
private \ClawRock\Debug\Helper\Config $config
) {
$this->config = $config;
}

public function microtime(float $value, ?int $precision = null): string
Expand Down
9 changes: 2 additions & 7 deletions Helper/Injector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@ class Injector
private const TEMPLATE_TOOLBAR = 'ClawRock_Debug::profiler/toolbar/js.phtml';
private const TEMPLATE_BLOCK = 'ClawRock_Debug::profiler/js.phtml';

private \Magento\Framework\View\LayoutInterface $layout;
private \ClawRock\Debug\Model\View\Toolbar $viewModel;

public function __construct(
\Magento\Framework\View\LayoutInterface $layout,
\ClawRock\Debug\Model\View\Toolbar $viewModel
private \Magento\Framework\View\LayoutInterface $layout,
private \ClawRock\Debug\Model\View\Toolbar $viewModel
) {
$this->layout = $layout;
$this->viewModel = $viewModel;
}

public function inject(Request $request, Response $response, ?string $token = null): void
Expand Down
9 changes: 2 additions & 7 deletions Helper/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@ class Url
public const CONFIGURATION_URL_PATH = 'debug/profiler/config';
public const PROFILER_URL_PATH = '_debug/profiler/info';

private \Magento\Framework\UrlInterface $url;
private \Magento\Backend\Model\UrlInterface $backendUrl;

public function __construct(
\Magento\Framework\Url $url,
\Magento\Backend\Model\UrlInterface $backendUrl
private \Magento\Framework\Url $url,
private \Magento\Backend\Model\UrlInterface $backendUrl
) {
$this->url = $url;
$this->backendUrl = $backendUrl;
}

public function getAdminUrl(): string
Expand Down
11 changes: 0 additions & 11 deletions Logger/Handler.php

This file was deleted.

8 changes: 0 additions & 8 deletions Logger/Logger.php

This file was deleted.

5 changes: 1 addition & 4 deletions Model/Collector/AjaxCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ class AjaxCollector implements CollectorInterface
{
public const NAME = 'ajax';

private \ClawRock\Debug\Helper\Config $config;

public function __construct(
\ClawRock\Debug\Helper\Config $config
private \ClawRock\Debug\Helper\Config $config
) {
$this->config = $config;
}

public function collect(): CollectorInterface
Expand Down
12 changes: 3 additions & 9 deletions Model/Collector/CacheCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,18 @@ class CacheCollector implements CollectorInterface, LoggerCollectorInterface
public const TOTAL_TIME = 'total_time';
public const CACHE_STATUS = 'status';

private \ClawRock\Debug\Helper\Config $config;
private \ClawRock\Debug\Model\DataCollector $dataCollector;
private \ClawRock\Debug\Logger\DataLogger $dataLogger;
private \ClawRock\Debug\Model\Info\CacheInfo $cacheInfo;
private \ClawRock\Debug\Helper\Formatter $formatter;

public function __construct(
\ClawRock\Debug\Helper\Config $config,
private \ClawRock\Debug\Helper\Config $config,
\ClawRock\Debug\Model\DataCollectorFactory $dataCollectorFactory,
\ClawRock\Debug\Logger\DataLoggerFactory $dataLogger,
\ClawRock\Debug\Model\Info\CacheInfo $cacheInfo,
\ClawRock\Debug\Helper\Formatter $formatter
private \ClawRock\Debug\Model\Info\CacheInfo $cacheInfo,
private \ClawRock\Debug\Helper\Formatter $formatter
) {
$this->config = $config;
$this->dataCollector = $dataCollectorFactory->create();
$this->dataLogger = $dataLogger->create();
$this->cacheInfo = $cacheInfo;
$this->formatter = $formatter;
}

public function collect(): CollectorInterface
Expand Down
24 changes: 6 additions & 18 deletions Model/Collector/ConfigCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,18 @@ class ConfigCollector implements CollectorInterface
public const WINCACHE_ENABLED = 'wincache_enabled';
public const OPCACHE_ENABLED = 'zend_opcache_enabled';

private \Magento\Store\Model\StoreManagerInterface $storeManager;
private \ClawRock\Debug\Helper\Config $config;
private \ClawRock\Debug\Helper\Url $url;
private \ClawRock\Debug\Model\DataCollector $dataCollector;
private \ClawRock\Debug\Model\Info\MagentoInfo $magentoInfo;
private \ClawRock\Debug\Model\Info\ExtensionInfo $extensionInfo;
private \ClawRock\Debug\Model\Storage\HttpStorage $httpStorage;

public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
\ClawRock\Debug\Helper\Config $config,
\ClawRock\Debug\Helper\Url $url,
private \Magento\Store\Model\StoreManagerInterface $storeManager,
private \ClawRock\Debug\Helper\Config $config,
private \ClawRock\Debug\Helper\Url $url,
\ClawRock\Debug\Model\DataCollectorFactory $dataCollectorFactory,
\ClawRock\Debug\Model\Info\MagentoInfo $magentoInfo,
\ClawRock\Debug\Model\Info\ExtensionInfo $extensionInfo,
\ClawRock\Debug\Model\Storage\HttpStorage $httpStorage
private \ClawRock\Debug\Model\Info\MagentoInfo $magentoInfo,
private \ClawRock\Debug\Model\Info\ExtensionInfo $extensionInfo,
private \ClawRock\Debug\Model\Storage\HttpStorage $httpStorage
) {
$this->storeManager = $storeManager;
$this->config = $config;
$this->dataCollector = $dataCollectorFactory->create();
$this->magentoInfo = $magentoInfo;
$this->extensionInfo = $extensionInfo;
$this->httpStorage = $httpStorage;
$this->url = $url;
}

public function collect(): CollectorInterface
Expand Down
Loading