Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen van Leusden committed Jun 22, 2017
1 parent ae68768 commit 1007ffb
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 53 deletions.
30 changes: 11 additions & 19 deletions Block/Hints/Init.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2016 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
* Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
* See LICENSE.txt for license details.
*/

Expand All @@ -12,39 +12,32 @@
use Magento\Framework\View\Element\Context;

/**
*
*
* @package Ho\Templatehints\Block\Hints
*/
class Init extends AbstractBlock
{
/**
* A repository service for view assets
* @var \Magento\Framework\View\Asset\Repository
* A repository service for view assets.
*
* @var \Magento\Framework\View\Asset\Repository $assetRepository
*/
protected $assetRepository;
private $assetRepository;

/**
* List of page assets that combines into groups ones having the same properties
* @var AssetCollection
* List of page assets that combines into groups ones having the same properties.
*
* @var AssetCollection $assetCollection
*/
protected $assetCollection;

private $assetCollection;

/**
* Constructor
*
* @param Context $context
* @param AssetCollection $assetCollection
* @param Config $config
* @param array $data
*/
public function __construct(
Context $context,
AssetCollection $assetCollection,
Config $config,
array $data = []
) {
public function __construct(Context $context, AssetCollection $assetCollection, Config $config, array $data = [])
{
if ($config->isHintEnabled()) {
$this->assetRepository = $context->getAssetRepository();
$this->assetCollection = $assetCollection;
Expand All @@ -54,7 +47,6 @@ public function __construct(
return parent::__construct($context, $data);
}


/**
* Add assets to the header required for the initialisation of the scripts
*
Expand Down
35 changes: 17 additions & 18 deletions Plugin/View/LayoutPlugin.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* Copyright (c) 2016 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
* Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
* See LICENSE.txt for license details.
*/

namespace Ho\Templatehints\Plugin\View;

use Closure;
Expand All @@ -12,36 +13,30 @@
use Magento\Framework\View\Layout\Data\Structure;

/**
* When a block is rendered
* When a block is rendered.
*
* Class LayoutPlugin
* @package Ho\Templatehints\Plugin\View
*/
class LayoutPlugin
{

/**
* Layout model
* Layout model.
*
* @var Layout
* @var Layout $layout
*/
private $layout;

/**
* Magento directory listing
* Magento directory listing.
*
* @var DirectoryList
* @var DirectoryList $directoryList
*/
private $directoryList;

/**
* @var Structure
*/
/** @var Structure $structure */
private $structure;

/**
* LayoutPlugin constructor.
*
* @param DirectoryList $directoryList
* @param HintConfig $hintConfig
* @param Layout $layout
Expand All @@ -51,8 +46,8 @@ public function __construct(
HintConfig $hintConfig,
Layout $layout
) {
$this->hintConfig = $hintConfig;
$this->directoryList = $directoryList;
$this->hintConfig = $hintConfig;
$this->layout = $layout;

$layoutReflection = new \ReflectionClass($this->layout);
Expand All @@ -76,6 +71,7 @@ public function aroundRenderElement(Layout $layout, Closure $proceed, $name, $us
if ($this->hintConfig->isHintEnabled() === false) {
return $result;
}

return $this->_decorateElement($result, $name);
}

Expand Down Expand Up @@ -120,8 +116,7 @@ private function _decorateElement($result, $name)
*/
public function decorateOuterElement($html, $attributes)
{

if (!$html) {
if (! $html) {
return $html;
}

Expand All @@ -137,12 +132,13 @@ public function decorateOuterElement($html, $attributes)
$html,
1
);

return $html;
}

/**
* @param string $nameInLayout
* @param [] $container
* @param array $container
*
* @return string
*/
Expand Down Expand Up @@ -198,8 +194,10 @@ public static function filterEscapeEncode(array $data)
}

/**
* Filter and escape the complete array
* Filter and escape the complete array.
*
* @param $data
*
* @return array
*/
private static function filterEscape($data)
Expand Down Expand Up @@ -237,6 +235,7 @@ private function getBlockClass(\Magento\Framework\View\Element\AbstractBlock $bl
$reflector = new \ReflectionClass($block); //@codingStandardsIgnoreLine
$className = $reflector->getParentClass()->getName();
}

return $className;
}
}
10 changes: 4 additions & 6 deletions etc/di.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright (c) 2016 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
* See LICENSE.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
~ Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
~ See LICENSE.txt for license details.
-->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\View\Layout">
<plugin sortOrder="1" name="hoTemplatehintsLayout" type="Ho\Templatehints\Plugin\View\LayoutPlugin" />
</type>
Expand Down
8 changes: 3 additions & 5 deletions etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?xml version="1.0"?>
<!--
/**
* Copyright (c) 2016 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
* See LICENSE.txt for license details.
*/
-->
~ Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
~ See LICENSE.txt for license details.
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Ho_Templatehints" setup_version="0.2.1" />
</config>
9 changes: 4 additions & 5 deletions view/base/layout/default.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0"?>
<!--
/**
* Copyright (c) 2016 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
* See LICENSE.txt for license details.
*/
-->
~ Copyright © 2017 H&O E-commerce specialisten B.V. (http://www.h-o.nl/)
~ See LICENSE.txt for license details.
-->

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name='root'>
Expand Down

0 comments on commit 1007ffb

Please sign in to comment.