Skip to content

Commit d98c315

Browse files
author
Radek Toczek
committed
initial commit
0 parents  commit d98c315

File tree

160 files changed

+10780
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+10780
-0
lines changed

Block/Profiler.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace ClawRock\Debug\Block;
4+
5+
use ClawRock\Debug\Model\DataCollector\DataCollectorInterface;
6+
use Magento\Framework\View\Element\Template;
7+
8+
class Profiler extends Template
9+
{
10+
/**
11+
* @var \ClawRock\Debug\Model\Profile
12+
*/
13+
protected $profile;
14+
15+
/**
16+
* @var \Magento\Framework\Registry
17+
*/
18+
protected $registry;
19+
20+
/**
21+
* @var \ClawRock\Debug\Helper\Profiler
22+
*/
23+
protected $helper;
24+
25+
public function __construct(
26+
\Magento\Framework\View\Element\Template\Context $context,
27+
\Magento\Framework\Registry $registry,
28+
\ClawRock\Debug\Helper\Profiler $helper,
29+
array $data = []
30+
) {
31+
parent::__construct($context, $data);
32+
$this->registry = $registry;
33+
$this->helper = $helper;
34+
}
35+
36+
public function getProfile()
37+
{
38+
if ($this->profile === null) {
39+
$this->profile = $this->registry->registry('current_profile');
40+
}
41+
42+
return $this->profile;
43+
}
44+
45+
public function getToken()
46+
{
47+
return $this->getProfile()->getToken();
48+
}
49+
50+
public function getProfilerUrl($token = null, $panel = null)
51+
{
52+
return $this->helper->getUrl($token, $panel);
53+
}
54+
55+
public function getCollectorUrl($token, DataCollectorInterface $collector)
56+
{
57+
return $this->helper->getCollectorUrl($token, $collector);
58+
}
59+
}

Block/Profiler/Collector.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace ClawRock\Debug\Block\Profiler;
4+
5+
use ClawRock\Debug\Model\DataCollector\DataCollectorInterface;
6+
use Symfony\Component\VarDumper\VarDumper;
7+
8+
class Collector extends \ClawRock\Debug\Block\Profiler
9+
{
10+
/**
11+
* @var \ClawRock\Debug\Model\DataCollector\DataCollectorInterface
12+
*/
13+
protected $collector;
14+
15+
/**
16+
* @var \ClawRock\Debug\Block\Profiler\Renderer\TableRenderer
17+
*/
18+
protected $tableRenderer;
19+
20+
public function __construct(
21+
\Magento\Framework\View\Element\Template\Context $context,
22+
\Magento\Framework\Registry $registry,
23+
\ClawRock\Debug\Helper\Profiler $helper,
24+
\ClawRock\Debug\Block\Profiler\Renderer\TableRenderer $tableRenderer,
25+
array $data = []
26+
) {
27+
parent::__construct($context, $registry, $helper, $data);
28+
$this->tableRenderer = $tableRenderer;
29+
}
30+
31+
public function setCollector(DataCollectorInterface $collector)
32+
{
33+
$this->collector = $collector;
34+
35+
return $this;
36+
}
37+
38+
public function getCollector()
39+
{
40+
return $this->collector;
41+
}
42+
43+
public function renderTable($data, $labels = null)
44+
{
45+
return $this->tableRenderer->render(['items' => $data, 'labels' => $labels]);
46+
}
47+
48+
public function dump($value)
49+
{
50+
return VarDumper::dump($value);
51+
}
52+
}

Block/Profiler/Collector/Cache.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace ClawRock\Debug\Block\Profiler\Collector;
4+
5+
use ClawRock\Debug\Block\Profiler\Collector;
6+
7+
class Cache extends Collector
8+
{
9+
/**
10+
* @var \Magento\Framework\App\Cache\TypeListInterface
11+
*/
12+
protected $typeList;
13+
14+
public function __construct(
15+
\Magento\Framework\View\Element\Template\Context $context,
16+
\Magento\Framework\Registry $registry,
17+
\ClawRock\Debug\Helper\Profiler $helper,
18+
\ClawRock\Debug\Block\Profiler\Renderer\TableRenderer $tableRenderer,
19+
\Magento\Framework\App\Cache\TypeListInterface $typeList,
20+
array $data = []
21+
) {
22+
parent::__construct($context, $registry, $helper, $tableRenderer, $data);
23+
$this->typeList = $typeList;
24+
}
25+
26+
public function getCacheTypes()
27+
{
28+
return $this->typeList->getTypes();
29+
}
30+
31+
public function isInvalidated($type)
32+
{
33+
return in_array($type, array_keys($this->typeList->getInvalidated()));
34+
}
35+
}

Block/Profiler/Collector/Config.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace ClawRock\Debug\Block\Profiler\Collector;
4+
5+
use ClawRock\Debug\Block\Profiler\Collector;
6+
use Magento\Framework\App\Area;
7+
8+
class Config extends Collector
9+
{
10+
/**
11+
* @var \Magento\Backend\Model\UrlInterface
12+
*/
13+
protected $backendUrl;
14+
15+
public function __construct(
16+
\Magento\Framework\View\Element\Template\Context $context,
17+
\Magento\Framework\Registry $registry,
18+
\ClawRock\Debug\Helper\Profiler $helper,
19+
\ClawRock\Debug\Block\Profiler\Renderer\TableRenderer $tableRenderer,
20+
\Magento\Backend\Model\UrlInterface $backendUrl,
21+
array $data = []
22+
) {
23+
parent::__construct($context, $registry, $helper, $tableRenderer, $data);
24+
$this->backendUrl = $backendUrl;
25+
}
26+
27+
public function getAdminUrl()
28+
{
29+
return $this->backendUrl->getRouteUrl(Area::AREA_ADMINHTML);
30+
}
31+
32+
public function getConfigurationUrl()
33+
{
34+
return $this->backendUrl->getUrl('system_config/edit/section/clawrock_debug');
35+
}
36+
}

Block/Profiler/Collector/Customer.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace ClawRock\Debug\Block\Profiler\Collector;
4+
5+
use ClawRock\Debug\Block\Profiler\Collector;
6+
7+
class Customer extends Collector
8+
{
9+
/**
10+
* @var \Magento\Framework\UrlInterface
11+
*/
12+
protected $url;
13+
14+
public function __construct(
15+
\Magento\Framework\View\Element\Template\Context $context,
16+
\Magento\Framework\Registry $registry,
17+
\ClawRock\Debug\Helper\Profiler $helper,
18+
\ClawRock\Debug\Block\Profiler\Renderer\TableRenderer $tableRenderer,
19+
\Magento\Framework\UrlInterface $url,
20+
array $data = []
21+
) {
22+
parent::__construct($context, $registry, $helper, $tableRenderer, $data);
23+
$this->url = $url;
24+
}
25+
26+
public function getLoginUrl()
27+
{
28+
return $this->url->getUrl('customer/account/login');
29+
}
30+
31+
public function getLogoutUrl()
32+
{
33+
return $this->url->getUrl('customer/account/logout');
34+
}
35+
36+
public function getRegisterUrl()
37+
{
38+
return $this->url->getUrl('customer/account/create');
39+
}
40+
}

0 commit comments

Comments
 (0)