@@ -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 | } |
@@ -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(); |
@@ -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()) { |
@@ -30,14 +30,12 @@ |
||
30 | 30 | * |
31 | 31 | * @access public |
32 | 32 | */ |
33 | -class SaxonXslToSvrlValidator extends AbstractDlfValidator implements LoggerAwareInterface |
|
34 | -{ |
|
33 | +class SaxonXslToSvrlValidator extends AbstractDlfValidator implements LoggerAwareInterface { |
|
35 | 34 | private string $jar; |
36 | 35 | |
37 | 36 | private string $xsl; |
38 | 37 | |
39 | - public function __construct(array $configuration) |
|
40 | - { |
|
38 | + public function __construct(array $configuration) { |
|
41 | 39 | parent::__construct(DOMDocument::class); |
42 | 40 | $this->jar = GeneralUtility::getFileAbsFileName($configuration["jar"] ?? ''); |
43 | 41 | $this->xsl = GeneralUtility::getFileAbsFileName($configuration["xsl"] ?? ''); |
@@ -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 | } |
@@ -28,8 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class SaxonXslToSvrlValidatorTest extends UnitTestCase |
|
32 | -{ |
|
31 | +class SaxonXslToSvrlValidatorTest extends UnitTestCase { |
|
33 | 32 | const SVRL = <<<SVRL |
34 | 33 | <svrl:schematron-output |
35 | 34 | xmlns:svrl="http://purl.oclc.org/dsdl/schematron"> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | parent::setUp(); |
50 | 50 | $this->resetSingletonInstances = true; |
51 | - $this->dlfExtensionPath = Environment::getExtensionsPath() . 'dlf'; |
|
51 | + $this->dlfExtensionPath = Environment::getExtensionsPath().'dlf'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function testJarFileNotFound(): void |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | $this->expectException(InvalidArgumentException::class); |
64 | 64 | $this->expectExceptionMessage("XSL Schematron file not found."); |
65 | 65 | // It only checks if a file exists at the specified path, so we can use one of the test files. |
66 | - new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath . '/Tests/Fixtures/Format/alto.xml']); |
|
66 | + new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath.'/Tests/Fixtures/Format/alto.xml']); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function testValidation(): void |
70 | 70 | { |
71 | - $saxonXslToSvrlValidator = new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath . '/Tests/Fixtures/Format/alto.xml', "xsl" => $this->dlfExtensionPath . '/Tests/Fixtures/Format/alto.xml']); |
|
71 | + $saxonXslToSvrlValidator = new SaxonXslToSvrlValidator(["jar" => $this->dlfExtensionPath.'/Tests/Fixtures/Format/alto.xml', "xsl" => $this->dlfExtensionPath.'/Tests/Fixtures/Format/alto.xml']); |
|
72 | 72 | $reflection = new ReflectionClass($saxonXslToSvrlValidator); |
73 | 73 | |
74 | 74 | $result = $reflection->getProperty("result"); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function setUp(): void |
48 | 48 | { |
49 | 49 | parent::setUp(); |
50 | - $this->resetSingletonInstances = true; |
|
50 | + $this->resetSingletonInstances = TRUE; |
|
51 | 51 | $this->dlfExtensionPath = Environment::getExtensionsPath() . 'dlf'; |
52 | 52 | } |
53 | 53 | |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | $reflection = new ReflectionClass($saxonXslToSvrlValidator); |
73 | 73 | |
74 | 74 | $result = $reflection->getProperty("result"); |
75 | - $result->setAccessible(true); |
|
75 | + $result->setAccessible(TRUE); |
|
76 | 76 | $result->setValue($saxonXslToSvrlValidator, new Result()); |
77 | 77 | |
78 | 78 | $method = $reflection->getMethod("addErrorsOfSvrl"); |
79 | - $method->setAccessible(true); |
|
79 | + $method->setAccessible(TRUE); |
|
80 | 80 | $method->invoke($saxonXslToSvrlValidator, self::SVRL); |
81 | 81 | |
82 | 82 | self::assertTrue($result->getValue($saxonXslToSvrlValidator)->hasErrors()); |