├── .gitignore
├── .travis.yml
├── Api
├── Data
│ └── ProfileInterface.php
└── ProfileRepositoryInterface.php
├── App
├── AbstractAction.php
├── Action
│ ├── Context.php
│ └── Frontend
│ │ └── Context.php
├── Area
│ └── FrontNameResolver.php
├── Config.php
├── ConfigInterface.php
├── DefaultPath.php
├── Request
│ └── PathInfoProcessor.php
├── Router.php
└── Router
│ └── NoRouteHandler.php
├── Console
└── Command
│ ├── DatabaseProfilerDisableCommand.php
│ └── DatabaseProfilerEnableCommand.php
├── Controller
├── Adminhtml
│ └── Profiler
│ │ └── Config.php
└── Debug
│ ├── Cache
│ ├── Clean.php
│ ├── Disable.php
│ ├── Enable.php
│ └── Flush.php
│ ├── Profiler
│ ├── Info.php
│ ├── PHPInfo.php
│ ├── Purge.php
│ ├── Search.php
│ └── Toolbar.php
│ └── Xhprof
│ └── Detail.php
├── Exception
└── CollectorNotFoundException.php
├── Helper
├── Config.php
├── Database.php
├── Debug.php
├── File.php
├── Formatter.php
├── Injector.php
└── Url.php
├── Interception
├── CliCallmap.php
├── CliProfiler.php
├── Code
│ └── Generator
│ │ ├── Interceptor.php
│ │ └── SetupInterceptor.php
├── Interceptor.php
└── PluginDataCollector.php
├── Logger
├── DataLogger.php
├── Handler.php
├── LoggableInterface.php
└── Logger.php
├── Model
├── Collector
│ ├── AjaxCollector.php
│ ├── CacheCollector.php
│ ├── CallmapCollector.php
│ ├── CollectorInterface.php
│ ├── ConfigCollector.php
│ ├── CustomerCollector.php
│ ├── DatabaseCollector.php
│ ├── EventCollector.php
│ ├── LateCollectorInterface.php
│ ├── LayoutCollector.php
│ ├── LoggerCollectorInterface.php
│ ├── MemoryCollector.php
│ ├── ModelCollector.php
│ ├── PluginCollector.php
│ ├── RequestCollector.php
│ ├── TimeCollector.php
│ └── TranslationCollector.php
├── Config
│ ├── Database
│ │ └── ProfilerWriter.php
│ └── Source
│ │ ├── ErrorHandler.php
│ │ └── XhprofFlags.php
├── DataCollector.php
├── Indexer
│ └── ProfileIndexer.php
├── Info
│ ├── CacheInfo.php
│ ├── CallmapInfo.php
│ ├── CustomerInfo.php
│ ├── DatabaseInfo.php
│ ├── ExtensionInfo.php
│ ├── LayoutInfo.php
│ ├── MagentoInfo.php
│ ├── MemoryInfo.php
│ ├── PluginInfo.php
│ └── RequestInfo.php
├── Profile.php
├── Profile
│ └── Criteria.php
├── ProfileRepository.php
├── Profiler.php
├── Profiler
│ └── Driver
│ │ └── StopwatchDriver.php
├── Serializer
│ ├── CollectorSerializer.php
│ └── ProfileSerializer.php
├── Session.php
├── Storage
│ ├── HttpStorage.php
│ ├── ProfileFileStorage.php
│ └── ProfileMemoryStorage.php
├── Url
│ └── ScopeResolver.php
├── ValueObject
│ ├── Block.php
│ ├── CacheAction.php
│ ├── EventObserver.php
│ ├── LayoutNode.php
│ ├── LoopModelAction.php
│ ├── ModelAction.php
│ ├── Plugin.php
│ ├── Redirect.php
│ ├── SearchResult.php
│ └── Translation.php
└── View
│ ├── Menu.php
│ ├── Profiler.php
│ ├── Renderer
│ ├── LayoutGraphRenderer.php
│ ├── LayoutNodeRenderer.php
│ ├── ParametersRenderer.php
│ ├── QueryListRenderer.php
│ ├── QueryParametersRenderer.php
│ ├── QueryRenderer.php
│ ├── RedirectRenderer.php
│ ├── RendererInterface.php
│ ├── TableRenderer.php
│ ├── TraceCallRenderer.php
│ ├── TraceRenderer.php
│ ├── VarRenderer.php
│ └── XhprofProfile.php
│ ├── Search.php
│ ├── Summary.php
│ ├── Toolbar.php
│ └── Xhprof.php
├── Observer
├── AllowedIP.php
├── BeforeSendResponse.php
├── Collector
│ ├── LayoutCollectorAfterToHtml.php
│ └── LayoutCollectorBeforeToHtml.php
├── Config
│ └── DatabaseProfiler.php
├── DebugHandle.php
└── ValidateRedirect.php
├── Plugin
├── Collector
│ ├── CacheCollectorPlugin.php
│ ├── CallmapCollectorPlugin.php
│ ├── EventCollectorPlugin.php
│ ├── ModelCollectorPlugin.php
│ ├── TimeCollectorPlugin.php
│ └── TranslationCollectorPlugin.php
├── ErrorHandler
│ └── WhoopsPlugin.php
├── PageCache
│ └── KernelPlugin.php
└── ProfileRepository
│ └── RequestTimePlugin.php
├── Readme.md
├── Serializer
├── Serializer.php
└── SerializerInterface.php
├── composer.json
├── etc
├── adminhtml
│ ├── di.xml
│ ├── events.xml
│ ├── routes.xml
│ └── system.xml
├── config.xml
├── debug
│ ├── di.xml
│ └── routes.xml
├── di.xml
├── events.xml
├── frontend
│ └── routes.xml
└── module.xml
├── phpmd.xml
├── registration.php
└── view
└── base
├── layout
├── clawrock_debug.xml
├── debug_panel_cache.xml
├── debug_panel_callmap.xml
├── debug_panel_config.xml
├── debug_panel_database.xml
├── debug_panel_event.xml
├── debug_panel_layout.xml
├── debug_panel_model.xml
├── debug_panel_plugin.xml
├── debug_panel_request.xml
├── debug_panel_time.xml
├── debug_panel_translation.xml
├── debug_profiler_info.xml
├── debug_profiler_search.xml
├── debug_profiler_toolbar.xml
└── debug_xhprof_detail.xml
├── page_layout
├── profiler.xml
└── toolbar.xml
├── requirejs-config.js
├── templates
├── menu
│ ├── cache.phtml
│ ├── callmap.phtml
│ ├── config.phtml
│ ├── database.phtml
│ ├── event.phtml
│ ├── layout.phtml
│ ├── model.phtml
│ ├── plugin.phtml
│ ├── request.phtml
│ ├── settings.phtml
│ ├── time.phtml
│ └── translation.phtml
├── panel
│ ├── cache.phtml
│ ├── callmap.phtml
│ ├── callmap_detail.phtml
│ ├── config.phtml
│ ├── database.phtml
│ ├── event.phtml
│ ├── layout.phtml
│ ├── model.phtml
│ ├── plugin.phtml
│ ├── request.phtml
│ ├── time.phtml
│ └── translation.phtml
├── profiler.phtml
├── profiler
│ ├── js.phtml
│ ├── summary.phtml
│ └── toolbar
│ │ └── js.phtml
├── renderer
│ ├── layout
│ │ ├── graph.phtml
│ │ └── node.phtml
│ ├── parameters.phtml
│ ├── query.phtml
│ ├── query
│ │ └── list.phtml
│ ├── redirect.phtml
│ ├── table.phtml
│ ├── trace.phtml
│ └── trace
│ │ └── call.phtml
├── search
│ ├── input.phtml
│ └── results.phtml
├── toolbar.phtml
└── toolbar
│ ├── ajax.phtml
│ ├── cache.phtml
│ ├── callmap.phtml
│ ├── config.phtml
│ ├── customer.phtml
│ ├── database.phtml
│ ├── event.phtml
│ ├── layout.phtml
│ ├── memory.phtml
│ ├── model.phtml
│ ├── plugin.phtml
│ ├── request.phtml
│ ├── time.phtml
│ └── translation.phtml
└── web
├── css
├── jquery-ui.css
├── profiler.css
└── toolbar.css
├── images
├── collector
│ ├── ajax.svg
│ ├── cache.svg
│ ├── config.svg
│ ├── customer.svg
│ ├── database.svg
│ ├── event.svg
│ ├── layout.svg
│ ├── logs.svg
│ ├── memory.svg
│ ├── model.svg
│ ├── models.svg
│ ├── plugin.svg
│ ├── redirect.svg
│ ├── time.svg
│ └── translation.svg
├── icon
│ ├── close.svg
│ ├── menu.svg
│ ├── no.svg
│ ├── search.svg
│ ├── settings.svg
│ └── yes.svg
├── jquery-ui
│ ├── ui-icons_444444_256x240.png
│ ├── ui-icons_555555_256x240.png
│ ├── ui-icons_777620_256x240.png
│ ├── ui-icons_777777_256x240.png
│ ├── ui-icons_cc0000_256x240.png
│ └── ui-icons_ffffff_256x240.png
├── magento.svg
└── readme
│ ├── ajax.png
│ ├── cache.png
│ ├── callmap-main.png
│ ├── callmap-popup.png
│ ├── config.png
│ ├── database.png
│ ├── events.png
│ ├── homepage.png
│ ├── hyva.png
│ ├── layout-block-cache.png
│ ├── layout-render.png
│ ├── memory.png
│ ├── models.png
│ ├── performance.png
│ ├── plugins.png
│ ├── request.png
│ └── translation.png
└── js
├── callmap
└── extra-data.js
└── tablesorter.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea/
2 | composer.lock
3 | /vendor
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 |
3 | php:
4 | - 7.0
5 | - 7.1
6 | - 7.2
7 |
8 | install:
9 | - echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json
10 | - composer install --prefer-dist
11 |
12 | script:
13 | - php vendor/bin/phpcs --standard=PSR2 --extensions=php --ignore=etc,view,vendor .
14 | - php vendor/bin/phpmd . text phpmd.xml --suffixes=php
15 | - php vendor/bin/phpcpd . --exclude=etc --exclude=Test --exclude=view --exclude=vendor
16 | - php vendor/bin/phpunit --coverage-clover build/logs/clover.xml
17 |
18 | after_script:
19 | - php vendor/bin/php-coveralls
20 |
21 | env:
22 | global:
23 | - secure: VSM4hmQPJNRN6TcD4k1dbUJblG3gtEOGR08MuQA8AzKejHVcMLbz5auUJkHcSR+zKUimsINUFPRPn1A2lFTSfYttmiYZfpIIf0oQcs+wqp/v0UaO56G9nEzTmzRbxr9gz65eNzFJakfsg95CS1RGN6wVQK4LNOUYyHeT/saJ+69D9WdMH3qkWksWAyCYJoMd9zJFf5ojg7DtcwMzA+FC2AZcXMcwWBTY1yXInGaO87hz3VhodrJT2MapvEoB3PHul/2zAnHSfSJyQmioRa3QGdK6oXsckuZMafSpcVhWNN9bzMS7Z+nYTPJEeM085pAK6XUHKadCYdHDXEQEiG7OmJP5wMNEmw9aXRKS4wOc9IsuXHoGiO5jzeGFuXcj66yqPYBkotQ/uEUrCzZ758G9XvxqR4dI01uUcme35eSZg44PofXOtD34sxkW8Zkat/3RKJUHyqxeyms+0aPRtbeRXo3agw75Sr89n4AqapCPMnhVrKKDXOXbAV16+OCHIEalX8WrXnzDoBg/CK4EBI7AtRWV1PAdGXEVdXRrfVG4fEilwyIMHpCEXTZN3KPjnZsNKBwG4KGVAffIgm+jmR+hQQWCHo0c5roDUNY5ekG+FL54jwFB3e7Jq2x37iXBUDW/jLaRVab53T/ugAC3IZmJWILHPQ4VCzs1Jjt+6ojoLGM=
24 | - secure: aYHyyZwkkwcIgT0Drf4rncibv7DWUH74tpe6LNEyYnu11nPKv9sQD7xj3G9c2Z+rp3QSbN+QPyYtY0BY8KzGoLLoTHrmECOBi5O/kDyzFumo/p2Vt6YrFpOSn9GByuys8eL5o8LCtpKVWlvi0B5X3k693eLaHEy12VqpK2igB1HOUZC+2FNzO8U7gGH9aomOLxr08pW0uCk14KNj3KPCi/PixX1JP6KBt0OGyM7+nFBJzet9nDDdy16PDBTdcIYGnIAcE/JKtYdQek4OpvacKaCkfZ++wZ6u1c8oyO5SEPHZW8yiN1rjosXw8gE/dOJarrNeYo8gidAJHX6Tia7F+t23c2JcvIkSS5xInalWyvvrUntJ6eiAy8RZfxWTJzXrJ0aFhtbcmKhG8fR4QH83bfoF3nBHOT8551eadh7pjTz5CZ3NMzV5mQ3/+kXWctXOTgsTTlBG/9JZDszRIkPm8i3aTLt0JGVtQRnxuwBO8F5LZhGWVii4wwQBZj9vshlQ3lDcU9FF285aBwhQBfid7PjlyCKme0DK9/d4TjFWcTE7QQ4yVmbw9Q5pNigPNalNFI3N+xo4XOkyWWUk0E02C2i5oWdIHkrqyBm3lxYQyldYcwMnJk+DzPQB7UeHiuXknjZNyJjW7E4lkriRu/6aTisIvuC5G6QY2KCYMBNVH90=
25 |
--------------------------------------------------------------------------------
/Api/Data/ProfileInterface.php:
--------------------------------------------------------------------------------
1 | appConfig = $appConfig;
27 | }
28 |
29 | /**
30 | * @inheritdoc
31 | */
32 | public function getValue($path)
33 | {
34 | if (isset($this->data[$path])) {
35 | return $this->data[$path];
36 | }
37 |
38 | $configPath = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
39 | if ($path) {
40 | $configPath .= '/' . $path;
41 | }
42 | return $this->appConfig->get(System::CONFIG_TYPE, $configPath);
43 | }
44 |
45 | /**
46 | * @inheritdoc
47 | */
48 | public function setValue($path, $value)
49 | {
50 | $this->data[$path] = $value;
51 | }
52 |
53 | /**
54 | * @inheritdoc
55 | */
56 | public function isSetFlag($path)
57 | {
58 | $configPath = ScopeConfigInterface::SCOPE_TYPE_DEFAULT;
59 | if ($path) {
60 | $configPath .= '/' . $path;
61 | }
62 | return (bool) $this->appConfig->get(System::CONFIG_TYPE, $configPath);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/App/ConfigInterface.php:
--------------------------------------------------------------------------------
1 | getValue('web/default/debug'));
18 |
19 | $this->parts = [
20 | 'area' => isset($pathParts[0]) ? $pathParts[0] : '',
21 | 'module' => isset($pathParts[1]) ? $pathParts[1] : 'debug',
22 | 'controller' => isset($pathParts[2]) ? $pathParts[2] : 'index',
23 | 'action' => isset($pathParts[3]) ? $pathParts[3] : 'index',
24 | ];
25 | }
26 |
27 | /**
28 | * Retrieve default path part by code
29 | *
30 | * @param string $code
31 | * @return string
32 | */
33 | public function getPart($code)
34 | {
35 | return isset($this->parts[$code]) ? $this->parts[$code] : null;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/App/Request/PathInfoProcessor.php:
--------------------------------------------------------------------------------
1 | subject = $subject;
26 | $this->frontname = $frontNameResolver;
27 | }
28 |
29 | /**
30 | * Process path info
31 | *
32 | * @param \Magento\Framework\App\RequestInterface $request
33 | * @param string $pathInfo
34 | * @return string
35 | */
36 | public function process(\Magento\Framework\App\RequestInterface $request, $pathInfo)
37 | {
38 | $pathParts = explode('/', ltrim($pathInfo, '/'), 2);
39 | $firstPart = $pathParts[0];
40 |
41 | if ($firstPart != $this->frontNameResolver->getFrontName()) {
42 | return $this->subject->process($request, $pathInfo);
43 | }
44 | return $pathInfo;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/App/Router.php:
--------------------------------------------------------------------------------
1 | getPathInfo(), '/');
56 | $path = FrontNameResolver::AREA_CODE . '/' . $path;
57 |
58 | $params = explode('/', $path ? $path : $this->pathConfig->getDefaultPath());
59 | foreach ($this->_requiredParams as $paramName) {
60 | $output[$paramName] = array_shift($params);
61 | }
62 | //$output['moduleFrontName'] = 'debug';
63 | for ($i = 0, $l = sizeof($params); $i < $l; $i += 2) {
64 | $output['variables'][$params[$i]] = isset($params[$i + 1]) ? urldecode($params[$i + 1]) : '';
65 | }
66 | return $output;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/App/Router/NoRouteHandler.php:
--------------------------------------------------------------------------------
1 | frontNameResolver = $frontNameResolver;
25 | $this->routeConfig = $routeConfig;
26 | }
27 |
28 | /**
29 | * Check and process no route request
30 | *
31 | * @param \Magento\Framework\App\RequestInterface $request
32 | * @return bool
33 | */
34 | public function process(\Magento\Framework\App\RequestInterface $request)
35 | {
36 | $requestPathParams = explode('/', trim($request->getPathInfo(), '/'));
37 | $areaFrontName = array_shift($requestPathParams);
38 |
39 | if ($areaFrontName === $this->frontNameResolver->getFrontName(true)) {
40 | $moduleName = $this->routeConfig->getRouteFrontName('debug');
41 | $actionNamespace = 'noroute';
42 | $actionName = 'index';
43 | $request->setModuleName($moduleName)->setControllerName($actionNamespace)->setActionName($actionName);
44 | return true;
45 | }
46 | return false;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Console/Command/DatabaseProfilerDisableCommand.php:
--------------------------------------------------------------------------------
1 | profilerWriter = $profilerWriter;
22 | }
23 |
24 | protected function configure()
25 | {
26 | parent::configure();
27 |
28 | $this->setDescription('Disable database profiler required for database collector.');
29 | }
30 |
31 | /**
32 | * @SuppressWarnings(PHPMD.UnusedFormalParameter)
33 | */
34 | protected function execute(InputInterface $input, OutputInterface $output)
35 | {
36 | $this->profilerWriter->save(false);
37 |
38 | $output->writeLn('Database profiler disabled!');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Console/Command/DatabaseProfilerEnableCommand.php:
--------------------------------------------------------------------------------
1 | profilerWriter = $profilerWriter;
22 | }
23 |
24 | protected function configure()
25 | {
26 | parent::configure();
27 |
28 | $this->setDescription('Enable database profiler required for database collector.');
29 | }
30 |
31 | /**
32 | * @SuppressWarnings(PHPMD.UnusedFormalParameter)
33 | */
34 | protected function execute(InputInterface $input, OutputInterface $output)
35 | {
36 | $this->profilerWriter->save(true);
37 |
38 | $output->writeLn('Database profiler enabled!');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Controller/Adminhtml/Profiler/Config.php:
--------------------------------------------------------------------------------
1 | resultRedirectFactory->create();
20 |
21 | return $resultRedirect->setPath('admin/system_config/edit', [
22 | 'section' => 'daseraf_debug',
23 | 'key' => $this->_url->getSecretKey('adminhtml', 'system_config', 'edit'),
24 | ]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Controller/Debug/Cache/Clean.php:
--------------------------------------------------------------------------------
1 | cacheManager = $cacheManager;
21 | }
22 |
23 | public function execute()
24 | {
25 | $result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
26 | $types = $this->getRequest()->getParam('type');
27 |
28 | if (!$types) {
29 | $types = $this->cacheManager->getAvailableTypes();
30 | }
31 |
32 | $this->cacheManager->clean((array) $types);
33 |
34 | return $result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Controller/Debug/Cache/Disable.php:
--------------------------------------------------------------------------------
1 | cacheManager = $cacheManager;
21 | }
22 |
23 | public function execute()
24 | {
25 | $result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
26 | $types = $this->getRequest()->getParam('type');
27 |
28 | $this->cacheManager->setEnabled((array) $types, false);
29 |
30 | return $result;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Controller/Debug/Cache/Enable.php:
--------------------------------------------------------------------------------
1 | cacheManager = $cacheManager;
21 | }
22 |
23 | public function execute()
24 | {
25 | $result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
26 | $types = $this->getRequest()->getParam('type');
27 |
28 | $this->cacheManager->setEnabled((array) $types, true);
29 |
30 | return $result;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Controller/Debug/Cache/Flush.php:
--------------------------------------------------------------------------------
1 | cacheManager = $cacheManager;
21 | }
22 |
23 | public function execute()
24 | {
25 | $result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
26 | $types = $this->getRequest()->getParam('type');
27 |
28 | if (!$types) {
29 | $types = $this->cacheManager->getAvailableTypes();
30 | }
31 |
32 | $this->cacheManager->flush((array) $types);
33 |
34 | return $result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Controller/Debug/Profiler/PHPInfo.php:
--------------------------------------------------------------------------------
1 | resultFactory->create(ResultFactory::TYPE_RAW);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Controller/Debug/Profiler/Purge.php:
--------------------------------------------------------------------------------
1 | profileFileStorage = $profileFileStorage;
28 | $this->logger = $logger;
29 | }
30 |
31 | public function execute()
32 | {
33 | try {
34 | $this->profileFileStorage->purge();
35 | } catch (FileSystemException $e) {
36 | $this->logger->critical($e);
37 | }
38 |
39 | /** @var $resultRedirect */
40 | return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)
41 | ->setUrl($this->_redirect->getRefererUrl());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Controller/Debug/Profiler/Search.php:
--------------------------------------------------------------------------------
1 | layout = $layout;
30 | $this->profileRepository = $profileRepository;
31 | }
32 |
33 | /**
34 | * @SuppressWarnings(PHPMD.StaticAccess)
35 | * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
36 | */
37 | public function execute()
38 | {
39 | $request = $this->getRequest();
40 |
41 | if (!empty($token = $request->getParam('_token'))) {
42 | return $this->_redirect('debug/profiler/info', [Profiler::URL_TOKEN_PARAMETER => $token]);
43 | }
44 |
45 | /** @var \Magento\Framework\View\Result\Page $page */
46 | $page = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
47 |
48 | $page->addPageLayoutHandles([
49 | 'profiler' => 'info',
50 | ], 'debug');
51 |
52 | $criteria = Criteria::createFromRequest($request);
53 |
54 | $this->layout->getBlock('debug.profiler.panel.content')->addData([
55 | 'results' => $this->profileRepository->find($criteria),
56 | 'criteria' => $criteria,
57 | ]);
58 |
59 | return $page;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Controller/Debug/Profiler/Toolbar.php:
--------------------------------------------------------------------------------
1 | profileMemoryStorage = $profileMemoryStorage;
28 | $this->profileRepository = $profileRepository;
29 | }
30 |
31 | public function execute()
32 | {
33 | $token = $this->getRequest()->getParam(Profiler::URL_TOKEN_PARAMETER);
34 | $profile = $this->profileRepository->getById($token);
35 | $this->profileMemoryStorage->write($profile);
36 |
37 | return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Exception/CollectorNotFoundException.php:
--------------------------------------------------------------------------------
1 | isBacktraceItemValid($item, $functions)) {
22 | array_shift($backtrace);
23 | $item = reset($backtrace);
24 | }
25 |
26 | return array_map(function ($item) {
27 | unset($item['object'], $item['args'], $item['type']);
28 |
29 | return $item;
30 | }, $backtrace);
31 | }
32 |
33 | private function isBacktraceItemValid(array $data, array $functions): bool
34 | {
35 | if (!isset($data['class'], $data['function'])) {
36 | return false;
37 | }
38 |
39 | if (empty($functions)) {
40 | return true;
41 | }
42 |
43 | if (!in_array($data['function'], $functions)) {
44 | return false;
45 | }
46 |
47 | return true;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Helper/File.php:
--------------------------------------------------------------------------------
1 | directoryList = $directoryList;
16 | }
17 |
18 | /**
19 | * @throws \Magento\Framework\Exception\FileSystemException
20 | * @return string
21 | */
22 | public function getProfileDirectory()
23 | {
24 | return $this->directoryList->getPath('var') . DIRECTORY_SEPARATOR . 'debug';
25 | }
26 |
27 | /**
28 | * @throws \Magento\Framework\Exception\FileSystemException
29 | * @return string
30 | */
31 | public function getProfileIndex()
32 | {
33 | return $this->directoryList->getPath('var') . DIRECTORY_SEPARATOR . 'debug' . DIRECTORY_SEPARATOR . 'index.csv';
34 | }
35 |
36 | public function getProfileTempIndex()
37 | {
38 | return $this->directoryList->getPath('var') . DIRECTORY_SEPARATOR . 'debug' . DIRECTORY_SEPARATOR . 'tmp'
39 | . DIRECTORY_SEPARATOR . 'index.csv';
40 | }
41 |
42 | /**
43 | * @param $token
44 | * @throws \Magento\Framework\Exception\FileSystemException
45 | * @return string
46 | */
47 | public function getProfileFilename($token)
48 | {
49 | return $this->getProfileDirectory() . DIRECTORY_SEPARATOR
50 | . substr($token, -2, 2) . DIRECTORY_SEPARATOR
51 | . substr($token, -4, 2) . DIRECTORY_SEPARATOR
52 | . $token;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Helper/Formatter.php:
--------------------------------------------------------------------------------
1 | config = $config;
16 | }
17 |
18 | public function microtime(float $value, int $precision = null)
19 | {
20 | if ($precision === null) {
21 | $precision = $this->config->getTimePrecision();
22 | }
23 |
24 | return sprintf('%0.' . $precision . 'f', $value * 1000);
25 | }
26 |
27 | public function revertMicrotime(string $value): float
28 | {
29 | return (float) $value / 1000;
30 | }
31 |
32 | public function toMegaBytes(int $value, int $precision = 0)
33 | {
34 | return sprintf('%0.' . $precision . 'f', $value / 1024 / 1024);
35 | }
36 |
37 | public function formatBytes($bytes, $to, $decimal_places = 3)
38 | {
39 | $formulas = [
40 | 'K' => number_format($bytes / 1024, $decimal_places),
41 | 'M' => number_format($bytes / 1048576, $decimal_places),
42 | 'G' => number_format($bytes / 1073741824, $decimal_places),
43 | ];
44 |
45 | return $formulas[$to] ?? 0;
46 | }
47 |
48 | public function percentage(float $value, int $precision = 5)
49 | {
50 | return sprintf('%.' . $precision . 'f%%', $value * 100);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Helper/Injector.php:
--------------------------------------------------------------------------------
1 | layout = $layout;
26 | $this->viewModel = $viewModel;
27 | }
28 |
29 | public function inject(Request $request, Response $response, $token = null)
30 | {
31 | $content = $response->getBody();
32 | $pos = strripos($content, '