Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 #29

Merged
merged 6 commits into from
Apr 8, 2023
Merged

V3 #29

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[{*.rst,*.rst.txt}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 3
max_line_length = 80

# MD-Files
[*.md]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
max_line_length = 80
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.github/ export-ignore
/Build/ export-ignore
/Tests/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/.scrutinizer export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.Build
/Build/Local/.phpunit.result.cache
/composer.lock
/.php_cs.cache
/Documentation-GENERATED-temp
/Tests/Build/.phpunit.result.cache
.DS_Store
/.idea
27 changes: 5 additions & 22 deletions Classes/Command/CountCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,26 @@

class CountCommand extends Command
{
private ?LocalizationUtility $localizationUtility;

private ?FileRepository $fileRepository;

protected function configure(): void
{
$this->setDescription('Counts all videos of a media extension');
$this->setDescription('Counts all videos of a media extension, e.g. YouTube');
$this->addOption(
'extension',
null,
InputOption::VALUE_REQUIRED,
'e.g. Youtube',
''
'Media Extension (e.g. YouTube)',
'YouTube'
);
}

/**
* @param LocalizationUtility|null $localizationUtility
* @param FileRepository|null $fileRepository
*/
public function __construct(
LocalizationUtility $localizationUtility = null,
FileRepository $fileRepository = null
protected LocalizationUtility $localizationUtility,
protected FileRepository $fileRepository
)
{
$this->localizationUtility = $localizationUtility;
$this->fileRepository = $fileRepository;
parent::__construct();
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int
* @throws \Doctrine\DBAL\Driver\Exception
* @throws \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
Expand Down
56 changes: 10 additions & 46 deletions Classes/Command/ReportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,9 @@

class ReportCommand extends Command
{
private ?ResourceFactory $resourceFactory;

private ?FileRepository $fileRepository;

private ?LocalizationUtility $localizationUtility;

private ?EventDispatcherInterface $eventDispatcher;

protected function configure(): void
{
$this->setDescription('Make a video report');
$this->setDescription('Send report of video validation for a defined media extension (e.g. YouTube)');
$this->addOption(
'recipients',
null,
Expand All @@ -44,8 +36,8 @@ protected function configure(): void
'extension',
null,
InputOption::VALUE_REQUIRED,
'Name of the video extension',
''
'Name of the media extension',
'YouTube'
);
$this->addOption(
'days',
Expand All @@ -58,8 +50,8 @@ protected function configure(): void
'referencedOnly',
null,
InputOption::VALUE_OPTIONAL,
'Whether to only fetch records that are referenced on visible pages and content elements (true/false)',
false
'Whether to only fetch records that are referenced on visible pages and content elements (1/0)',
0
);
$this->addOption(
'referenceRoot',
Expand All @@ -70,36 +62,16 @@ protected function configure(): void
);
}

/**
* @param ResourceFactory|null $resourceFactory
* @param FileRepository|null $fileRepository
* @param LocalizationUtility|null $localizationUtility
*/
public function __construct(
ResourceFactory $resourceFactory = null,
FileRepository $fileRepository = null,
LocalizationUtility $localizationUtility = null,
EventDispatcherInterface $eventDispatcher = null
protected ResourceFactory $resourceFactory,
protected FileRepository $fileRepository,
protected LocalizationUtility $localizationUtility,
protected EventDispatcherInterface $eventDispatcher
)
{
$this->resourceFactory = $resourceFactory;
$this->fileRepository = $fileRepository;
$this->localizationUtility = $localizationUtility;
$this->eventDispatcher = $eventDispatcher;
parent::__construct();
}

/**
* Generates video report
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
* @throws FileDoesNotExistException
* @throws \Doctrine\DBAL\Driver\Exception
* @throws \Doctrine\DBAL\Exception
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
Expand Down Expand Up @@ -164,14 +136,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::SUCCESS;
}

/**
* @param ValidatorDemand $validatorDemand
* @param int $status
* @return array
* @throws \Doctrine\DBAL\Driver\Exception
* @throws \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
* @throws \Doctrine\DBAL\Exception
*/
protected function getVideosByStatus(ValidatorDemand $validatorDemand, int $status): array
{
$videos = [];
Expand All @@ -180,7 +144,7 @@ protected function getVideosByStatus(ValidatorDemand $validatorDemand, int $stat
try {
$file = $this->resourceFactory->getFileObject($video['uid']);
$videos[] = $file;
} catch (FileDoesNotExistException $e) {
} catch (FileDoesNotExistException) {
}
}

Expand Down
27 changes: 5 additions & 22 deletions Classes/Command/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,26 @@

class ResetCommand extends Command
{
private ?LocalizationUtility $localizationUtility;

private ?FileRepository $fileRepository;

protected function configure(): void
{
$this->setDescription('Resets all video states of a media extension');
$this->setDescription('Resets all videos of a media extension, e.g. YouTube');
$this->addOption(
'extension',
null,
InputOption::VALUE_REQUIRED,
'e.g. Youtube',
''
'Media Extension (e.g. YouTube)',
'YouTube'
);
}

/**
* @param LocalizationUtility|null $localizationUtility
* @param FileRepository|null $fileRepository
*/
public function __construct(
LocalizationUtility $localizationUtility = null,
FileRepository $fileRepository = null
protected LocalizationUtility $localizationUtility,
protected FileRepository $fileRepository
)
{
$this->localizationUtility = $localizationUtility;
$this->fileRepository = $fileRepository;
parent::__construct();
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int
* @throws \Doctrine\DBAL\Driver\Exception
* @throws \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
Expand Down
35 changes: 7 additions & 28 deletions Classes/Command/ValidatorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@

class ValidatorCommand extends Command
{
private ?LocalizationUtility $localizationUtility;

private ?VideoService $videoService;

protected function configure(): void
{
$this->setDescription('Checks online videos in TYPO3 backend for accessibility like Youtube and Vimeo');
$this->setDescription('Video validation of a defined media extension (e.g. YouTube)');
$this->addOption(
'extension',
null,
InputOption::VALUE_REQUIRED,
'e.g. Youtube',
''
'Media Extension (e.g. YouTube)',
'YouTube'
);
$this->addOption(
'limit',
Expand All @@ -40,8 +36,8 @@ protected function configure(): void
'referencedOnly',
null,
InputOption::VALUE_OPTIONAL,
'Whether to only fetch records that are referenced on visible pages and content elements (true/false)',
false
'Whether to only fetch records that are referenced on visible pages and content elements (1/0)',
0
);
$this->addOption(
'referenceRoot',
Expand All @@ -52,30 +48,13 @@ protected function configure(): void
);
}

/**
* @param LocalizationUtility|null $localizationUtility
* @param VideoService|null $videoService
*/
public function __construct(
LocalizationUtility $localizationUtility = null,
VideoService $videoService = null
protected LocalizationUtility $localizationUtility,
protected VideoService $videoService
)
{
$this->localizationUtility = $localizationUtility;
$this->videoService = $videoService;
parent::__construct();
}

/**
* Executes validator
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
* @throws \Doctrine\DBAL\Driver\Exception
* @throws \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
* @throws \Doctrine\DBAL\Exception
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
Expand Down
Loading