@@ -23,10 +23,8 @@ |
||
| 23 | 23 | * |
| 24 | 24 | * @access public |
| 25 | 25 | */ |
| 26 | -class SuggestBuildTask extends BaseTask |
|
| 27 | -{ |
|
| 28 | - public function execute() |
|
| 29 | - { |
|
| 26 | +class SuggestBuildTask extends BaseTask { |
|
| 27 | + public function execute() { |
|
| 30 | 28 | $inputArray = []; |
| 31 | 29 | $inputArray['-s'] = $this->solr; |
| 32 | 30 | |
@@ -74,12 +74,12 @@ |
||
| 74 | 74 | $solr = Solr::getInstance($input->getOption('solr')); |
| 75 | 75 | // Connect to Solr server. |
| 76 | 76 | if (!$solr->ready) { |
| 77 | - $io->error('ERROR: Connection to Solr core ("' . $input->getOption('solr') . '") not possible \n'); |
|
| 77 | + $io->error('ERROR: Connection to Solr core ("'.$input->getOption('solr').'") not possible \n'); |
|
| 78 | 78 | return BaseCommand::FAILURE; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | if (!$solr->suggestBuild()) { |
| 82 | - $io->error('ERROR: Sending the command suggest.build=true to Solr core ("' . $input->getOption('solr') . '") not possible \n'); |
|
| 82 | + $io->error('ERROR: Sending the command suggest.build=true to Solr core ("'.$input->getOption('solr').'") not possible \n'); |
|
| 83 | 83 | return BaseCommand::FAILURE; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -27,8 +27,7 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -class SuggestBuildCommand extends Command |
|
| 31 | -{ |
|
| 30 | +class SuggestBuildCommand extends Command { |
|
| 32 | 31 | |
| 33 | 32 | /** |
| 34 | 33 | * Configure the command by defining the name, options and arguments |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $xsd = '<?xml version="1.0" encoding="utf-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">'; |
| 48 | 48 | foreach ($this->schemes as $scheme) { |
| 49 | - $xsd .= '<xs:import namespace="' . $scheme["namespace"] . '" schemaLocation="' . $scheme["schemaLocation"] . '"/>'; |
|
| 49 | + $xsd .= '<xs:import namespace="'.$scheme["namespace"].'" schemaLocation="'.$scheme["schemaLocation"].'"/>'; |
|
| 50 | 50 | } |
| 51 | 51 | $xsd .= '</xs:schema>'; |
| 52 | 52 | return $value->schemaValidateSource($xsd); |
@@ -24,14 +24,12 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class XmlSchemesValidator extends AbstractDlfValidator |
|
| 28 | -{ |
|
| 27 | +class XmlSchemesValidator extends AbstractDlfValidator { |
|
| 29 | 28 | use LibXmlTrait; |
| 30 | 29 | |
| 31 | 30 | private array $schemes; |
| 32 | 31 | |
| 33 | - public function __construct(array $configuration) |
|
| 34 | - { |
|
| 32 | + public function __construct(array $configuration) { |
|
| 35 | 33 | parent::__construct(\DOMDocument::class); |
| 36 | 34 | $this->schemes = $configuration; |
| 37 | 35 | } |
@@ -22,10 +22,8 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class DOMDocumentValidationStack extends AbstractDlfValidationStack |
|
| 26 | -{ |
|
| 27 | - public function __construct(array $configuration) |
|
| 28 | - { |
|
| 25 | +class DOMDocumentValidationStack extends AbstractDlfValidationStack { |
|
| 26 | + public function __construct(array $configuration) { |
|
| 29 | 27 | parent::__construct(\DOMDocument::class); |
| 30 | 28 | $this->addValidators($configuration); |
| 31 | 29 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public function validate($value) |
| 49 | 49 | { |
| 50 | 50 | if (!$value instanceof $this->valueClassName) { |
| 51 | - $this->logger->debug('Value must be an instance of ' . $this->valueClassName . '.'); |
|
| 51 | + $this->logger->debug('Value must be an instance of '.$this->valueClassName.'.'); |
|
| 52 | 52 | throw new InvalidArgumentException('Type of value is not valid.', 1723126505626); |
| 53 | 53 | } |
| 54 | 54 | return parent::validate($value); |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @access public |
| 31 | 31 | */ |
| 32 | -abstract class AbstractDlfValidator extends AbstractValidator |
|
| 33 | -{ |
|
| 32 | +abstract class AbstractDlfValidator extends AbstractValidator { |
|
| 34 | 33 | use LoggerAwareTrait; |
| 35 | 34 | |
| 36 | 35 | protected string $valueClassName; |
@@ -38,15 +37,13 @@ discard block |
||
| 38 | 37 | /** |
| 39 | 38 | * @param $valueClassName string The class name of the value |
| 40 | 39 | */ |
| 41 | - public function __construct(string $valueClassName) |
|
| 42 | - { |
|
| 40 | + public function __construct(string $valueClassName) { |
|
| 43 | 41 | parent::__construct(); |
| 44 | 42 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 45 | 43 | $this->valueClassName = $valueClassName; |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | - public function validate($value) |
|
| 49 | - { |
|
| 46 | + public function validate($value) { |
|
| 50 | 47 | if (!$value instanceof $this->valueClassName) { |
| 51 | 48 | $this->logger->debug('Value must be an instance of ' . $this->valueClassName . '.'); |
| 52 | 49 | throw new InvalidArgumentException('Type of value is not valid.', 1723126505626); |
@@ -14,8 +14,7 @@ |
||
| 14 | 14 | * LICENSE.txt file that was distributed with this source code. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -trait LibXmlTrait |
|
| 18 | -{ |
|
| 17 | +trait LibXmlTrait { |
|
| 19 | 18 | /** |
| 20 | 19 | * Add the errors from the libxml error buffer as validation error. |
| 21 | 20 | * |
@@ -34,11 +34,11 @@ |
||
| 34 | 34 | |
| 35 | 35 | public function enableErrorBuffer(): void |
| 36 | 36 | { |
| 37 | - libxml_use_internal_errors(true); |
|
| 37 | + libxml_use_internal_errors(TRUE); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function disableErrorBuffer(): void |
| 41 | 41 | { |
| 42 | - libxml_use_internal_errors(false); |
|
| 42 | + libxml_use_internal_errors(FALSE); |
|
| 43 | 43 | } |
| 44 | 44 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | foreach ($configuration as $configurationItem) { |
| 56 | 56 | if (!class_exists($configurationItem["className"])) { |
| 57 | - $this->logger->error('Unable to load class ' . $configurationItem["className"] . '.'); |
|
| 57 | + $this->logger->error('Unable to load class '.$configurationItem["className"].'.'); |
|
| 58 | 58 | throw new InvalidArgumentException('Unable to load validator class.', 1723200537037); |
| 59 | 59 | } |
| 60 | 60 | $breakOnError = !isset($configurationItem["breakOnError"]) || $configurationItem["breakOnError"] !== "false"; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if (!$validator instanceof AbstractDlfValidator) { |
| 86 | - $this->logger->error($className . ' must be an instance of AbstractDlfValidator.'); |
|
| 86 | + $this->logger->error($className.' must be an instance of AbstractDlfValidator.'); |
|
| 87 | 87 | throw new InvalidArgumentException('Class must be an instance of AbstractDlfValidator.', 1723121212747); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | protected function isValid($value): void |
| 105 | 105 | { |
| 106 | 106 | if (!$value instanceof $this->valueClassName) { |
| 107 | - $this->logger->error('Value must be an instance of ' . $this->valueClassName . '.'); |
|
| 107 | + $this->logger->error('Value must be an instance of '.$this->valueClassName.'.'); |
|
| 108 | 108 | throw new InvalidArgumentException('Type of value is not valid.', 1723127564821); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @access public |
| 28 | 28 | */ |
| 29 | -abstract class AbstractDlfValidationStack extends AbstractDlfValidator |
|
| 30 | -{ |
|
| 29 | +abstract class AbstractDlfValidationStack extends AbstractDlfValidator { |
|
| 31 | 30 | use LoggerAwareTrait; |
| 32 | 31 | |
| 33 | 32 | const ITEM_KEY_TITLE = "title"; |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | |
| 37 | 36 | protected array $validatorStack = []; |
| 38 | 37 | |
| 39 | - public function __construct(string $valueClassName) |
|
| 40 | - { |
|
| 38 | + public function __construct(string $valueClassName) { |
|
| 41 | 39 | parent::__construct($valueClassName); |
| 42 | 40 | } |
| 43 | 41 | |
@@ -74,9 +74,9 @@ |
||
| 74 | 74 | * |
| 75 | 75 | * @return void |
| 76 | 76 | */ |
| 77 | - protected function addValidator(string $className, string $title, bool $breakOnError = true, array $configuration = null): void |
|
| 77 | + protected function addValidator(string $className, string $title, bool $breakOnError = TRUE, array $configuration = NULL): void |
|
| 78 | 78 | { |
| 79 | - if ($configuration === null) { |
|
| 79 | + if ($configuration === NULL) { |
|
| 80 | 80 | $validator = GeneralUtility::makeInstance($className); |
| 81 | 81 | } else { |
| 82 | 82 | $validator = GeneralUtility::makeInstance($className, $configuration); |
@@ -61,11 +61,11 @@ |
||
| 61 | 61 | protected function process(mixed $value): string |
| 62 | 62 | { |
| 63 | 63 | // using source from standard input |
| 64 | - $process = new Process(['java', '-jar', $this->jar, '-xsl:' . $this->xsl, '-s:-'], null, null, $value->saveXML()); |
|
| 64 | + $process = new Process(['java', '-jar', $this->jar, '-xsl:'.$this->xsl, '-s:-'], null, null, $value->saveXML()); |
|
| 65 | 65 | $process->run(); |
| 66 | 66 | // executes after the command finish |
| 67 | 67 | if (!$process->isSuccessful()) { |
| 68 | - $this->logger->error('Processing exits with code "' . $process->getExitCode() . '"'); |
|
| 68 | + $this->logger->error('Processing exits with code "'.$process->getExitCode().'"'); |
|
| 69 | 69 | throw new InvalidArgumentException('Processing was not successful.', 1724862680); |
| 70 | 70 | } |
| 71 | 71 | return $process->getOutput(); |
@@ -31,14 +31,12 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class SaxonXslToSvrlValidator extends AbstractDlfValidator implements LoggerAwareInterface |
|
| 35 | -{ |
|
| 34 | +class SaxonXslToSvrlValidator extends AbstractDlfValidator implements LoggerAwareInterface { |
|
| 36 | 35 | private string $jar; |
| 37 | 36 | |
| 38 | 37 | private string $xsl; |
| 39 | 38 | |
| 40 | - public function __construct(array $configuration) |
|
| 41 | - { |
|
| 39 | + public function __construct(array $configuration) { |
|
| 42 | 40 | parent::__construct(DOMDocument::class); |
| 43 | 41 | $this->jar = GeneralUtility::getFileAbsFileName($configuration["jar"] ?? ''); |
| 44 | 42 | $this->xsl = GeneralUtility::getFileAbsFileName($configuration["xsl"] ?? ''); |
@@ -52,8 +50,7 @@ discard block |
||
| 52 | 50 | } |
| 53 | 51 | } |
| 54 | 52 | |
| 55 | - protected function isValid($value) |
|
| 56 | - { |
|
| 53 | + protected function isValid($value) { |
|
| 57 | 54 | $svrl = $this->process($value); |
| 58 | 55 | $this->addErrorsOfSvrl($svrl); |
| 59 | 56 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | protected function process(mixed $value): string |
| 62 | 62 | { |
| 63 | 63 | // using source from standard input |
| 64 | - $process = new Process(['java', '-jar', $this->jar, '-xsl:' . $this->xsl, '-s:-'], null, null, $value->saveXML()); |
|
| 64 | + $process = new Process(['java', '-jar', $this->jar, '-xsl:' . $this->xsl, '-s:-'], NULL, NULL, $value->saveXML()); |
|
| 65 | 65 | $process->run(); |
| 66 | 66 | // executes after the command finish |
| 67 | 67 | if (!$process->isSuccessful()) { |
@@ -78,19 +78,19 @@ |
||
| 78 | 78 | $validation = GeneralUtility::makeInstance(DOMDocumentValidationStack::class, $settings['domDocumentValidationValidators']); |
| 79 | 79 | |
| 80 | 80 | if (!GeneralUtility::isValidUrl($urlParam)) { |
| 81 | - $this->logger->debug('Parameter "' . $urlParam . '" is not a valid url.'); |
|
| 81 | + $this->logger->debug('Parameter "'.$urlParam.'" is not a valid url.'); |
|
| 82 | 82 | throw new InvalidArgumentException('Value of url parameter is not a valid url.', 1724852611); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $content = GeneralUtility::getUrl($urlParam); |
| 86 | 86 | if ($content === false) { |
| 87 | - $this->logger->debug('Error while loading content of "' . $urlParam . '"'); |
|
| 87 | + $this->logger->debug('Error while loading content of "'.$urlParam.'"'); |
|
| 88 | 88 | throw new InvalidArgumentException('Error while loading content of url.', 1724420640); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $document = new DOMDocument(); |
| 92 | 92 | if ($document->loadXML($content) === false) { |
| 93 | - $this->logger->debug('Error converting content of "' . $urlParam . '" to xml.'); |
|
| 93 | + $this->logger->debug('Error converting content of "'.$urlParam.'" to xml.'); |
|
| 94 | 94 | throw new InvalidArgumentException('Error converting content to xml.', 1724420648); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -33,8 +33,7 @@ |
||
| 33 | 33 | * @subpackage dlf |
| 34 | 34 | * @access public |
| 35 | 35 | */ |
| 36 | -class DOMDocumentValidation implements MiddlewareInterface |
|
| 37 | -{ |
|
| 36 | +class DOMDocumentValidation implements MiddlewareInterface { |
|
| 38 | 37 | use LoggerAwareTrait; |
| 39 | 38 | |
| 40 | 39 | /** |
@@ -83,13 +83,13 @@ |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $content = GeneralUtility::getUrl($urlParam); |
| 86 | - if ($content === false) { |
|
| 86 | + if ($content === FALSE) { |
|
| 87 | 87 | $this->logger->debug('Error while loading content of "' . $urlParam . '"'); |
| 88 | 88 | throw new InvalidArgumentException('Error while loading content of url.', 1724420640); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $document = new DOMDocument(); |
| 92 | - if ($document->loadXML($content) === false) { |
|
| 92 | + if ($document->loadXML($content) === FALSE) { |
|
| 93 | 93 | $this->logger->debug('Error converting content of "' . $urlParam . '" to xml.'); |
| 94 | 94 | throw new InvalidArgumentException('Error converting content to xml.', 1724420648); |
| 95 | 95 | } |