Skip to content

Commit

Permalink
PHPCS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Jul 7, 2021
1 parent 580f4f0 commit 83a0b64
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 44 deletions.
3 changes: 1 addition & 2 deletions Block/Adminhtml/System/Config/Gd.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Block\Adminhtml\System\Config;

Expand Down
8 changes: 5 additions & 3 deletions Block/Adminhtml/System/Config/ModuleVersion.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Block\Adminhtml\System\Config;

use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Component\ComponentRegistrar;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Exception\ValidatorException;
use Magento\Framework\Filesystem\Directory\ReadFactory as DirectoryReadFactory;
use Magento\Framework\Filesystem\File\ReadFactory as FileReadFactory;
use Magento\Framework\Module\ModuleListInterface;
Expand Down Expand Up @@ -115,6 +115,8 @@ public function getModuleVersion(): string

/**
* @return string
* @throws FileSystemException
* @throws ValidatorException
*/
private function getModuleVersionFromComposer(): string
{
Expand Down
3 changes: 1 addition & 2 deletions Block/Adminhtml/System/Config/PhpVersion.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Block\Adminhtml\System\Config;

Expand Down
3 changes: 1 addition & 2 deletions Block/Picture.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Block;

Expand Down
3 changes: 1 addition & 2 deletions Browser/BrowserSupport.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Browser;

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Fixed
- Add current store to all methods
- Make sure ConvertorListing works even though no convertor is available

## [0.2.2] - 29 June 2021
Expand Down
20 changes: 3 additions & 17 deletions Image/File.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Image;

Expand All @@ -19,11 +17,6 @@ class File
*/
private $directoryList;

/**
* @var DirectoryReadFactory
*/
private $directoryReadFactory;

/**
* @var FileDriver
*/
Expand All @@ -43,20 +36,17 @@ class File
* File constructor.
*
* @param DirectoryList $directoryList
* @param DirectoryReadFactory $directoryReadFactory
* @param FileDriver $fileDriver
* @param Debugger $debugger
* @param FileReadFactory $fileReadFactory
*/
public function __construct(
DirectoryList $directoryList,
DirectoryReadFactory $directoryReadFactory,
FileDriver $fileDriver,
Debugger $debugger,
FileReadFactory $fileReadFactory
) {
$this->directoryList = $directoryList;
$this->directoryReadFactory = $directoryReadFactory;
$this->fileDriver = $fileDriver;
$this->debugger = $debugger;
$this->fileReadFactory = $fileReadFactory;
Expand Down Expand Up @@ -124,12 +114,8 @@ public function uriExists(string $uri): bool
*/
public function fileExists($filePath): bool
{
try {
$fileRead = $this->fileReadFactory->create($filePath, 'file');
return (bool)$fileRead->readAll();
} catch (FileSystemException $fileSystemException) {
return false;
}
$fileRead = $this->fileReadFactory->create($filePath, 'file');
return (bool)$fileRead->readAll();
}

/**
Expand Down
13 changes: 5 additions & 8 deletions Image/HtmlReplacer.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Image;

use Exception as ExceptionAlias;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\LayoutInterface;
use Yireo\NextGenImages\Block\Picture;
use Yireo\NextGenImages\Config\Config;
use Yireo\NextGenImages\Convertor\ConvertorListing;
use Yireo\NextGenImages\Exception\ConvertorException;
use Yireo\NextGenImages\Exception\NoConversionNeededException;
use Yireo\NextGenImages\Logger\Debugger;

class HtmlReplacer
Expand All @@ -30,6 +26,7 @@ class HtmlReplacer
* @var Config
*/
private $config;

/**
* @var UrlInterface
*/
Expand All @@ -41,6 +38,7 @@ class HtmlReplacer
* @param ConvertorListing $convertorListing
* @param Debugger $debugger
* @param Config $config
* @param UrlInterface $url
*/
public function __construct(
ConvertorListing $convertorListing,
Expand Down Expand Up @@ -141,7 +139,7 @@ private function getNewHtmlTag(
$htmlTag,
bool $isDataSrc = false
): string {
return (string)$this->getPictureBlock($layout)
return $this->getPictureBlock($layout)
->setOriginalImage($imageUrl)
->setSourceImages($sourceImages)
->setAltText($this->getAttributeText($htmlTag, 'alt'))
Expand All @@ -163,8 +161,7 @@ private function getAttributeText(string $htmlTag, string $attribute): string
{
if (preg_match('/\ ' . $attribute . '=\"([^\"]+)/', $htmlTag, $match)) {
$altText = $match[1];
$altText = strtr($altText, ['"' => '', "'" => '']);
return $altText;
return strtr($altText, ['"' => '', "'" => '']);
}

return '';
Expand Down
3 changes: 1 addition & 2 deletions Logger/Debugger.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Logger;

Expand Down
4 changes: 1 addition & 3 deletions Plugin/CorrectImagesInAjaxResponse.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Plugin;

Expand Down
4 changes: 1 addition & 3 deletions Plugin/ReplaceTagsPlugin.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);

namespace Yireo\NextGenImages\Plugin;

use Exception as ExceptionAlias;
use Magento\Framework\View\LayoutInterface;
use Yireo\NextGenImages\Image\HtmlReplacer;

Expand Down

0 comments on commit 83a0b64

Please sign in to comment.