Skip to content

Commit

Permalink
PHP CS fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Jul 24, 2019
1 parent dd7166b commit 3297f62
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions Classes/Hooks/ElementBackendPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function getBackendPreview($row)
]);
$output = $view->render();
$cache->set($cacheIdentifier, $output);

return $output;
}

Expand Down
3 changes: 2 additions & 1 deletion Classes/Mapper/StringMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function canHandleType($type)
*/
public function getTcaConfiguration($fieldName, $overWriteLabel = false)
{
if (ReflectionUtility::is9orHigher() && $fieldName === 'slug') {
if (ReflectionUtility::is9orHigher() && 'slug' === $fieldName) {
return [
'exclude' => 1,
'label' => $overWriteLabel ? $overWriteLabel : $fieldName,
Expand All @@ -55,6 +55,7 @@ public function getTcaConfiguration($fieldName, $overWriteLabel = false)
],
];
}

return [
'exclude' => 1,
'label' => $overWriteLabel ? $overWriteLabel : $fieldName,
Expand Down
23 changes: 13 additions & 10 deletions Classes/Service/ReflectionService.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
<?php

/**
* ReflectionService
* ReflectionService.
*/

namespace HDNET\Autoloader\Service;

use HDNET\Autoloader\Utility\ReflectionUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;

/**
* ReflectionService
* ReflectionService.
*
* For TYPO3 9 and higher
*/
class ReflectionService
{

/**
* Get the tag value
* - Array (if the tag exist)
* - false (if the tag do not exists)
* - false (if the tag do not exists).
*
* @param string $className
* @param string $tag
*
* @return array|bool
*/
public function getClassTagValues(string $className, string $tag)
Expand All @@ -33,7 +34,7 @@ public function getClassTagValues(string $className, string $tag)
$classSchema = $coreReflectionService->getClassSchema($className);
$tags = $classSchema->getTags();

if (!array_key_exists($tag, $tags)) {
if (!\array_key_exists($tag, $tags)) {
return false;
}

Expand All @@ -46,10 +47,11 @@ public function getClassTagValues(string $className, string $tag)
/**
* Get method tag values
* - Array
* - False (if there are any problems)
* - False (if there are any problems).
*
* @param string $className
* @param string $methodName
*
* @return array|bool
*/
public function getMethodTagValues(string $className, string $methodName)
Expand All @@ -58,12 +60,13 @@ public function getMethodTagValues(string $className, string $methodName)
if ($this->is9orHigher()) {
$coreReflectionService = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
$classSchema = $coreReflectionService->getClassSchema($className);

return $classSchema->getMethod($methodName)['tags'] ?? [];
} else {
$classReflection = ReflectionUtility::createReflectionClass($className);
$methodReflection = $classReflection->getMethod($methodName);
return $methodReflection->getTagsValues();
}
$classReflection = ReflectionUtility::createReflectionClass($className);
$methodReflection = $classReflection->getMethod($methodName);

return $methodReflection->getTagsValues();
} catch (\Exception $e) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utility/ReflectionUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function getFirstTagValue(string $className, string $tag)
if (self::is9orHigher()) {
$reflectionService = GeneralUtility::makeInstance(\HDNET\Autoloader\Service\ReflectionService::class);
$values = $reflectionService->getClassTagValues($className, $tag);
if ($values === false) {
if (false === $values) {
return false;
}
} else {
Expand Down

0 comments on commit 3297f62

Please sign in to comment.