Skip to content

Commit

Permalink
[TASK] Manual fixes for v11
Browse files Browse the repository at this point in the history
  • Loading branch information
david-km2 authored and NarkNiro committed Apr 20, 2023
1 parent 0937374 commit a24b71d
Show file tree
Hide file tree
Showing 19 changed files with 76 additions and 93 deletions.
2 changes: 1 addition & 1 deletion Classes/Analyzers/AbstractAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class AbstractAnalyzer implements AnalyzerInterface
{
final const TYPE_INTERNAL = 'internal';

protected string $type = '';
protected string $type = '';

/**
* @var array
Expand Down
5 changes: 1 addition & 4 deletions Classes/Analyzers/NewsAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
*/
class NewsAnalyzer extends AbstractAnalyzer
{
/**
* @var string
*/
protected $type = AbstractAnalyzer::TYPE_INTERNAL;
protected string $type = AbstractAnalyzer::TYPE_INTERNAL;

/**
* Return an aray of news record Uids to check
Expand Down
5 changes: 1 addition & 4 deletions Classes/Analyzers/PageContentAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
*/
class PageContentAnalyzer extends AbstractAnalyzer
{
/**
* @var string
*/
protected $type = AbstractAnalyzer::TYPE_INTERNAL;
protected string $type = AbstractAnalyzer::TYPE_INTERNAL;

/**
* Return an aray of page record Uids to check
Expand Down
4 changes: 2 additions & 2 deletions Classes/CheckUrlGenerators/AbstractCheckUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
abstract class AbstractCheckUrlGenerator
{
/**
* @var array
* @var array[]
*/
protected $requiredConfiguration = [];
protected array $requiredConfiguration = [];

protected string $tableName = '';

Expand Down
4 changes: 2 additions & 2 deletions Classes/CheckUrlGenerators/NewsDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
class NewsDetail extends AbstractCheckUrlGenerator
{
/**
* @var array
* @var array[]
*/
protected $requiredConfiguration = ['targetPid'];
protected array $requiredConfiguration = ['targetPid'];

/**
* @var int
Expand Down
2 changes: 1 addition & 1 deletion Classes/CheckUrlGenerators/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Page extends AbstractCheckUrlGenerator
/**
* Page constructor.
*
* @param array $configuration
* @param array[] $configuration
*/
public function __construct(array $configuration)
{
Expand Down
9 changes: 3 additions & 6 deletions Classes/CheckUrlGenerators/PageContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
class PageContent extends AbstractCheckUrlGenerator
{
/**
* @var array
* @var array[]
*/
protected $requiredConfiguration = ['targetPid'];
protected array $requiredConfiguration = ['targetPid'];

/**
* @var int
*/
protected $targetPid = 0;
protected int $targetPid = 0;

protected array $ignoredContentTypes = [];

Expand Down
2 changes: 1 addition & 1 deletion Classes/Command/PresetByPageUidCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
declare(strict_types=1);
namespace UniWue\UwA11yCheck\Command;

use TYPO3\CMS\Extbase\Object\ObjectManager;
use UniWue\UwA11yCheck\Check\Preset;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use UniWue\UwA11yCheck\Check\Result\Impact;
use UniWue\UwA11yCheck\Check\ResultSet;
use UniWue\UwA11yCheck\Service\PresetService;
Expand Down
51 changes: 23 additions & 28 deletions Classes/Controller/A11yCheckController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use TYPO3\CMS\Fluid\View\TemplateView;
use UniWue\UwA11yCheck\Domain\Model\Dto\CheckDemand;
use UniWue\UwA11yCheck\Service\PresetService;
use UniWue\UwA11yCheck\Service\ResultsService;
Expand All @@ -30,36 +33,30 @@ class A11yCheckController extends ActionController
final const LANG_CORE = 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:';
final const LANG_LOCAL = 'LLL:EXT:uw_a11y_check/Resources/Private/Language/locallang.xlf:';

protected PresetService $presetService;

private ModuleTemplateFactory $moduleTemplateFactory;


/**
* @var PresetService
* The current page uid
*/
protected $presetService;
public function __construct(private ModuleTemplateFactory $moduleTemplateFactory)
protected int $pid = 0;

protected IconFactory $iconFactory;

protected ResultsService $resultsService;

public function __construct(ModuleTemplateFactory $moduleTemplateFactory)
{
$this->moduleTemplateFactory = $moduleTemplateFactory;
}

public function injectPresetService(PresetService $presetService): void
{
$this->presetService = $presetService;
}

/**
* The current page uid
*
* @var int
*/
protected $pid = 0;

/**
* @var IconFactory
*/
protected $iconFactory;

/**
* @var ResultsService
*/
protected $resultsService;

/**
* Set up the doc header properly here
*/
Expand All @@ -70,10 +67,10 @@ protected function initializeView(ViewInterface $view): void
parent::initializeView($view);

$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$this->resultsService = $this->objectManager->get(ResultsService::class);
$this->resultsService =GeneralUtility::makeInstance(ObjectManager::class)->get(ResultsService::class);

$moduleTemplate->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
if ($view instanceof BackendTemplateView) {
if ($view instanceof TemplateView) {
$moduleTemplate->getPageRenderer()->addCssFile(
'EXT:uw_a11y_check/Resources/Public/Css/a11y_check.css'
);
Expand All @@ -94,10 +91,9 @@ public function initializeAction(): void
/**
* Index action
*
* @param CheckDemand $checkDemand
* @IgnoreValidation("checkDemand")
*/
public function indexAction($checkDemand = null): ResponseInterface
public function indexAction(CheckDemand $checkDemand = null): ResponseInterface
{
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
if ($checkDemand === null) {
Expand All @@ -115,7 +111,6 @@ public function indexAction($checkDemand = null): ResponseInterface
]
);
}

$this->view->assignMultiple([
'checkDemand' => $checkDemand,
'presets' => $this->presetService->getPresets(),
Expand Down Expand Up @@ -197,7 +192,7 @@ public function acknowledgeResultAction(int $pageUid): ResponseInterface
protected function createMenu(): void
{
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
$uriBuilder = $this->objectManager->get(UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$uriBuilder->setRequest($this->request);

$menu = $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
Expand Down Expand Up @@ -229,8 +224,8 @@ protected function createDefaultButtons(): void
// Shortcut
if ($this->getBackendUser()->mayMakeShortcut()) {
$shortcutButton = $buttonBar->makeShortcutButton()
->setModuleName('web_UwA11yCheckTxUwa11ycheckM1')
->setGetVariables(['route', 'module', 'id'])
->setRouteIdentifier('web_UwA11yCheckTxUwa11ycheckM1')
->setArguments(['route', 'module', 'id'])
->setDisplayName('Shortcut');
$buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/ContentElementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function showAction(int $pageUid, string $ignoreContentTypes, string $hma
$expectedHmac = GeneralUtility::hmac($hmacString, 'page_content');

if ($expectedHmac !== $hmac) {
throw new Exception('HMAC does not match', 1_572_608_738_828);
throw new Exception('HMAC does not match', 1572608738828);
}

$whereCondition = 'colPos >= 0';
Expand Down
15 changes: 12 additions & 3 deletions Classes/Domain/Model/Dto/CheckDemand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@
*/
class CheckDemand extends AbstractEntity
{
protected string $analyze = '';
/**
* @var string
*/
protected $analyze = '';

protected ?Preset $preset = null;
/**
* @var \UniWue\UwA11yCheck\Check\Preset|null
*/
protected $preset = null;

protected int $level = 0;
/**
* @var int
*/
protected $level = 0;

public function getAnalyze(): string
{
Expand Down
8 changes: 6 additions & 2 deletions Classes/Domain/Model/Dto/SingleTableDemand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ class SingleTableDemand extends AbstractEntity
{
/**
* The tablename for the query
*
* @var int
*/
protected string $tableName = '';
protected $tableName = '';

/**
* Max results of records to return. Default is 50
*
* @var int
*/
protected int $maxResults = 50;
protected $maxResults = 50;

public function getTableName(): string
{
Expand Down
20 changes: 9 additions & 11 deletions Classes/Property/TypeConverter/PresetTypeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace UniWue\UwA11yCheck\Property\TypeConverter;

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Error\Error;
use TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface;
use TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter;
Expand All @@ -13,15 +14,8 @@
*/
class PresetTypeConverter extends AbstractTypeConverter
{
/**
* @var PresetService
*/
protected $presetService;
protected PresetService $presetService;

public function injectConfigurationService(PresetService $presetService): void
{
$this->presetService = $presetService;
}

/**
* @var array
Expand All @@ -38,22 +32,26 @@ public function injectConfigurationService(PresetService $presetService): void
*/
protected $priority = 1;

public function injectConfigurationService(PresetService $presetService): void
{
$this->presetService = $presetService;
}

/**
* @param mixed $source
* @param string $targetType
* @param PropertyMappingConfigurationInterface|null $configuration
* @return mixed|object|Error|Preset
*/
public function convertFrom(
$source,
$targetType,
string $targetType,
array $convertedChildProperties = [],
PropertyMappingConfigurationInterface $configuration = null
): Error|Preset {
$preset = $this->presetService->getPresetById($source);

if (!$preset instanceof Preset) {
return $this->objectManager->get(Error::class, 'Preset not found', 1_573_053_017_102);
return GeneralUtility::makeInstance(Error::class, 'Preset not found', 1573053017102);
}

return $preset;
Expand Down
5 changes: 1 addition & 4 deletions Classes/Service/PresetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
*/
class PresetService
{
/**
* @var YamlFileLoader
*/
protected $yamlFileLoader;
protected YamlFileLoader $yamlFileLoader;

protected ObjectManager $objectManager;

Expand Down
10 changes: 2 additions & 8 deletions Classes/Service/ResultsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@
*/
class ResultsService
{
/**
* @var SerializationService
*/
protected $serializationService;
protected SerializationService $serializationService;

/**
* @var PresetService
*/
protected $presetService;
protected PresetService $presetService;

public function injectSerializationService(SerializationService $serializationService): void
{
Expand Down
10 changes: 5 additions & 5 deletions Classes/Tests/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
*/
abstract class AbstractTest implements TestInterface
{
protected string $id = '';
protected $id = '';

protected string $description = '';
protected $description = '';

protected string $help = '';
protected $help = '';

protected string $helpUrl = '';
protected $helpUrl = '';

protected int $impact = 0;
protected $impact = 0;

public function getId(): string
{
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Partials/Results.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h3>
<div class="panel panel-default panel-a11y">
<div class="panel-heading impact-{resultSet.impact}" role="tab" id="heading-{preset.id}-{i.index}">
<h2 class="panel-title">
<a href="#resultset-{preset.id}-{i.index}" class="{f:if(condition: '{results -> f:count()} > 1', then: 'collapsed', else: '')}" data-toggle="collapse" aria-controls="#resultset-{i.index}">
<a href="#resultset-{preset.id}-{i.index}" class="{f:if(condition: '{results -> f:count()} > 1', then: 'collapsed', else: '')}" data-bs-toggle="collapse" aria-controls="#resultset-{i.index}">
<span class="caret"></span>
<strong>{resultSet.table} - {resultSet.uid}</strong>
</a>
Expand Down Expand Up @@ -88,4 +88,4 @@ <h2 class="panel-title">
</f:for>
</div>

</html>
</html>
Loading

0 comments on commit a24b71d

Please sign in to comment.