diff --git a/components/ILIAS/DidacticTemplate/classes/class.ilDidacticTemplateImport.php b/components/ILIAS/DidacticTemplate/classes/class.ilDidacticTemplateImport.php
index d72e247cffb8..f8a73c33e6cb 100755
--- a/components/ILIAS/DidacticTemplate/classes/class.ilDidacticTemplateImport.php
+++ b/components/ILIAS/DidacticTemplate/classes/class.ilDidacticTemplateImport.php
@@ -18,10 +18,10 @@
declare(strict_types=1);
-use ILIAS\Export\ImportHandler\ilFactory as ilImportHandlerFactory;
+use ILIAS\Export\ImportHandler\Factory as ilImportHandlerFactory;
use ILIAS\Export\ImportStatus\ilFactory as ilImportStatusFactory;
+use ILIAS\Export\ImportStatus\StatusType;
use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ilImportStatusCollectionInterface;
-use ILIAS\Export\Schema\ilXmlSchemaFactory as ilXMLSchemaFactory;
/**
* Description of ilDidacticTemplateImport
@@ -94,17 +94,16 @@ public function validateImportFile(): ilImportStatusCollectionInterface
$status = new ilImportStatusFactory();
if ($this->getInputType() !== self::IMPORT_FILE) {
return $status->collection()->withAddedStatus($status->handler()
- ->withType(ImportStatus\StatusType::FAILED)
+ ->withType(StatusType::FAILED)
->withContent($status->content()->builder()->string()
->withString("Invalid import status, import status 'IMPORT_FILE' expected.")));
}
- $schema = new ilXMLSchemaFactory();
$import = new ilImportHandlerFactory();
$xml_spl_info = new SplFileInfo($this->getInputFile());
- $xsd_spl_info = $schema->getLatest(self::SCHEMA_TYPE);
- $xml_file_handler = $import->file()->xml()->withFileInfo($xml_spl_info);
- $xsd_file_handler = $import->file()->xsd()->withFileInfo($xsd_spl_info);
- return $import->file()->validation()->handler()->validateXMLFile($xml_file_handler, $xsd_file_handler);
+ $xsd_schema_info = $import->schema()->folder()->handler()->getLatest(self::SCHEMA_TYPE);
+ $xml_file_handler = $import->file()->xml()->handler()->withFileInfo($xml_spl_info);
+ $xsd_file_handler = $import->file()->xsd()->handler()->withFileInfo($xsd_schema_info->getFile());
+ return $import->validation()->handler()->validateXMLFile($xml_file_handler, $xsd_file_handler);
}
/**
diff --git a/components/ILIAS/Export/README-technical.md b/components/ILIAS/Export/README-technical.md
index 18c7c4e8adda..ecccc7df528b 100755
--- a/components/ILIAS/Export/README-technical.md
+++ b/components/ILIAS/Export/README-technical.md
@@ -248,9 +248,9 @@ $xml_file_spl = new SplFileInfo('path to my xml file')
$xsd_file_spl = new SplFileInfo('path to my xsd file')
// Initialize a xml/xsd file handler
-$import = new \ILIAS\Export\ImportHandler\ilFactory();
-$xml_file_handler = $import->file()->xml()->withFileInfo($xml_file_spl);
-$xsd_file_handler = $import->file()->xsd()->withFileInfo($xsd_file_spl);
+$import = new \ILIAS\Export\ImportHandler\Factory();
+$xml_file_handler = $import->file()->xml()->handler()->withFileInfo($xml_file_spl);
+$xsd_file_handler = $import->file()->xsd()->hanlder()->withFileInfo($xsd_file_spl);
/** @var \ILIAS\Export\ImportStatus\ilCollection $validation_results */
// Validate
@@ -274,17 +274,17 @@ $xml_file_spl = new SplFileInfo('path to my xml file')
$xsd_file_spl = new SplFileInfo('path to my xsd file')
// Initialize a xml/xsd file handler
-$import = new \ILIAS\Export\ImportHandler\ilFactory();
-$xml_file_handler = $import->file()->xml()->withFileInfo($xml_file_spl);
-$xsd_file_handler = $import->file()->xsd()->withFileInfo($xsd_file_spl);
+$import = new \ILIAS\Export\ImportHandler\Factory();
+$xml_file_handler = $import->file()->xml()->handler()->withFileInfo($xml_file_spl);
+$xsd_file_handler = $import->file()->xsd()->handler()->withFileInfo($xsd_file_spl);
// Build xPath to xml node
// $path->toString() = '/RootElement/namespace:TargetElement'
-/** @var \ILIAS\Export\ImportHandler\File\Path\ilHandler $path */
-$path = $import->file()->path()->handler()
+/** @var \ILIAS\Export\ImportHandler\Path\Handler $path */
+$path = $import->path()->handler()
->withStartAtRoot(true)
- ->withNode($import->file()->path()->node()->simple()->withName('RootElement'))
- ->withNode($import->file()->path()->node()->simple()->withName('namespace:TargetElement'));
+ ->withNode($import->path()->node()->simple()->withName('RootElement'))
+ ->withNode($import->path()->node()->simple()->withName('namespace:TargetElement'));
// Because the path contains the namespace 'namespace' we have to add the namespace
// info to the xml file handler
diff --git a/components/ILIAS/Export/classes/ImportHandler/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Factory.php
new file mode 100755
index 000000000000..82340066dc1b
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Factory.php
@@ -0,0 +1,99 @@
+logger = $DIC->logger()->root();
+ $this->lng = $DIC->language();
+ $this->lng->loadLanguageModule("exp");
+ $this->import_status_factory = new ImportStatusFactory();
+ $this->data_factory = new DataFactory();
+ }
+
+ public function parser(): ParserFactoryInterface
+ {
+ return new ParserFactory(
+ $this,
+ $this->logger
+ );
+ }
+
+ public function file(): FileFactoryInterface
+ {
+ return new FileFactory(
+ $this,
+ $this->import_status_factory,
+ $this->logger,
+ $this->lng,
+ $this->data_factory
+ );
+ }
+
+ public function schema(): SchemaFactoryInterface
+ {
+ return new SchemaFactory(
+ $this,
+ $this->data_factory,
+ $this->logger
+ );
+ }
+
+ public function path(): PathFactoryInterface
+ {
+ return new PathFactory(
+ $this->logger
+ );
+ }
+
+ public function validation(): ValidationFactoryInterface
+ {
+ return new ValidationFactory(
+ $this->import_status_factory,
+ $this,
+ $this->logger
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/Factory.php
new file mode 100755
index 000000000000..68f1a4168521
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/Factory.php
@@ -0,0 +1,80 @@
+import_handler = $import_handler;
+ $this->import_status_factory = $import_status_factory;
+ $this->logger = $logger;
+ $this->lng = $lng;
+ $this->data_factory = $data_factory;
+ }
+
+ public function xml(): XMLFileFactoryInterface
+ {
+ return new XMLFileFactory(
+ $this->import_handler,
+ $this->import_status_factory,
+ $this->logger,
+ $this->lng,
+ $this->data_factory
+ );
+ }
+
+ public function xsd(): XSDFileFactoryInterface
+ {
+ return new XSDFileFactory(
+ $this->import_handler
+ );
+ }
+
+ public function namespace(): FileNamespaceFactoryInterface
+ {
+ return new FileNamespaceFactory();
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/Handler.php
similarity index 65%
rename from components/ILIAS/Export/classes/ImportHandler/File/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/File/Handler.php
index a3675dd2adb5..75e9081e3375 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/Handler.php
@@ -20,58 +20,57 @@
namespace ILIAS\Export\ImportHandler\File;
-use ilImportException;
-use ILIAS\Export\ImportHandler\I\File\ilHandlerInterface as ilFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilCollectionInterface as ilFileNamespaceCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilFactoryInterface as ilFileNamespaceFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilHandlerInterface as ilFileNamespaceHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\HandlerInterface as FileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\Namespace\CollectionInterface as FileNamespaceCollectionInterface;
+use ILIAS\Export\ImportHandler\I\File\Namespace\FactoryInterface as FileNamespaceFactoryInterface;
+use ILIAS\Export\ImportHandler\I\File\Namespace\HandlerInterface as FileNamespaceHandlerInterface;
use SplFileInfo;
-class ilHandler implements ilFileHandlerInterface
+class Handler implements FileHandlerInterface
{
- protected SplFileInfo $xml_file_info;
- protected ilFileNamespaceFactoryInterface $namespace;
- protected ilFileNamespaceCollectionInterface $namespaces;
+ protected SplFileInfo $spl_file_info;
+ protected FileNamespaceFactoryInterface $namespace;
+ protected FileNamespaceCollectionInterface $namespaces;
public function __construct(
- ilFileNamespaceFactoryInterface $namespace
+ FileNamespaceFactoryInterface $namespace
) {
$this->namespace = $namespace;
$this->namespaces = $namespace->collection();
}
- public function withAdditionalNamespace(ilFileNamespaceHandlerInterface $namespace_handler): ilFileHandlerInterface
+ public function withAdditionalNamespace(FileNamespaceHandlerInterface $namespace_handler): FileHandlerInterface
{
$clone = clone $this;
$clone->namespaces = $clone->namespaces->withElement($namespace_handler);
return $clone;
}
- public function getNamespaces(): ilFileNamespaceCollectionInterface
+ public function getNamespaces(): FileNamespaceCollectionInterface
{
return $this->namespaces;
}
- public function withFileInfo(SplFileInfo $file_info): ilFileHandlerInterface
+ public function withFileInfo(SplFileInfo $file_info): FileHandlerInterface
{
$clone = clone $this;
- $clone->xml_file_info = $file_info;
+ $clone->spl_file_info = $file_info;
return $clone;
}
public function getFileName(): string
{
- return $this->xml_file_info->getFilename();
+ return $this->spl_file_info->getFilename();
}
public function getFilePath(): string
{
return $this->fileExists()
- ? $this->xml_file_info->getRealPath()
- : $this->xml_file_info->getPath() . DIRECTORY_SEPARATOR . $this->xml_file_info->getFilename();
+ ? $this->spl_file_info->getRealPath()
+ : $this->spl_file_info->getPath() . DIRECTORY_SEPARATOR . $this->spl_file_info->getFilename();
}
- public function getSubPathToDirBeginningAtPathEnd(string $dir_name): ilFileHandlerInterface
+ public function getSubPathToDirBeginningAtPathEnd(string $dir_name): FileHandlerInterface
{
$parts = explode(DIRECTORY_SEPARATOR, $this->getFilePath());
$trimmed_str = '';
@@ -84,11 +83,11 @@ public function getSubPathToDirBeginningAtPathEnd(string $dir_name): ilFileHandl
}
}
$clone = clone $this;
- $clone->xml_file_info = new SplFileInfo($trimmed_str);
+ $clone->spl_file_info = new SplFileInfo($trimmed_str);
return $clone;
}
- public function getSubPathToDirBeginningAtPathStart(string $dir_name): ilFileHandlerInterface
+ public function getSubPathToDirBeginningAtPathStart(string $dir_name): FileHandlerInterface
{
$parts = explode(DIRECTORY_SEPARATOR, $this->getFilePath());
$trimmed_str = '';
@@ -101,18 +100,18 @@ public function getSubPathToDirBeginningAtPathStart(string $dir_name): ilFileHan
}
}
$clone = clone $this;
- $clone->xml_file_info = new SplFileInfo($trimmed_str);
+ $clone->spl_file_info = new SplFileInfo($trimmed_str);
return $clone;
}
public function getPathToFileLocation(): string
{
- return $this->xml_file_info->getPath();
+ return $this->spl_file_info->getPath();
}
public function fileExists(): bool
{
- return $this->xml_file_info->getRealPath() !== false;
+ return $this->spl_file_info->getRealPath() !== false;
}
public function getPathPart(string $pattern): string|null
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Namespace/class.ilCollection.php b/components/ILIAS/Export/classes/ImportHandler/File/Namespace/Collection.php
similarity index 70%
rename from components/ILIAS/Export/classes/ImportHandler/File/Namespace/class.ilCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/File/Namespace/Collection.php
index 2221944a30c0..7bf6db1fe968 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Namespace/class.ilCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/Namespace/Collection.php
@@ -20,10 +20,10 @@
namespace ILIAS\Export\ImportHandler\File\Namespace;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilCollectionInterface as ilParserNamespaceCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilHandlerInterface as ilParserNamespaceHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\Namespace\CollectionInterface as FileNamespaceCollectionInterface;
+use ILIAS\Export\ImportHandler\I\File\Namespace\HandlerInterface as FileNamespaceHandlerInterface;
-class ilCollection implements ilParserNamespaceCollectionInterface
+class Collection implements FileNamespaceCollectionInterface
{
protected array $elements;
protected int $index;
@@ -39,14 +39,14 @@ public function count(): int
return count($this->elements);
}
- public function withMerged(ilParserNamespaceCollectionInterface $other): ilParserNamespaceCollectionInterface
+ public function withMerged(FileNamespaceCollectionInterface $other): FileNamespaceCollectionInterface
{
$clone = clone $this;
$clone->elements = array_merge($this->toArray(), $other->toArray());
return $clone;
}
- public function withElement(ilParserNamespaceHandlerInterface $element): ilParserNamespaceCollectionInterface
+ public function withElement(FileNamespaceHandlerInterface $element): FileNamespaceCollectionInterface
{
$clone = clone $this;
$clone->elements[] = $element;
@@ -58,7 +58,7 @@ public function toArray(): array
return $this->elements;
}
- public function current(): ilParserNamespaceHandlerInterface
+ public function current(): FileNamespaceHandlerInterface
{
return $this->elements[$this->index];
}
@@ -75,7 +75,7 @@ public function key(): int
public function valid(): bool
{
- return 0 <= $this->index && $this->index < $this->count();
+ return isset($this->elements[$this->index]);
}
public function rewind(): void
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Namespace/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/Namespace/Factory.php
new file mode 100755
index 000000000000..aa3b1ed3ad34
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/Namespace/Factory.php
@@ -0,0 +1,40 @@
+namespace;
}
- public function withPrefix(string $prefix): ilParserNamespaceHandlerInterface
+ public function withPrefix(string $prefix): FileNamespaceHandlerInterface
{
$clone = clone $this;
$clone->prefix = $prefix;
return $clone;
}
- public function withNamespace(string $namespace): ilParserNamespaceHandlerInterface
+ public function withNamespace(string $namespace): FileNamespaceHandlerInterface
{
$clone = clone $this;
$clone->namespace = $namespace;
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Namespace/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/Namespace/class.ilFactory.php
old mode 100755
new mode 100644
index c230b1eaa57a..be786f8ac4c3
--- a/components/ILIAS/Export/classes/ImportHandler/File/Namespace/class.ilFactory.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/Namespace/class.ilFactory.php
@@ -20,21 +20,9 @@
namespace ILIAS\Export\ImportHandler\File\Namespace;
-use ILIAS\Export\ImportHandler\File\Namespace\ilCollection as ilParserNamespaceCollection;
-use ILIAS\Export\ImportHandler\File\Namespace\ilHandler as ilParserNamespaceHandler;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilCollectionInterface as ilParserNamespaceCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilFactoryInterface as ilParserNamespaceFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilHandlerInterface as ilParserNamespaceHandlerInterface;
-
-class ilFactory implements ilParserNamespaceFactoryInterface
+/**
+ * For some reason the github pipeline expects this file.
+ */
+class ilFactory
{
- public function handler(): ilParserNamespaceHandlerInterface
- {
- return new ilParserNamespaceHandler();
- }
-
- public function collection(): ilParserNamespaceCollectionInterface
- {
- return new ilParserNamespaceCollection();
- }
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Comparison/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/Path/Comparison/class.ilFactory.php
old mode 100755
new mode 100644
index 06a727b6be4c..71f3a21e0175
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Comparison/class.ilFactory.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/Path/Comparison/class.ilFactory.php
@@ -20,17 +20,9 @@
namespace ILIAS\Export\ImportHandler\File\Path\Comparison;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\ilHandler as ilFilePathComparisonHandler;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\Operator as ilFilePathComparisonOperator;
-use ILIAS\Export\ImportHandler\I\File\Path\Comparison\ilFactoryInterface as ilFilePathComparisonFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\Comparison\ilHandlerInterface as ilFilePathComparisonHandlerInterface;
-
-class ilFactory implements ilFilePathComparisonFactoryInterface
+/**
+ * For some reason the github pipeline expects this file.
+ */
+class ilFactory
{
- public function handler(
- ilFilePathComparisonOperator $operator,
- string $content
- ): ilFilePathComparisonHandlerInterface {
- return new ilFilePathComparisonHandler($operator, $content);
- }
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilFactory.php
deleted file mode 100755
index 863fea850f23..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilFactory.php
+++ /dev/null
@@ -1,83 +0,0 @@
-logger = $logger;
- }
-
- public function anyElement(): ilAnyElementFilePathNodeInterface
- {
- return new ilAnyElementFilePathNode();
- }
-
- public function anyNode(): ilAnyNodeFilePathNodeInterface
- {
- return new ilAnyNodeFilePathNode();
- }
-
- public function attribute(): ilAttributeFilePathNodeInterface
- {
- return new ilAttributeFilePathNode();
- }
-
- public function index(): ilIndexFilePathNodeInterface
- {
- return new ilIndexFilePathNode();
- }
-
- public function simple(): ilSimpleFilePathNodeInterface
- {
- return new ilSimpleFilePathNode();
- }
-
- public function openRoundBracked(): ilOpenRoundBrackedFilePathNodeInterface
- {
- return new ilOpenRoundBrackedFilePathNode();
- }
-
- public function closeRoundBracked(): ilCloseRoundBrackedFilePathNodeInterface
- {
- return new ilCloseRoundBrackedFilePathNode();
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/Path/class.ilFactory.php
deleted file mode 100755
index 6c9d6d692b85..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/class.ilFactory.php
+++ /dev/null
@@ -1,56 +0,0 @@
-logger = $logger;
- }
-
- public function handler(): ilFilePathHandlerInterface
- {
- return new ilFilePathHandler();
- }
-
- public function node(): ilFilePathNodeFactoryInterface
- {
- return new ilFilePathNodeFactory($this->logger);
- }
-
- public function comparison(ilFilePathComparisonOperator $operator, string $value): ilFilePathComparisonInterface
- {
- return new ilFilePathComparison($operator, $value);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Validation/Set/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/Validation/Set/class.ilFactory.php
deleted file mode 100755
index de706386f7ed..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/Validation/Set/class.ilFactory.php
+++ /dev/null
@@ -1,40 +0,0 @@
-path_handler;
- }
-
- public function getXSDFileHandler(): ilXSDFileHandlerInterface
- {
- return $this->xsd_file_handler;
- }
-
- public function getXMLFileHandler(): ilXMLFileHandlerInterface
- {
- return $this->xml_file_handler;
- }
-
- public function withFilePathHandler(ilFilePathHandlerInterface $path_handler): ilFileValidationSetHandlerInterface
- {
- $clone = clone $this;
- $clone->path_handler = $path_handler;
- return $clone;
- }
-
- public function withXSDFileHanlder(ilXSDFileHandlerInterface $xsd_file_handler): ilFileValidationSetHandlerInterface
- {
- $clone = clone $this;
- $clone->xsd_file_handler = $xsd_file_handler;
- return $clone;
- }
-
- public function withXMLFileHandler(ilXMLFileHandlerInterface $xml_file_handler): ilFileValidationSetHandlerInterface
- {
- $clone = clone $this;
- $clone->xml_file_handler = $xml_file_handler;
- return $clone;
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Validation/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/Validation/class.ilFactory.php
deleted file mode 100755
index 32814e465455..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/Validation/class.ilFactory.php
+++ /dev/null
@@ -1,57 +0,0 @@
-logger = $logger;
- }
-
- public function handler(): ilFileValidationHandlerInterface
- {
- return new ilFileValidationHandler(
- $this->logger,
- new ilParserFactory($this->logger),
- new ilImportStatusFactory(),
- new ilFilePathFactory($this->logger)
- );
- }
-
- public function set(): ilFileValidationSetFactoryInterface
- {
- return new ilFileValidationSetFactory();
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilCollection.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Collection.php
similarity index 71%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XML/Collection.php
index fe43b8bb77b3..0e164cd69cf1 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Collection.php
@@ -20,19 +20,19 @@
namespace ILIAS\Export\ImportHandler\File\XML;
-use ILIAS\Export\ImportHandler\I\File\XML\ilCollectionInterface as ilXMLFileHandlerCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\ilHandlerInterface as ilXMLFileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\CollectionInterface as XMLFileHandlerCollectionInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\HandlerInterface as XMLFileHandlerInterface;
-class ilCollection implements ilXMLFileHandlerCollectionInterface
+class Collection implements XMLFileHandlerCollectionInterface
{
/**
- * @var ilXMLFileHandlerInterface[];
+ * @var XMLFileHandlerInterface[];
*/
protected array $elements;
protected int $index;
/**
- * @param ilXMLFileHandlerInterface[] $initial_elements
+ * @param XMLFileHandlerInterface[] $initial_elements
*/
public function __construct(array $initial_elements = [])
{
@@ -45,7 +45,7 @@ public function count(): int
return count($this->elements);
}
- public function current(): ilXMLFileHandlerInterface
+ public function current(): XMLFileHandlerInterface
{
return $this->elements[$this->index];
}
@@ -70,14 +70,14 @@ public function rewind(): void
$this->index = 0;
}
- public function withMerged(ilXMLFileHandlerCollectionInterface $other): ilXMLFileHandlerCollectionInterface
+ public function withMerged(XMLFileHandlerCollectionInterface $other): XMLFileHandlerCollectionInterface
{
$clone = clone $this;
$clone->elements = array_merge($clone->toArray(), $other->toArray());
return $clone;
}
- public function withElement(ilXMLFileHandlerInterface $element): ilXMLFileHandlerCollectionInterface
+ public function withElement(XMLFileHandlerInterface $element): XMLFileHandlerCollectionInterface
{
$clone = clone $this;
$clone->elements[] = $element;
@@ -85,7 +85,7 @@ public function withElement(ilXMLFileHandlerInterface $element): ilXMLFileHandle
}
/**
- * @return ilXMLFileHandlerInterface[]
+ * @return XMLFileHandlerInterface[]
*/
public function toArray(): array
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilCollection.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Collection.php
similarity index 72%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Collection.php
index 76ea4c2a5967..bc0c732e5537 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Collection.php
@@ -20,13 +20,13 @@
namespace ILIAS\Export\ImportHandler\File\XML\Export;
-use ILIAS\Export\ImportHandler\I\File\XML\Export\ilCollectionInterface as ilXMLExportFileCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Export\ilHandlerInterface as ilXMLExportFileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\Export\CollectionInterface as XMLExportFileCollectionInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\Export\HandlerInterface as XMLExportFileHandlerInterface;
-class ilCollection implements ilXMLExportFileCollectionInterface
+class Collection implements XMLExportFileCollectionInterface
{
/**
- * @var ilXMLExportFileHandlerInterface[]
+ * @var XMLExportFileHandlerInterface[]
*/
protected array $elements;
protected int $index;
@@ -37,14 +37,14 @@ public function __construct()
$this->index = 0;
}
- public function withElement(ilXMLExportFileHandlerInterface $element): ilXMLExportFileCollectionInterface
+ public function withElement(XMLExportFileHandlerInterface $element): XMLExportFileCollectionInterface
{
$clone = clone $this;
$clone->elements[] = $element;
return $clone;
}
- public function withMerged(ilXMLExportFileCollectionInterface $other): ilXMLExportFileCollectionInterface
+ public function withMerged(XMLExportFileCollectionInterface $other): XMLExportFileCollectionInterface
{
$clone = clone $this;
$clone->elements = array_merge($this->toArray(), $other->toArray());
@@ -61,7 +61,7 @@ public function toArray(): array
return $this->elements;
}
- public function current(): ilXMLExportFileHandlerInterface
+ public function current(): XMLExportFileHandlerInterface
{
return $this->elements[$this->index];
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/Factory.php
new file mode 100755
index 000000000000..5159cfe91fe0
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/Factory.php
@@ -0,0 +1,61 @@
+logger = $logger;
+ $this->lng = $lng;
+ $this->import_handler = $import_handler;
+ }
+
+ public function handler(): ComponentXMLExportFileHandlerInterface
+ {
+ return new ComponentXMLExportFileHandler(
+ $this->import_handler->file()->namespace(),
+ new ImportStatusFactory(),
+ $this->import_handler->schema(),
+ $this->import_handler->parser(),
+ $this->import_handler->path(),
+ $this->logger,
+ $this->import_handler->parser()->nodeInfo()->attribute(),
+ $this->import_handler->validation()->set(),
+ $this->lng
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/Handler.php
similarity index 60%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/Handler.php
index a7f5376600b5..b489cdabf46c 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/Handler.php
@@ -21,68 +21,66 @@
namespace ILIAS\Export\ImportHandler\File\XML\Export\Component;
use ILIAS\Data\Version;
-use ILIAS\Export\ImportHandler\File\XML\Export\ilHandler as ilXMLExportFileHandler;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilFactoryInterface as ilFileNamespaceHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\ilFactoryInterface as ilFilePathFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\ilHandlerInterface as ilFilePathHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Validation\Set\ilCollectionInterface as ilFileValidationSetCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\Validation\Set\ilFactoryInterface as ilFileValidationSetFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Export\Component\ilHandlerInterface as ilComponentXMLExportFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\Attribute\ilFactoryInterface as ilXMlFileInfoNodeAttributeFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Schema\ilFactoryInterface as ilXMLFileSchemaFactory;
-use ILIAS\Export\ImportHandler\I\Parser\ilFactoryInterface as ilParserFactoryInterface;
-use ILIAS\Export\ImportStatus\Exception\ilException as ilImportStatusException;
-use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ilImportStatusCollectionInterface;
-use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ilImportStatusFactoryInterface;
+use ILIAS\Export\ImportHandler\File\XML\Export\Handler as XMLExportFile;
+use ILIAS\Export\ImportHandler\I\File\XSD\HandlerInterface as XSDFileInterface;
+use ILIAS\Export\ImportHandler\I\File\Namespace\FactoryInterface as FileNamespaceInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\Export\Component\HandlerInterface as XMLExportComponentFileInterface;
+use ILIAS\Export\ImportHandler\I\Parser\FactoryInterface as ParserFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\Attribute\FactoryInterface as ParserNodeInfoAttributeFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Path\FactoryInterface as PathFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Path\HandlerInterface as PathInterface;
+use ILIAS\Export\ImportHandler\I\Schema\FactoryInterface as SchemaFactory;
+use ILIAS\Export\ImportHandler\I\Validation\Set\CollectionInterface as FileValidationSetCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Validation\Set\FactoryInterface as FileValidationSetFactoryInterface;
+use ILIAS\Export\ImportStatus\Exception\ilException as ImportStatusException;
+use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ImportStatusCollectionInterface;
+use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ImportStatusFactoryInterface;
use ILIAS\Export\ImportStatus\StatusType;
use ilLanguage;
use ilLogger;
use SplFileInfo;
-class ilHandler extends ilXMLExportFileHandler implements ilComponentXMLExportFileHandlerInterface
+class Handler extends XMLExportFile implements XMLExportComponentFileInterface
{
- protected ilFileValidationSetCollectionInterface $sets;
+ protected FileValidationSetCollectionInterface $sets;
public function __construct(
- ilFileNamespaceHandlerInterface $namespace,
- ilImportStatusFactoryInterface $status,
- ilXMLFileSchemaFactory $schema,
- ilParserFactoryInterface $parser,
- ilFilePathFactoryInterface $path,
+ FileNamespaceInterface $namespace,
+ ImportStatusFactoryInterface $status,
+ SchemaFactory $schema,
+ ParserFactoryInterface $parser,
+ PathFactoryInterface $path,
ilLogger $logger,
- ilXMlFileInfoNodeAttributeFactoryInterface $attribute,
- ilFileValidationSetFactoryInterface $set,
+ ParserNodeInfoAttributeFactoryInterface $attribute,
+ FileValidationSetFactoryInterface $set,
ilLanguage $lng
) {
parent::__construct($namespace, $status, $schema, $parser, $path, $logger, $attribute, $set, $lng);
$this->sets = $this->set->collection();
}
- public function withFileInfo(SplFileInfo $file_info): ilHandler
+ public function withFileInfo(SplFileInfo $file_info): XMLExportComponentFileInterface
{
$clone = clone $this;
- $clone->xml_file_info = $file_info;
+ $clone->spl_file_info = $file_info;
return $clone;
}
- public function getValidationSets(): ilFileValidationSetCollectionInterface
+ public function getValidationSets(): FileValidationSetCollectionInterface
{
return $this->sets;
}
- public function buildValidationSets(): ilImportStatusCollectionInterface
+ public function buildValidationSets(): ImportStatusCollectionInterface
{
$statuses = $this->status->collection();
try {
$sets = $this->set->collection();
- $path_to_export_node = $this->path->handler()
- ->withStartAtRoot(true)
- ->withNode($this->path->node()->simple()->withName('exp:Export'));
- $export_schema_handler = $this->schema->handlersFromXMLFileHandlerAtPath($this, $path_to_export_node)
+ $export_schema_handler = $this->schema->collectionFrom($this, $this->pathToExportNode())
->current();
$major_version_str = is_null($export_schema_handler->getVersion())
? ((int) ILIAS_VERSION_NUMERIC) . ".0.0"
- : $export_schema_handler->getVersion()->getMajor() . ".0.0";
+ : $export_schema_handler->getMajorVersionString();
$major_structure_schema_version = new Version($major_version_str);
$structure_schema_handler = $this->schema->handler()
->withType('exp')
@@ -133,28 +131,32 @@ public function buildValidationSets(): ilImportStatusCollectionInterface
)
);
}
- $path_to_component = $this->path->handler()
- ->withStartAtRoot(true)
- ->withNode($this->path->node()->simple()->withName('exp:Export'))
- ->withNode($this->path->node()->simple()->withName('exp:ExportItem'))
- ->withNode($this->path->node()->anyNode());
$sets = $sets->withElement(
$this->set->handler()
->withXMLFileHandler($this)
->withXSDFileHanlder($component_xsd)
- ->withFilePathHandler($path_to_component)
+ ->withFilePathHandler($this->pathToExportItems())
);
$this->sets = $sets;
- } catch (ilImportStatusException $e) {
+ } catch (ImportStatusException $e) {
$statuses = $statuses->getMergedCollectionWith($e->getStatuses());
}
return $statuses;
}
- public function getPathToComponentRootNodes(): ilFilePathHandlerInterface
+ public function getPathToComponentRootNodes(): PathInterface
{
return $this->path->handler()->withStartAtRoot(true)
->withNode($this->path->node()->simple()->withName('exp:Export'))
->withNode($this->path->node()->simple()->withName('exp:ExportItem'));
}
+
+ protected function pathToExportItems(): PathInterface
+ {
+ return $this->path->handler()
+ ->withStartAtRoot(true)
+ ->withNode($this->path->node()->simple()->withName('exp:Export'))
+ ->withNode($this->path->node()->simple()->withName('exp:ExportItem'))
+ ->withNode($this->path->node()->anyNode());
+ }
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/class.ilFactory.php
deleted file mode 100755
index d57258252d87..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Component/class.ilFactory.php
+++ /dev/null
@@ -1,71 +0,0 @@
-logger = $logger;
- $this->lng = $lng;
- $this->schema_factory = $schema_factory;
- }
-
- public function handler(): ilComponentXMLExportFileHandlerInterface
- {
- return new ilComponentXMLExportFileHandler(
- new ilFileNamespaceFactory(),
- new ilImportStatusFactory(),
- new ilXMLFileSchemaFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- ),
- new ilParserFactory($this->logger),
- new ilFilePathFactory($this->logger),
- $this->logger,
- new ilXMLNodeInfoAttributeFactory($this->logger),
- new ilFileValidationSetFactory(),
- $this->lng
- );
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/Factory.php
new file mode 100755
index 000000000000..e8c9d6e25474
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/Factory.php
@@ -0,0 +1,61 @@
+logger = $logger;
+ $this->lng = $lng;
+ $this->import_handler = $import_handler;
+ }
+
+ public function handler(): DatasetXMLExportFileHandlerInterface
+ {
+ return new DatasetXMLExportFileHandler(
+ $this->import_handler->file()->namespace(),
+ new ImportStatusFactory(),
+ $this->import_handler->schema(),
+ $this->import_handler->parser(),
+ $this->import_handler->path(),
+ $this->logger,
+ $this->import_handler->parser()->nodeInfo()->attribute(),
+ $this->import_handler->validation()->set(),
+ $this->lng
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/Handler.php
similarity index 53%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/Handler.php
index 7536684c5aa0..5a831aad4173 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/Handler.php
@@ -21,73 +21,63 @@
namespace ILIAS\Export\ImportHandler\File\XML\Export\DataSet;
use ILIAS\Data\Version;
-use ILIAS\Export\ImportHandler\File\XML\Export\ilHandler as ilXMLExportFileHandler;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilFactoryInterface as ilFileNamespaceFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\ilFactoryInterface as ilFilePathFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\ilHandlerInterface as ilFilePathHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Validation\Set\ilCollectionInterface as ilFileValidationSetCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\Validation\Set\ilFactoryInterface as ilFileValidationSetFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Export\DataSet\ilHandlerInterface as ilDataSetXMLExportFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\Attribute\ilFactoryInterface as ilXMlFileInfoNodeAttributeFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Schema\ilFactoryInterface as ilXMLFileSchemaFactory;
-use ILIAS\Export\ImportHandler\I\Parser\ilFactoryInterface as ilParserFactoryInterface;
-use ILIAS\Export\ImportStatus\Exception\ilException as ilImportStatusException;
-use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ilImportStatusCollectionInterface;
-use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ilImportStatusFactoryInterface;
+use ILIAS\Export\ImportHandler\File\XML\Export\Handler as XMLExportFileHandler;
+use ILIAS\Export\ImportHandler\I\File\Namespace\FactoryInterface as FileNamespaceFactoryInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\Export\DataSet\HandlerInterface as DataSetXMLExportFileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Parser\FactoryInterface as ParserFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\Attribute\FactoryInterface as XMlFileInfoNodeAttributeFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Path\FactoryInterface as PathFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Path\HandlerInterface as PathInterface;
+use ILIAS\Export\ImportHandler\I\Schema\FactoryInterface as SchemaFactory;
+use ILIAS\Export\ImportHandler\I\Validation\Set\CollectionInterface as FileValidationSetCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Validation\Set\FactoryInterface as FileValidationSetFactoryInterface;
+use ILIAS\Export\ImportStatus\Exception\ilException as ImportStatusException;
+use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ImportStatusCollectionInterface;
+use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ImportStatusFactoryInterface;
use ILIAS\Export\ImportStatus\StatusType;
use ilLanguage;
use ilLogger;
use SplFileInfo;
-class ilHandler extends ilXMLExportFileHandler implements ilDataSetXMLExportFileHandlerInterface
+class Handler extends XMLExportFileHandler implements DataSetXMLExportFileHandlerInterface
{
- protected ilFileValidationSetCollectionInterface $sets;
+ protected FileValidationSetCollectionInterface $sets;
public function __construct(
- ilFileNamespaceFactoryInterface $namespace,
- ilImportStatusFactoryInterface $status,
- ilXMLFileSchemaFactory $schema,
- ilParserFactoryInterface $parser,
- ilFilePathFactoryInterface $path,
+ FileNamespaceFactoryInterface $namespace,
+ ImportStatusFactoryInterface $status,
+ SchemaFactory $schema,
+ ParserFactoryInterface $parser,
+ PathFactoryInterface $path,
ilLogger $logger,
- ilXMlFileInfoNodeAttributeFactoryInterface $attribute,
- ilFileValidationSetFactoryInterface $set,
+ XMlFileInfoNodeAttributeFactoryInterface $attribute,
+ FileValidationSetFactoryInterface $set,
ilLanguage $lng
) {
parent::__construct($namespace, $status, $schema, $parser, $path, $logger, $attribute, $set, $lng);
$this->sets = $this->set->collection();
}
- public function withFileInfo(SplFileInfo $file_info): ilHandler
+ public function withFileInfo(SplFileInfo $file_info): DataSetXMLExportFileHandlerInterface
{
$clone = clone $this;
- $clone->xml_file_info = $file_info;
+ $clone->spl_file_info = $file_info;
return $clone;
}
- public function getValidationSets(): ilFileValidationSetCollectionInterface
+ public function getValidationSets(): FileValidationSetCollectionInterface
{
return $this->sets;
}
- public function buildValidationSets(): ilImportStatusCollectionInterface
+ public function buildValidationSets(): ImportStatusCollectionInterface
{
$statuses = $this->status->collection();
try {
$sets = $this->set->collection();
- $path_to_export_node = $this->path->handler()
- ->withStartAtRoot(true)
- ->withNode($this->path->node()->simple()->withName('exp:Export'));
- $path_to_dataset_child_nodes = $this->path->handler()
- ->withStartAtRoot(true)
- ->withNode($this->path->node()->simple()->withName('exp:Export'))
- ->withNode($this->path->node()->simple()->withName('exp:ExportItem'))
- ->withNode($this->path->node()->simple()->withName('ds:DataSet'))
- ->withNode($this->path->node()->simple()->withName('ds:Rec'));
- $export_schema_handler = $this->schema->handlersFromXMLFileHandlerAtPath($this, $path_to_export_node)
+ $export_schema_handler = $this->schema->collectionFrom($this, $this->pathToExportNode())
->current();
- $major_version_str = $export_schema_handler->getVersion()->getMajor() . ".0.0";
- $major_structure_schema_version = new Version($major_version_str);
+ $major_structure_schema_version = new Version($export_schema_handler->getMajorVersionString());
$structure_schema_handler = $this->schema->handler()
->withType('exp')
->withSubType('dataset')
@@ -108,7 +98,7 @@ public function buildValidationSets(): ilImportStatusCollectionInterface
$this->set->handler()
->withXMLFileHandler($this)
->withXSDFileHanlder($structure_xsd)
- ->withFilePathHandler($path_to_export_node)
+ ->withFilePathHandler($this->pathToExportNode())
);
}
if (is_null($structure_xsd)) {
@@ -119,7 +109,7 @@ public function buildValidationSets(): ilImportStatusCollectionInterface
)));
}
// Content validation set
- $content_schemas = $this->schema->handlersFromXMLFileHandlerAtPath($this, $path_to_dataset_child_nodes);
+ $content_schemas = $this->schema->collectionFrom($this, $this->pathToRecords());
for ($i = 0; $i < $content_schemas->count(); $i++) {
$content_schema = $content_schemas->toArray()[$i];
$content_schema = $content_schema->withVersion($export_schema_handler->getVersion());
@@ -142,31 +132,21 @@ public function buildValidationSets(): ilImportStatusCollectionInterface
);
continue;
}
- $path_to_rec = $this->path->handler()
- ->withStartAtRoot(true)
- ->withNode($this->path->node()->openRoundBracked())
- ->withNode($this->path->node()->simple()->withName('exp:Export'))
- ->withNode($this->path->node()->simple()->withName('exp:ExportItem'))
- ->withNode($this->path->node()->simple()->withName('ds:DataSet'))
- ->withNode($this->path->node()->simple()->withName('ds:Rec'))
- ->withNode($this->path->node()->anyNode())
- ->withNode($this->path->node()->closeRoundBracked())
- ->withNode($this->path->node()->index()->withIndex($i + 1));
$sets = $sets->withElement(
$this->set->handler()
->withXMLFileHandler($this)
->withXSDFileHanlder($xsd_handler)
- ->withFilePathHandler($path_to_rec)
+ ->withFilePathHandler($this->pathToRecord($i))
);
}
$this->sets = $sets;
- } catch (ilImportStatusException $e) {
+ } catch (ImportStatusException $e) {
$statuses = $statuses->getMergedCollectionWith($e->getStatuses());
}
return $statuses;
}
- public function getPathToComponentRootNodes(): ilFilePathHandlerInterface
+ public function getPathToComponentRootNodes(): PathInterface
{
return $this->path->handler()
->withStartAtRoot(true)
@@ -174,4 +154,28 @@ public function getPathToComponentRootNodes(): ilFilePathHandlerInterface
->withNode($this->path->node()->simple()->withName('exp:ExportItem'))
->withNode($this->path->node()->simple()->withName('ds:DataSet'));
}
+
+ protected function pathToRecords(): PathInterface
+ {
+ return $this->path->handler()
+ ->withStartAtRoot(true)
+ ->withNode($this->path->node()->simple()->withName('exp:Export'))
+ ->withNode($this->path->node()->simple()->withName('exp:ExportItem'))
+ ->withNode($this->path->node()->simple()->withName('ds:DataSet'))
+ ->withNode($this->path->node()->simple()->withName('ds:Rec'));
+ }
+
+ protected function pathToRecord(int $index): PathInterface
+ {
+ return $this->path->handler()
+ ->withStartAtRoot(true)
+ ->withNode($this->path->node()->openRoundBracked())
+ ->withNode($this->path->node()->simple()->withName('exp:Export'))
+ ->withNode($this->path->node()->simple()->withName('exp:ExportItem'))
+ ->withNode($this->path->node()->simple()->withName('ds:DataSet'))
+ ->withNode($this->path->node()->simple()->withName('ds:Rec'))
+ ->withNode($this->path->node()->anyNode())
+ ->withNode($this->path->node()->closeRoundBracked())
+ ->withNode($this->path->node()->index()->withIndex($index + 1));
+ }
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/class.ilFactory.php
deleted file mode 100755
index fd3f311bd2ef..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/DataSet/class.ilFactory.php
+++ /dev/null
@@ -1,71 +0,0 @@
-logger = $logger;
- $this->lng = $lng;
- $this->schema_factory = $schema_factory;
- }
-
- public function handler(): ilDatasetXMLExportFileHandlerInterface
- {
- return new ilDatasetXMLExportFileHandler(
- new ilFileNamespaceFactory(),
- new ilImportStatusFactory(),
- new ilXMLFileSchemaFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- ),
- new ilParserFactory($this->logger),
- new ilFilePathFactory($this->logger),
- $this->logger,
- new ilXMLNodeInfoAttributeFactory($this->logger),
- new ilFileValidationSetFactory(),
- $this->lng
- );
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Factory.php
new file mode 100755
index 000000000000..c2a8c6aa05be
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Factory.php
@@ -0,0 +1,84 @@
+logger = $logger;
+ $this->lng = $lng;
+ $this->import_handler = $import_handler;
+ }
+
+ public function withFileInfo(SplFileInfo $file_info): XMLExportFileHandlerInterface
+ {
+ $comp_handler = $this->component()->handler()->withFileInfo($file_info);
+ $dataset_handler = $this->dataSet()->handler()->withFileInfo($file_info);
+ if ($dataset_handler->hasComponentRootNode()) {
+ return $dataset_handler;
+ }
+ return $comp_handler;
+ }
+
+ public function collection(): XMLExportFileCollectionInterface
+ {
+ return new XMLExportFileHandlerCollection();
+ }
+
+ public function component(): ComponentXMLExportFileHandlerFactoryInterface
+ {
+ return new ComponentXMLExportFileFactory(
+ $this->import_handler,
+ $this->logger,
+ $this->lng
+ );
+ }
+
+ public function dataSet(): DataSetXMLExportFileHandlerFactoryInterface
+ {
+ return new DataSetXMLExportFileFactory(
+ $this->import_handler,
+ $this->logger,
+ $this->lng
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Handler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Handler.php
new file mode 100755
index 000000000000..39359478e507
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/Handler.php
@@ -0,0 +1,154 @@
+schema = $schema;
+ $this->parser = $parser;
+ $this->logger = $logger;
+ $this->path = $path;
+ $this->attribute = $attribute;
+ $this->set = $set;
+ $this->lng = $lng;
+ }
+
+ /**
+ * @throws ImportStatusException
+ */
+ public function withFileInfo(SplFileInfo $file_info): XMLExportFileInterface
+ {
+ $clone = clone $this;
+ $clone->spl_file_info = $file_info;
+ return $clone;
+ }
+
+ public function getILIASPath(ParserNodeInfoTreeInterface $component_tree): string
+ {
+ $matches = [];
+ $pattern = '/([0-9]+)__([0-9]+)__([a-z_]+)_([0-9]+)/';
+ $path_part = $this->getSubPathToDirBeginningAtPathEnd('temp')->getPathPart($pattern);
+ if (
+ is_null($path_part) ||
+ preg_match($pattern, $path_part, $matches) !== 1
+ ) {
+ return 'No path found';
+ };
+ $node = $component_tree->getFirstNodeWith(
+ $this->attribute->collection()
+ ->withElement($this->attribute->handler()->withValue($matches[4])->withKey('Id'))
+ ->withElement($this->attribute->handler()->withValue($matches[3])->withKey('Type'))
+ );
+ return is_null($node)
+ ? ''
+ : $component_tree->getAttributePath($node, 'Title', DIRECTORY_SEPARATOR);
+ }
+
+ public function isContainerExportXML(): bool
+ {
+ return $this->getSubPathToDirBeginningAtPathEnd('temp')->pathContainsFolderName('Container');
+ }
+
+ public function hasComponentRootNode(): bool
+ {
+ $xml = $this->withAdditionalNamespace(
+ $this->namespace->handler()
+ ->withNamespace(ilDataSet::DATASET_NS)
+ ->withPrefix(ilDataSet::DATASET_NS_PREFIX)
+ );
+ try {
+ $nodes = $this->parser->DOM()->handler()
+ ->withFileHandler($xml)
+ ->getNodeInfoAt($this->getPathToComponentRootNodes());
+ } catch (ImportStatusException $e) {
+ return false;
+ }
+ return count($nodes) > 0;
+ }
+
+ public function pathToExportNode(): PathInterface
+ {
+ return $this->path->handler()
+ ->withStartAtRoot(true)
+ ->withNode($this->path->node()->simple()->withName('exp:Export'));
+ }
+
+ protected function getFailMsgNoMatchingVersionFound(
+ XMLFileHandlerInterface $xml_file_handler,
+ ?XSDFileHandlerInterface $xsd_file_handler,
+ string $version_str
+ ): ImportStatusInterface {
+ $xml_str = "
XML-File: " . $xml_file_handler->getSubPathToDirBeginningAtPathEnd(FileValidationHandler::TMP_DIR_NAME)->getFilePath();
+ $xsd_str = "
XSD-File: " . (is_null($xsd_file_handler) ? "null" : $xsd_file_handler->getSubPathToDirBeginningAtPathEnd(FileValidationHandler::XML_DIR_NAME)->getFilePath());
+ $msg = sprintf($this->lng->txt('exp_import_validation_err_no_matching_xsd'), $version_str);
+ $content = $this->status->content()->builder()->string()->withString(
+ "Validation FAILED"
+ . $xml_str
+ . $xsd_str
+ . "
ERROR Message: " . $msg
+ );
+ return $this->status->handler()
+ ->withType(StatusType::FAILED)
+ ->withContent($content);
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilFactory.php
deleted file mode 100755
index 7cd91dee2216..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilFactory.php
+++ /dev/null
@@ -1,84 +0,0 @@
-logger = $logger;
- $this->lng = $lng;
- $this->schema_factory = $schema_factory;
- }
-
- public function withFileInfo(SplFileInfo $file_info): ilXMLExportFileHandlerInterface
- {
- $comp_handler = $this->component()->handler()->withFileInfo($file_info);
- $dataset_handler = $this->dataSet()->handler()->withFileInfo($file_info);
- if ($dataset_handler->hasComponentRootNode()) {
- return $dataset_handler;
- }
- return $comp_handler;
- }
-
- public function collection(): ilXMLExportFileCollectionInterface
- {
- return new ilXMLExportFileHandlerCollection();
- }
-
- public function component(): ilComponentXMLExportFileHandlerFactoryInterface
- {
- return new ilComponentXMLExportFileFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- );
- }
-
- public function dataSet(): ilDataSetXMLExportFileHandlerFactoryInterface
- {
- return new ilDataSetXMLExportFileFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- );
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilHandler.php
deleted file mode 100755
index 8cb26d227daf..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Export/class.ilHandler.php
+++ /dev/null
@@ -1,144 +0,0 @@
-schema = $schema;
- $this->parser = $parser;
- $this->logger = $logger;
- $this->path = $path;
- $this->attribute = $attribute;
- $this->set = $set;
- $this->lng = $lng;
- }
-
- /**
- * @throws ilImportStatusException
- */
- public function withFileInfo(SplFileInfo $file_info): ilHandler
- {
- $clone = clone $this;
- $clone->xml_file_info = $file_info;
- return $clone;
- }
-
- public function getILIASPath(ilXMLFileNodeInfoTreeInterface $component_tree): string
- {
- $matches = [];
- $pattern = '/([0-9]+)__([0-9]+)__([a-z_]+)_([0-9]+)/';
- $path_part = $this->getSubPathToDirBeginningAtPathEnd('temp')->getPathPart($pattern);
- if (
- is_null($path_part) ||
- preg_match($pattern, $path_part, $matches) !== 1
- ) {
- return 'No path found';
- };
- $node = $component_tree->getFirstNodeWith(
- $this->attribute->collection()
- ->withElement($this->attribute->pair()->withValue($matches[4])->withKey('Id'))
- ->withElement($this->attribute->pair()->withValue($matches[3])->withKey('Type'))
- );
- return is_null($node)
- ? ''
- : $component_tree->getAttributePath($node, 'Title', DIRECTORY_SEPARATOR);
- }
-
- public function isContainerExportXML(): bool
- {
- return $this->getSubPathToDirBeginningAtPathEnd('temp')->pathContainsFolderName('Container');
- }
-
- public function hasComponentRootNode(): bool
- {
- $xml = $this->withAdditionalNamespace(
- $this->namespace->handler()
- ->withNamespace(ilDataSet::DATASET_NS)
- ->withPrefix(ilDataSet::DATASET_NS_PREFIX)
- );
- try {
- $nodes = $this->parser->DOM()->withFileHandler($xml)->getNodeInfoAt($this->getPathToComponentRootNodes());
- } catch (ilImportStatusException $e) {
- return false;
- }
- return count($nodes) > 0;
- }
-
- protected function getFailMsgNoMatchingVersionFound(
- ilXMLFileHandlerInterface $xml_file_handler,
- ilXSDFileHandlerInterface $xsd_file_handler,
- string $version_str
- ): ilImportStatusHandlerInterface {
- $xml_str = "
XML-File: " . $xml_file_handler->getSubPathToDirBeginningAtPathEnd(ilFileValidationHandler::TMP_DIR_NAME)->getFilePath();
- $xsd_str = "
XSD-File: " . $xsd_file_handler->getSubPathToDirBeginningAtPathEnd(ilFileValidationHandler::XML_DIR_NAME)->getFilePath();
- $msg = sprintf($this->lng->txt('exp_import_validation_err_no_matching_xsd'), $version_str);
- $content = $this->status->content()->builder()->string()->withString(
- "Validation FAILED"
- . $xml_str
- . $xsd_str
- . "
ERROR Message: " . $msg
- );
- return $this->status->handler()
- ->withType(StatusType::FAILED)
- ->withContent($content);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Factory.php
new file mode 100755
index 000000000000..ce5b11f5d872
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Factory.php
@@ -0,0 +1,101 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ $this->lng = $lng;
+ $this->data_factory = $data_factory;
+ $this->import_status_factory = $import_status_factory;
+ }
+
+ public function handler(): XMLFileInterface
+ {
+ return new XMLFile(
+ $this->import_handler->file()->namespace(),
+ $this->import_status_factory
+ );
+ }
+
+ public function collection(): XMLFileCollectionInterface
+ {
+ return new XMLFileCollection();
+ }
+
+ public function manifest(): ManifestFileFactoryInterface
+ {
+ return new ManifestFileFactory(
+ $this->import_handler,
+ $this->logger,
+ $this->import_status_factory
+ );
+ }
+
+ public function export(): XMLExportFileFactoryInterface
+ {
+ return new XMLExportFileFactory(
+ $this->import_handler,
+ $this->logger,
+ $this->lng
+ );
+ }
+
+ public function schema(): SchemaFactoryInterface
+ {
+ return new SchemaFactory(
+ $this->import_handler,
+ $this->data_factory,
+ $this->logger
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Handler.php
similarity index 66%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XML/Handler.php
index 85a7f8bbfa27..4c7e00a06f25 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Handler.php
@@ -21,43 +21,45 @@
namespace ILIAS\Export\ImportHandler\File\XML;
use DOMDocument;
-use ILIAS\Export\ImportHandler\File\ilHandler as ilFileHandler;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilFactoryInterface as ilFileNamespaceFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilHandlerInterface as ilFileNamespaceHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\ilHandlerInterface as ilXMLFileHandlerInterface;
-use ILIAS\Export\ImportStatus\Exception\ilException as ilImportStatusException;
-use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ilImportStatusFactoryInterface;
-use ILIAS\Export\ImportStatus\StatusType;
+use ILIAS\Export\ImportHandler\File\Handler as File;
+use ILIAS\Export\ImportHandler\I\File\Namespace\FactoryInterface as FileNamespaceFactoryInterface;
+use ILIAS\Export\ImportHandler\I\File\Namespace\HandlerInterface as FileNamespaceInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\HandlerInterface as XMLFileInterface;
+use ILIAS\Export\ImportStatus\Exception\ilException as ImportStatusException;
+use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ImportStatusFactoryInterface;
+use ILIAS\Export\ImportStatus\StatusType as StatusType;
use SplFileInfo;
-class ilHandler extends ilFileHandler implements ilXMLFileHandlerInterface
+class Handler extends File implements XMLFileInterface
{
- protected ilImportStatusFactoryInterface $status;
+ protected ImportStatusFactoryInterface $status;
public function __construct(
- ilFileNamespaceFactoryInterface $namespace,
- ilImportStatusFactoryInterface $status
+ FileNamespaceFactoryInterface $namespace_factory,
+ ImportStatusFactoryInterface $status
) {
- parent::__construct($namespace);
+ parent::__construct($namespace_factory);
$this->status = $status;
}
- public function withFileInfo(SplFileInfo $file_info): ilHandler
- {
+ public function withFileInfo(
+ SplFileInfo $file_info
+ ): XMLFileInterface {
$clone = clone $this;
- $clone->xml_file_info = $file_info;
+ $clone->spl_file_info = $file_info;
return $clone;
}
- public function withAdditionalNamespace(ilFileNamespaceHandlerInterface $namespace_handler): ilHandler
- {
+ public function withAdditionalNamespace(
+ FileNamespaceInterface $namespace_handler
+ ): XMLFileInterface {
$clone = clone $this;
$clone->namespaces = $clone->namespaces->withElement($namespace_handler);
return $clone;
}
/**
- * @throws ilImportStatusException
+ * @throws ImportStatusException
*/
public function loadDomDocument(): DOMDocument
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilHandlerCollection.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Collection.php
similarity index 60%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilHandlerCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Collection.php
index 0cb7616fae01..afe25b92d370 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilHandlerCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Collection.php
@@ -20,30 +20,26 @@
namespace ILIAS\Export\ImportHandler\File\XML\Manifest;
-use ILIAS\Export\ImportHandler\I\File\XML\Manifest\ilHandlerCollectionInterface as ilManifestXMLFileHandlerCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Manifest\ilHandlerInterface as ilManifestXMLFileHandlerInterface;
-use ILIAS\Export\ImportStatus\Exception\ilException as ilImportStatusException;
-use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ilImportStatusHandlerCollectionInterface;
-use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ilImportStatusFactoryInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\Manifest\HandlerCollectionInterface as ManifestXMLFileCollectionInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\Manifest\HandlerInterface as ManifestXMLFileInterface;
+use ILIAS\Export\ImportStatus\Exception\ilException as ImportStatusException;
+use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ImportStatusHandlerCollectionInterface;
+use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ImportStatusFactoryInterface;
-class ilHandlerCollection implements ilManifestXMLFileHandlerCollectionInterface
+class Collection implements ManifestXMLFileCollectionInterface
{
/**
- * @var ilManifestXMLFileHandlerInterface[];
+ * @var ManifestXMLFileInterface[];
*/
protected array $elements;
- protected ilImportStatusFactoryInterface $import_status;
+ protected ImportStatusFactoryInterface $import_status;
protected int $index;
- /**
- * @param ilManifestXMLFileHandlerInterface[] $initial_elements
- */
public function __construct(
- ilImportStatusFactoryInterface $import_status,
- array $initial_elements = []
+ ImportStatusFactoryInterface $import_status,
) {
$this->import_status = $import_status;
- $this->elements = $initial_elements;
+ $this->elements = [];
$this->index = 0;
}
@@ -52,7 +48,7 @@ public function count(): int
return count($this->elements);
}
- public function current(): ilManifestXMLFileHandlerInterface
+ public function current(): ManifestXMLFileInterface
{
return $this->elements[$this->index];
}
@@ -69,7 +65,7 @@ public function key(): int
public function valid(): bool
{
- return 0 <= $this->index && $this->index < $this->count();
+ return isset($this->elements[$this->index]);
}
public function rewind(): void
@@ -78,22 +74,24 @@ public function rewind(): void
}
public function withMerged(
- ilManifestXMLFileHandlerCollectionInterface $other
- ): ilManifestXMLFileHandlerCollectionInterface {
+ ManifestXMLFileCollectionInterface $other
+ ): ManifestXMLFileCollectionInterface {
$clone = clone $this;
$clone->elements = array_merge($clone->toArray(), $other->toArray());
return $clone;
}
- public function withElement(ilManifestXMLFileHandlerInterface $element): ilManifestXMLFileHandlerCollectionInterface
- {
+ public function withElement(
+ ManifestXMLFileInterface $element
+ ): ManifestXMLFileCollectionInterface {
$clone = clone $this;
$clone->elements[] = $element;
return $clone;
}
- public function containsExportObjectType(ilExportObjectType $type): bool
- {
+ public function containsExportObjectType(
+ ExportObjectType $type
+ ): bool {
foreach ($this->toArray() as $manifest_file_handler) {
if ($manifest_file_handler->getExportObjectType() === $type) {
return true;
@@ -102,7 +100,7 @@ public function containsExportObjectType(ilExportObjectType $type): bool
return false;
}
- public function validateElements(): ilImportStatusHandlerCollectionInterface
+ public function validateElements(): ImportStatusHandlerCollectionInterface
{
$status_collection = $this->import_status->collection()->withNumberingEnabled(true);
foreach ($this as $manfiest_file_handler) {
@@ -114,9 +112,9 @@ public function validateElements(): ilImportStatusHandlerCollectionInterface
}
/**
- * @throws ilImportStatusException
+ * @throws ImportStatusException
*/
- public function findNextFiles(): ilManifestXMLFileHandlerCollectionInterface
+ public function findNextFiles(): ManifestXMLFileCollectionInterface
{
$collection = clone $this;
$collection->rewind();
@@ -128,7 +126,7 @@ public function findNextFiles(): ilManifestXMLFileHandlerCollectionInterface
}
/**
- * @return ilManifestXMLFileHandlerInterface[]
+ * @return ManifestXMLFileInterface[]
*/
public function toArray(): array
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/enum.ilExportObjectType.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/ExportObjectType.php
similarity index 70%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/enum.ilExportObjectType.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/ExportObjectType.php
index 88c32f082240..815f7bc2a274 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/enum.ilExportObjectType.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/ExportObjectType.php
@@ -20,20 +20,20 @@
namespace ILIAS\Export\ImportHandler\File\XML\Manifest;
-enum ilExportObjectType
+enum ExportObjectType
{
case MIXED;
case EXPORT_SET;
case EXPORT_FILE;
case NONE;
- public static function toString(ilExportObjectType $type): string
+ public static function toString(ExportObjectType $type): string
{
return match ($type) {
- ilExportObjectType::MIXED => 'Mixed',
- ilExportObjectType::EXPORT_FILE => 'ExportFile',
- ilExportObjectType::EXPORT_SET => 'ExportSet',
- ilExportObjectType::NONE => ''
+ ExportObjectType::MIXED => 'Mixed',
+ ExportObjectType::EXPORT_FILE => 'ExportFile',
+ ExportObjectType::EXPORT_SET => 'ExportSet',
+ ExportObjectType::NONE => ''
};
}
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Factory.php
new file mode 100755
index 000000000000..76fe3601b42b
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Factory.php
@@ -0,0 +1,68 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ $this->import_status_factory = $import_status_factory;
+ }
+
+ public function handler(): ManifestXMLFileInterface
+ {
+ return new ManifestXMLFile(
+ $this->import_handler->file()->namespace(),
+ $this->import_status_factory,
+ $this->import_handler->validation()->handler(),
+ $this->import_handler->parser(),
+ $this->import_handler->path(),
+ $this->import_handler->file()->xml(),
+ $this->import_handler->file()->xsd(),
+ $this->import_handler->schema()->folder()->handler()
+ );
+ }
+
+ public function collection(): ManifestXMLFileCollectionInterface
+ {
+ return new ManifestXMLFileCollection(
+ $this->import_status_factory
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Handler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Handler.php
new file mode 100755
index 000000000000..3ae94dee59ec
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/Handler.php
@@ -0,0 +1,180 @@
+getLatest(
+ self::XSD_TYPE,
+ self::XSD_SUB_TYPE
+ );
+ $this->manifest_xsd_handler = $xsd_file_factory->handler()
+ ->withFileInfo(is_null($schema_info) ? null : $schema_info->getFile());
+ $this->file_path_factory = $file_path_factory;
+ $this->xml_file_factory = $xml_file_factory;
+ $this->parser_factory = $parser_factory;
+ $this->validation = $validation;
+ }
+
+ /**
+ * @throws ImportStatusException
+ */
+ public function withFileInfo(SplFileInfo $file_info): Handler
+ {
+ $clone = clone $this;
+ $clone->spl_file_info = $file_info;
+ $clone->parser_handler = $clone->parser_factory->DOM()->handler()
+ ->withFileHandler($clone);
+ return $clone;
+ }
+
+ /**
+ * @throws ImportStatusException
+ */
+ public function getExportObjectType(): ExportObjectType
+ {
+ $exp_file_file_path = $this->file_path_factory->handler()
+ ->withNode($this->file_path_factory->node()->simple()->withName(self::MANIFEST_NODE_NAME))
+ ->withNode($this->file_path_factory->node()->simple()->withName(self::EXPORT_FILE_NODE_NAME));
+ $exp_set_file_path = $this->file_path_factory->handler()
+ ->withNode($this->file_path_factory->node()->simple()->withName(self::MANIFEST_NODE_NAME))
+ ->withNode($this->file_path_factory->node()->simple()->withName(self::EXPORT_SET_NODE_NAME));
+ $export_file_node_info = $this->parser_handler->getNodeInfoAt($exp_file_file_path);
+ $export_set_node_info = $this->parser_handler->getNodeInfoAt($exp_set_file_path);
+ if (
+ $export_file_node_info->count() > 0 &&
+ $export_set_node_info->count() > 0
+ ) {
+ return ExportObjectType::MIXED;
+ }
+ if ($export_file_node_info->count() > 0) {
+ return ExportObjectType::EXPORT_FILE;
+ }
+ if ($export_set_node_info->count() > 0) {
+ return ExportObjectType::EXPORT_SET;
+ }
+ return ExportObjectType::NONE;
+ }
+
+ public function validateManifestXML(): ImportStatusHandlerCollectionInterface
+ {
+ return $this->validation->validateXMLFile($this, $this->manifest_xsd_handler);
+ }
+
+ /**
+ * @throws ImportStatusException
+ */
+ public function findXMLFileHandlers(): XMLExportFileCollectionInterface
+ {
+ $type_name = ExportObjectType::toString($this->getExportObjectType());
+ $path = $this->file_path_factory->handler()
+ ->withStartAtRoot(true)
+ ->withNode($this->file_path_factory->node()->simple()->withName(self::MANIFEST_NODE_NAME))
+ ->withNode($this->file_path_factory->node()->simple()->withName($type_name));
+ $file_handlers = $this->xml_file_factory->export()->collection();
+ foreach ($this->parser_handler->getNodeInfoAt($path) as $node_info) {
+ $file_name = $node_info->getNodeName() === ExportObjectType::toString(ExportObjectType::EXPORT_SET)
+ ? DIRECTORY_SEPARATOR . self::MANIFEST_FILE_NAME
+ : '';
+ $file_handlers = $file_handlers->withElement($this->xml_file_factory->export()
+ ->withFileInfo(new SplFileInfo(
+ $this->getPathToFileLocation()
+ . DIRECTORY_SEPARATOR
+ . $node_info->getValueOfAttribute(self::FILE_PATH_ATTRIBUTE_NAME)
+ . $file_name
+ )));
+ }
+ return $file_handlers;
+ }
+
+ /**
+ * @throws ImportStatusException
+ */
+ public function findManifestXMLFileHandlers(): ManifestXMLFileCollectionInterface
+ {
+ $export_obj_type = $this->getExportObjectType();
+ $type_name = ExportObjectType::toString($export_obj_type);
+ $path = $this->file_path_factory->handler()
+ ->withStartAtRoot(true)
+ ->withNode($this->file_path_factory->node()->simple()->withName(self::MANIFEST_NODE_NAME))
+ ->withNode($this->file_path_factory->node()->simple()->withName($type_name));
+ $xml_file_infos = $this->xml_file_factory->manifest()->collection();
+ foreach ($this->parser_handler->getNodeInfoAt($path) as $node_info) {
+ $file_name = $node_info->getNodeName() === ExportObjectType::toString(ExportObjectType::EXPORT_SET)
+ ? DIRECTORY_SEPARATOR . self::MANIFEST_FILE_NAME
+ : '';
+ $xml_file_infos = $xml_file_infos->withElement($this->xml_file_factory->manifest()->handler()
+ ->withFileInfo(new SplFileInfo(
+ $this->getPathToFileLocation()
+ . DIRECTORY_SEPARATOR
+ . $node_info->getValueOfAttribute(self::FILE_PATH_ATTRIBUTE_NAME)
+ . $file_name
+ )));
+ }
+ return $xml_file_infos;
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilFactory.php
deleted file mode 100755
index ebdd016c684f..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilFactory.php
+++ /dev/null
@@ -1,83 +0,0 @@
-logger = $logger;
- $this->lng = $lng;
- $this->schema_factory = $schema_factory;
- }
-
- public function handler(): ilManifestXMLFileHandlerInterface
- {
- return new ilManifestXMLFileHandler(
- new ilFileNamespaceFactory(),
- $this->schema_factory,
- new ilImportStatusFactory(),
- new ilFileFactory($this->logger, $this->lng, $this->schema_factory),
- new ilParserFactory($this->logger),
- $this->logger,
- );
- }
-
- public function withFileInfo(SplFileInfo $file_info): ilManifestXMLFileHandlerInterface
- {
- return (new ilManifestXMLFileHandler(
- new ilFileNamespaceFactory(),
- $this->schema_factory,
- new ilImportStatusFactory(),
- new ilFileFactory($this->logger, $this->lng, $this->schema_factory),
- new ilParserFactory($this->logger),
- $this->logger,
- ))->withFileInfo($file_info);
- }
-
- public function handlerCollection(): ilManifestXMLFileHandlerCollectionInterface
- {
- return new ilManifestXMLFileHandlerCollection(
- new ilImportStatusFactory()
- );
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilHandler.php
deleted file mode 100755
index aed38ce5aa2a..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Manifest/class.ilHandler.php
+++ /dev/null
@@ -1,175 +0,0 @@
-status = $status;
- $this->manifest_xsd_handler = $file->xsd()->withFileInfo($schema->getLatest(
- self::XSD_TYPE,
- self::XSD_SUB_TYPE
- ));
- $this->logger = $logger;
- $this->parser = $parser;
- $this->file = $file;
- $this->schema = $schema;
- }
-
- /**
- * @throws ilImportStatusException
- */
- public function withFileInfo(SplFileInfo $file_info): ilHandler
- {
- $clone = clone $this;
- $clone->xml_file_info = $file_info;
- $clone->parser_handler = $clone->parser->DOM()->withFileHandler($clone);
- return $clone;
- }
-
- /**
- * @throws ilImportStatusException
- */
- public function getExportObjectType(): ilExportObjectType
- {
- $exp_file_file_path = $this->file->path()->handler()
- ->withNode($this->file->path()->node()->simple()->withName(self::MANIFEST_NODE_NAME))
- ->withNode($this->file->path()->node()->simple()->withName(self::EXPORT_FILE_NODE_NAME));
- $exp_set_file_path = $this->file->path()->handler()
- ->withNode($this->file->path()->node()->simple()->withName(self::MANIFEST_NODE_NAME))
- ->withNode($this->file->path()->node()->simple()->withName(self::EXPORT_SET_NODE_NAME));
- $export_file_node_info = $this->parser_handler->getNodeInfoAt($exp_file_file_path);
- $export_set_node_info = $this->parser_handler->getNodeInfoAt($exp_set_file_path);
- if (
- $export_file_node_info->count() > 0 &&
- $export_set_node_info->count() > 0
- ) {
- return ilExportObjectType::MIXED;
- }
- if ($export_file_node_info->count() > 0) {
- return ilExportObjectType::EXPORT_FILE;
- }
- if ($export_set_node_info->count() > 0) {
- return ilExportObjectType::EXPORT_SET;
- }
- return ilExportObjectType::NONE;
- }
-
- public function validateManifestXML(): ilImportStatusHandlerCollectionInterface
- {
- return $this->file->validation()->handler()->validateXMLFile($this, $this->manifest_xsd_handler);
- }
-
- /**
- * @throws ilImportStatusException
- */
- public function findXMLFileHandlers(): ilXMLExportFileCollectionInterface
- {
- $type_name = ilExportObjectType::toString($this->getExportObjectType());
- $path = $this->file->path()->handler()
- ->withStartAtRoot(true)
- ->withNode($this->file->path()->node()->simple()->withName(self::MANIFEST_NODE_NAME))
- ->withNode($this->file->path()->node()->simple()->withName($type_name));
- $file_handlers = $this->file->xml()->export()->collection();
- foreach ($this->parser_handler->getNodeInfoAt($path) as $node_info) {
- $file_name = $node_info->getNodeName() === ilExportObjectType::toString(ilExportObjectType::EXPORT_SET)
- ? DIRECTORY_SEPARATOR . self::MANIFEST_FILE_NAME
- : '';
- $file_handlers = $file_handlers->withElement($this->file->xml()->export()
- ->withFileInfo(new SplFileInfo(
- $this->getPathToFileLocation()
- . DIRECTORY_SEPARATOR
- . $node_info->getValueOfAttribute(self::FILE_PATH_ATTRIBUTE_NAME)
- . $file_name
- )));
- }
- return $file_handlers;
- }
-
- /**
- * @throws ilImportStatusException
- */
- public function findManifestXMLFileHandlers(): ilManifestXMLFileHandlerCollectionInterface
- {
- $export_obj_type = $this->getExportObjectType();
- $type_name = ilExportObjectType::toString($export_obj_type);
- $path = $this->file->path()->handler()
- ->withStartAtRoot(true)
- ->withNode($this->file->path()->node()->simple()->withName(self::MANIFEST_NODE_NAME))
- ->withNode($this->file->path()->node()->simple()->withName($type_name));
- $xml_file_infos = $this->file->xml()->manifest()->handlerCollection();
- foreach ($this->parser_handler->getNodeInfoAt($path) as $node_info) {
- $file_name = $node_info->getNodeName() === ilExportObjectType::toString(ilExportObjectType::EXPORT_SET)
- ? DIRECTORY_SEPARATOR . self::MANIFEST_FILE_NAME
- : '';
- $xml_file_infos = $xml_file_infos->withElement($this->file->xml()->manifest()->handler()
- ->withFileInfo(new SplFileInfo(
- $this->getPathToFileLocation()
- . DIRECTORY_SEPARATOR
- . $node_info->getValueOfAttribute(self::FILE_PATH_ATTRIBUTE_NAME)
- . $file_name
- )));
- }
- return $xml_file_infos;
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilFactory.php
deleted file mode 100755
index d335c5f83c50..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilFactory.php
+++ /dev/null
@@ -1,48 +0,0 @@
-logger = $logger;
- }
-
- public function pair(): ilXMLFileNodeInfoAttributePairInterface
- {
- return new ilXMLFileNodeInfoAttributePair();
- }
-
- public function collection(): ilXMLFileNodeInfoAttributeCollectionInterface
- {
- return new ilXMLFileNodeInfoAttribureCollection($this->logger);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/DOM/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/DOM/class.ilFactory.php
deleted file mode 100755
index cfa242e48ba9..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/DOM/class.ilFactory.php
+++ /dev/null
@@ -1,45 +0,0 @@
-info = $info;
- }
-
- public function withDOMNode(DOMNode $node): ilXMLFileNodeInfoDOMNodeHandlerInterface
- {
- return (new ilXMLFileDOMNodeInfoHandler(
- $this->info
- ))->withDOMNode($node);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilFactory.php
deleted file mode 100755
index 483559e52f77..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilFactory.php
+++ /dev/null
@@ -1,68 +0,0 @@
-logger = $logger;
- }
-
- public function collection(): ilXMLFileNodeInfoCollectionInterface
- {
- return new ilFileNodeInfoCollection();
- }
-
- public function tree(): ilXMLFileNodeInfoTreeInterface
- {
- return new ilXMLFileNodeInfoTree(
- new ilFactory($this->logger),
- new ilParserFactory($this->logger),
- $this->logger
- );
- }
-
- public function attribute(): ilXMLFileNodeInfoAttributeFactoryInterface
- {
- return new ilXMLFileNodeInfoAttributeFactory($this->logger);
- }
-
- public function DOM(): ilXMLFileDOMNodeInfoFactoryInterface
- {
- return new ilXMLFileDOMNodeInfoFactory($this);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/class.ilFactory.php
deleted file mode 100755
index a7beb065c112..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/class.ilFactory.php
+++ /dev/null
@@ -1,42 +0,0 @@
-logger = $logger;
- }
-
- public function info(): ilXMLFileNodeInfoInterface
- {
- return new ilXMLFileNodeInfo($this->logger);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilFactory.php
deleted file mode 100644
index a7077c6f4008..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilFactory.php
+++ /dev/null
@@ -1,124 +0,0 @@
-logger = $logger;
- $this->lng = $lng;
- $this->schema_factory = $schema_factory;
- }
-
- public function handler(): ilXMLFileSchemaHandlerInterface
- {
- return new ilXMLFileSchemaHandler(
- new ilFilePathFactory($this->logger),
- $this->schema_factory,
- new ilParserFactory($this->logger),
- new ilXSDFileFactory()
- );
- }
-
- public function handlersFromXMLFileHandlerAtPath(
- ilXMLFileHandlerInterface $xml_file_handler,
- ilXMLFilePathHandlerInterface $path_to_entities
- ): ilXMLFileSchemaCollectionInterface {
- $parser = new ilParserFactory($this->logger);
- $path = new ilFilePathFactory($this->logger);
- $xml_file_node_info = $parser->DOM()->withFileHandler($xml_file_handler)
- ->getNodeInfoAt($this->getPathToExportNode($path))
- ->current();
- $nodes = $parser->DOM()->withFileHandler($xml_file_handler)->getNodeInfoAt($path_to_entities);
- $collection = new ilXMLFileSchemaCollection();
- foreach ($nodes as $node) {
- $collection = $collection->withElement($this->initSchemaFileFromXMLNodeInfoHandler($node));
- }
- return $collection;
- }
-
- protected function initSchemaFileFromXMLNodeInfoHandler(
- ilXMLFileNodeInfoHandlerInterface $xml_file_node_info
- ): ilXMLFileSchemaHandler {
- $types = $this->getTypesArray($xml_file_node_info);
- $version_str = $this->getVersionString($xml_file_node_info);
- if ($version_str === '') {
- return $this->handler()
- ->withType($types[0])
- ->withSubType($types[1]);
- }
- return $this->handler()
- ->withType($types[0])
- ->withSubType($types[1])
- ->withVersion(new Version($version_str));
- }
-
- /**
- * @return string[]
- */
- protected function getTypesArray(ilXMLFileNodeInfoHandlerInterface $xml_file_node_info): array
- {
- $type_str = $xml_file_node_info->getValueOfAttribute('Entity');
- return str_contains($type_str, '_')
- ? explode('_', $type_str)
- : [$type_str, ''];
- }
-
- protected function getVersionString(ilXMLFileNodeInfoHandlerInterface $xml_file_node_info): string
- {
- return $xml_file_node_info->hasAttribute('SchemaVersion')
- ? $xml_file_node_info->getValueOfAttribute('SchemaVersion')
- : '';
- }
-
- protected function getPathToExportNode(ilFilePathFactoryInterface $path): ilFilePathHandlerInterface
- {
- return $path->handler()
- ->withStartAtRoot(true)
- ->withNode($path->node()->simple()->withName('exp:Export'));
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilHandler.php
deleted file mode 100644
index 219679fc5378..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilHandler.php
+++ /dev/null
@@ -1,161 +0,0 @@
-path = $path;
- $this->schema = $schema;
- $this->parser = $parser;
- $this->xsd = $xsd;
- $this->type = null;
- $this->subtype = null;
- $this->version = null;
- $this->xml_file_handler = null;
- $this->xml_file_node_info = null;
- }
-
- public function getXSDFileHandlerByVersionOrLatest(): null|ilXSDFileHandlerInterface
- {
- if (
- is_null($this->getVersion()) ||
- is_null($this->getPrimaryType()) ||
- is_null($this->getSecondaryType())
- ) {
- return null;
- }
- $latest_file_info = $this->schema->getByVersionOrLatest(
- $this->getVersion(),
- $this->getPrimaryType(),
- $this->getSecondaryType()
- );
- return is_null($latest_file_info)
- ? null
- : $this->xsd->withFileInfo($latest_file_info);
- }
-
- public function getXSDFileHandlerLatest(): null|ilXSDFileHandlerInterface
- {
- if (
- is_null($this->getPrimaryType()) ||
- is_null($this->getSecondaryType())
- ) {
- return null;
- }
- $latest_file_info = $this->schema->getLatest(
- $this->getPrimaryType(),
- $this->getSecondaryType()
- );
- return is_null($latest_file_info)
- ? null
- : $this->xsd->withFileInfo($latest_file_info);
- }
-
- public function doesXSDFileWithMatchingVersionExist(): bool
- {
- if (
- is_null($this->getVersion()) ||
- is_null($this->getPrimaryType()) ||
- is_null($this->getSecondaryType())
- ) {
- return false;
- }
- $file_info_with_version = $this->schema->getByVersion(
- $this->getVersion(),
- $this->getPrimaryType(),
- $this->getSecondaryType()
- );
- return !is_null($file_info_with_version);
- }
-
- public function withType(string $type): ilXMLFileSchemaHandlerInterface
- {
- $clone = clone $this;
- $clone->type = $type;
- return $clone;
- }
-
- public function withSubType(string $subtype): ilXMLFileSchemaHandlerInterface
- {
- $clone = clone $this;
- $clone->subtype = $subtype;
- return $clone;
- }
-
- public function withVersion(Version $version): ilXMLFileSchemaHandlerInterface
- {
- $clone = clone $this;
- $clone->version = $version;
- return $clone;
- }
-
- public function getVersion(): null|Version
- {
- return $this->version;
- }
-
- public function getPrimaryType(): null|string
- {
- return $this->type;
- }
-
- public function getSecondaryType(): null|string
- {
- return $this->subtype;
- }
-
- public function getTypeString(): string
- {
- if (is_null($this->getPrimaryType())) {
- return '';
- }
- if (is_null($this->getSecondaryType())) {
- return $this->getPrimaryType();
- }
- return $this->getPrimaryType() . '_' . $this->getSecondaryType();
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilFactory.php
deleted file mode 100755
index 3975f95b4a85..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/class.ilFactory.php
+++ /dev/null
@@ -1,103 +0,0 @@
-logger = $logger;
- $this->lng = $lng;
- $this->schema_factory = $schema_factory;
- }
-
- public function withFileInfo(SplFileInfo $file_info): ilXMLFileHanlderInterface
- {
- return (new ilXMLFileHanlder(
- new ilFileNamespaceFactory(),
- new ilStatusFactory()
- ))->withFileInfo($file_info);
- }
-
- public function collection(): ilXMLFileHanlderCollectionInterface
- {
- return new ilXMLFileHanlderCollection();
- }
-
- public function manifest(): ilManifestFileFactoryInterface
- {
- return new ilManifestFileFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- );
- }
-
- public function node(): ilXMLFileNodeFactoryInterface
- {
- return new ilXMLFileNodeFactory($this->logger);
- }
-
- public function export(): ilXMLExportFileFactoryInterface
- {
- return new ilXMLExportFileFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- );
- }
-
- public function schema(): ilXMLFileSchemaFactoryInterface
- {
- return new ilXMLFileSchemaFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- );
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XSD/Factory.php b/components/ILIAS/Export/classes/ImportHandler/File/XSD/Factory.php
new file mode 100755
index 000000000000..f384fb0a9979
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XSD/Factory.php
@@ -0,0 +1,46 @@
+import_handler = $import_handler;
+ }
+
+ public function handler(): XSDFileHandlerInterface
+ {
+ return new XSDFileHandler(
+ $this->import_handler->file()->namespace()
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XSD/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/File/XSD/Handler.php
similarity index 66%
rename from components/ILIAS/Export/classes/ImportHandler/File/XSD/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/File/XSD/Handler.php
index e93ab9335dc6..d423c20b8122 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XSD/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/File/XSD/Handler.php
@@ -20,16 +20,16 @@
namespace ILIAS\Export\ImportHandler\File\XSD;
-use ILIAS\Export\ImportHandler\File\ilHandler as ilFileHandler;
-use ILIAS\Export\ImportHandler\I\File\XSD\ilHandlerInterface as ilXSDFileHandlerInterface;
+use ILIAS\Export\ImportHandler\File\Handler as File;
+use ILIAS\Export\ImportHandler\I\File\XSD\HandlerInterface as XSDFileInterface;
use SplFileInfo;
-class ilHandler extends ilFileHandler implements ilXSDFileHandlerInterface
+class Handler extends File implements XSDFileInterface
{
- public function withFileInfo(SplFileInfo $file_info): ilHandler
+ public function withFileInfo(SplFileInfo $file_info): XSDFileInterface
{
$clone = clone $this;
- $clone->xml_file_info = $file_info;
+ $clone->spl_file_info = $file_info;
return $clone;
}
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XSD/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/XSD/class.ilFactory.php
deleted file mode 100755
index 9cb02a49f264..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/XSD/class.ilFactory.php
+++ /dev/null
@@ -1,35 +0,0 @@
-withFileInfo($file_info);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/File/class.ilFactory.php
deleted file mode 100755
index c8b9a9622d59..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/File/class.ilFactory.php
+++ /dev/null
@@ -1,86 +0,0 @@
-logger = $logger;
- $this->lng = $lng;
- $this->schema_factory = $schema_factory;
- }
-
- public function xml(): ilXMLFileFactoryInterface
- {
- return new ilXMLFileFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- );
- }
-
- public function xsd(): ilXSDFileFactoryInterface
- {
- return new ilXSDFileFactory();
- }
-
- public function validation(): ilFileValidationFactoryInterface
- {
- return new ilFileValidationFactory($this->logger);
- }
-
- public function path(): ilFilePathFactoryInterface
- {
- return new ilFilePathFactory($this->logger);
- }
-
- public function namespace(): ilFileNamespaceFactoryInterface
- {
- return new ilFileNamespaceFactory();
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/I/FactoryInterface.php b/components/ILIAS/Export/classes/ImportHandler/I/FactoryInterface.php
new file mode 100755
index 000000000000..cb8564cb67e2
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/I/FactoryInterface.php
@@ -0,0 +1,40 @@
+operator = $operator;
- $this->value = $value;
- }
+ public function withComparison(PathComparisonInterface $comparison): IndexInterface;
- public function toString()
- {
- return Operator::toString($this->operator) . $this->value;
- }
+ public function withIndexingFromEndEnabled(bool $enabled): IndexInterface;
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/I/File/Path/Node/interface.ilNodeInterface.php b/components/ILIAS/Export/classes/ImportHandler/I/Path/Node/NodeInterface.php
similarity index 88%
rename from components/ILIAS/Export/classes/ImportHandler/I/File/Path/Node/interface.ilNodeInterface.php
rename to components/ILIAS/Export/classes/ImportHandler/I/Path/Node/NodeInterface.php
index 50e0ddb1fda0..0d0e4242355b 100755
--- a/components/ILIAS/Export/classes/ImportHandler/I/File/Path/Node/interface.ilNodeInterface.php
+++ b/components/ILIAS/Export/classes/ImportHandler/I/Path/Node/NodeInterface.php
@@ -18,9 +18,9 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\I\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\I\Path\Node;
-interface ilNodeInterface
+interface NodeInterface
{
public function toString(): string;
diff --git a/components/ILIAS/Export/classes/ImportHandler/I/Path/Node/OpenRoundBrackedInterface.php b/components/ILIAS/Export/classes/ImportHandler/I/Path/Node/OpenRoundBrackedInterface.php
new file mode 100755
index 000000000000..829fa4c1c646
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/I/Path/Node/OpenRoundBrackedInterface.php
@@ -0,0 +1,27 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ }
+
+ public function handler(): DOMParserInterface
+ {
+ return new DOMParser(
+ $this->logger,
+ $this->import_handler->parser()->nodeInfo()
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/DOM/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/Parser/DOM/Handler.php
similarity index 61%
rename from components/ILIAS/Export/classes/ImportHandler/Parser/DOM/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/Parser/DOM/Handler.php
index 6f5760076cdc..56a29c537a7e 100755
--- a/components/ILIAS/Export/classes/ImportHandler/Parser/DOM/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/DOM/Handler.php
@@ -23,33 +23,33 @@
use DOMDocument;
use DOMNode;
use DOMXPath;
+use ILIAS\Export\ImportHandler\I\File\XML\HandlerInterface as XMLFileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Parser\DOM\HandlerInterface as DOMParserHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\CollectionInterface as XMLFileNodeInfoCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\FactoryInterface as XMLFileNodeInfoFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Path\HandlerInterface as PathInterface;
+use ILIAS\Export\ImportStatus\Exception\ilException as ImportStatusException;
use ilLogger;
-use ILIAS\Export\ImportHandler\I\File\Path\ilHandlerInterface as ilFilePathHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\ilHandlerInterface as ilXMLFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilCollectionInterface as ilXMLFileNodeInfoCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilFactoryInterface as ilXMLFileNodeInfoFactoryInterface;
-use ILIAS\Export\ImportHandler\I\Parser\DOM\ilHandlerInterface as ilDOMParserHandlerInterface;
-use ILIAS\Export\ImportStatus\Exception\ilException as ilImportStatusException;
-class ilHandler implements ilDOMParserHandlerInterface
+class Handler implements DOMParserHandlerInterface
{
- protected ilXMLFileHandlerInterface $xml_file_handler;
- protected ilXMLFileNodeInfoFactoryInterface $info;
+ protected XMLFileHandlerInterface $xml_file_handler;
+ protected XMLFileNodeInfoFactoryInterface $info;
protected ilLogger $logger;
protected DOMDocument $dom_doc;
public function __construct(
ilLogger $logger,
- ilXMLFileNodeInfoFactoryInterface $info,
+ XMLFileNodeInfoFactoryInterface $info,
) {
$this->logger = $logger;
$this->info = $info;
}
/**
- * @throws ilImportStatusException
+ * @throws ImportStatusException
*/
- public function withFileHandler(ilXMLFileHandlerInterface $file_handler): ilDOMParserHandlerInterface
+ public function withFileHandler(XMLFileHandlerInterface $file_handler): DOMParserHandlerInterface
{
$clone = clone $this;
$clone->xml_file_handler = $file_handler;
@@ -57,7 +57,7 @@ public function withFileHandler(ilXMLFileHandlerInterface $file_handler): ilDOMP
return $clone;
}
- public function getNodeInfoAt(ilFilePathHandlerInterface $path): ilXMLFileNodeInfoCollectionInterface
+ public function getNodeInfoAt(PathInterface $path): XMLFileNodeInfoCollectionInterface
{
$dom_xpath = new DOMXPath($this->dom_doc);
foreach ($this->xml_file_handler->getNamespaces() as $namespace) {
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/DOM/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/Parser/DOM/class.ilFactory.php
deleted file mode 100755
index 1d46052ea4d3..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/Parser/DOM/class.ilFactory.php
+++ /dev/null
@@ -1,48 +0,0 @@
-logger = $logger;
- }
-
- public function withFileHandler(ilXMLFileHandlerInterface $file_handler): ilDOMParserHandlerInterface
- {
- return (new ilDOMParser(
- $this->logger,
- new ilXMLFileNodeInfoFactory($this->logger)
- ))->withFileHandler($file_handler);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Parser/Factory.php
new file mode 100755
index 000000000000..48dc7dcc59b3
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/Factory.php
@@ -0,0 +1,59 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ }
+
+ public function DOM(): DOMParserFactoryInterface
+ {
+ return new DOMParserFactory(
+ $this->import_handler,
+ $this->logger
+ );
+ }
+
+ public function nodeInfo(): ParserNodeInfoFactoryInterface
+ {
+ return new ParserNodeInfoFactory(
+ $this->import_handler,
+ $this->logger
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilCollection.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Collection.php
similarity index 70%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Collection.php
index 88330c9a2113..630468b5373c 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Collection.php
@@ -18,17 +18,17 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\XML\Node\Info\Attribute;
+namespace ILIAS\Export\ImportHandler\Parser\NodeInfo\Attribute;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\Attribute\ilCollectionInterface as ilXMLFileNodeInfoAttributeCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\Attribute\ilPairInterface as ilXMLFileNodeInfoAttributePairInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilHandlerInterface as ilXMLFileNodeInfoInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\Attribute\CollectionInterface as ParserNodeInfoAttributeCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\Attribute\HandlerInterface as ParserNodeInfoAttributeInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\HandlerInterface as ParserNodeInfoInterface;
use ilLogger;
-class ilCollection implements ilXMLFileNodeInfoAttributeCollectionInterface
+class Collection implements ParserNodeInfoAttributeCollectionInterface
{
/**
- * @var ilXMLFileNodeInfoAttributePairInterface[]
+ * @var ParserNodeInfoAttributeInterface[]
*/
protected array $elements;
protected int $index;
@@ -42,7 +42,7 @@ public function __construct(
$this->logger = $logger;
}
- public function matches(ilXMLFileNodeInfoInterface $node_info): bool
+ public function matches(ParserNodeInfoInterface $node_info): bool
{
foreach ($this->elements as $element) {
if (
@@ -57,8 +57,8 @@ public function matches(ilXMLFileNodeInfoInterface $node_info): bool
}
public function withElement(
- ilXMLFileNodeInfoAttributePairInterface $element
- ): ilXMLFileNodeInfoAttributeCollectionInterface {
+ ParserNodeInfoAttributeInterface $element
+ ): ParserNodeInfoAttributeCollectionInterface {
$clone = clone $this;
$clone->elements[] = $element;
return $clone;
@@ -69,7 +69,7 @@ public function toArray(): array
return $this->elements;
}
- public function current(): ilXMLFileNodeInfoAttributePairInterface
+ public function current(): ParserNodeInfoAttributeInterface
{
return $this->elements[$this->index];
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Factory.php
new file mode 100755
index 000000000000..f284a6b00ba2
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Factory.php
@@ -0,0 +1,50 @@
+logger = $logger;
+ }
+
+ public function handler(): ParserNodeInfoAttributeInterface
+ {
+ return new ParserNodeInfoAttribute();
+ }
+
+ public function collection(): ParserNodeInfoAttributeCollectionInterface
+ {
+ return new ParserNodeInfoAttribureCollection(
+ $this->logger
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilPair.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Handler.php
similarity index 70%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilPair.php
rename to components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Handler.php
index babeafa22485..33ff796def2a 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/Attribute/class.ilPair.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Attribute/Handler.php
@@ -18,11 +18,11 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\XML\Node\Info\Attribute;
+namespace ILIAS\Export\ImportHandler\Parser\NodeInfo\Attribute;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\Attribute\ilPairInterface as ilXMLFileNodeInfoAttributePairInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\Attribute\HandlerInterface as ParserNodeInfoAttributeInterface;
-class ilPair implements ilXMLFileNodeInfoAttributePairInterface
+class Handler implements ParserNodeInfoAttributeInterface
{
protected string $key;
protected string $value;
@@ -33,15 +33,17 @@ public function __construct()
$this->value = '';
}
- public function withValue(string $value): ilXMLFileNodeInfoAttributePairInterface
- {
+ public function withValue(
+ string $value
+ ): ParserNodeInfoAttributeInterface {
$clone = clone $this;
$clone->value = $value;
return $clone;
}
- public function withKey(string $key): ilXMLFileNodeInfoAttributePairInterface
- {
+ public function withKey(
+ string $key
+ ): ParserNodeInfoAttributeInterface {
$clone = clone $this;
$clone->key = $key;
return $clone;
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilCollection.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Collection.php
similarity index 56%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Collection.php
index a4393f1c4f0b..49b25d26c4ed 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Collection.php
@@ -1,14 +1,14 @@
index = 0;
}
- public function getFirst(): ilXMLFileNodeInfoInterface
+ public function getFirst(): ParserNodeInfoInterface
{
return $this->elements[0];
}
- public function removeFirst(): ilXMLFileNodeInfoCollectionInterface
+ public function removeFirst(): ParserNodeInfoCollectionInterface
{
$clone = clone $this;
$clone->index = $this->index;
@@ -37,15 +37,17 @@ public function count(): int
return count($this->elements);
}
- public function withMerged(ilXMLFileNodeInfoCollectionInterface $other): ilXMLFileNodeInfoCollectionInterface
- {
+ public function withMerged(
+ ParserNodeInfoCollectionInterface $other
+ ): ParserNodeInfoCollectionInterface {
$clone = clone $this;
$clone->elements = array_merge($this->toArray(), $other->toArray());
return $clone;
}
- public function withElement(ilXMLFileNodeInfoInterface $element): ilXMLFileNodeInfoCollectionInterface
- {
+ public function withElement(
+ ParserNodeInfoInterface $element
+ ): ParserNodeInfoCollectionInterface {
$clone = clone $this;
$clone->elements[] = $element;
return $clone;
@@ -56,7 +58,7 @@ public function toArray(): array
return $this->elements;
}
- public function current(): ilXMLFileNodeInfoInterface
+ public function current(): ParserNodeInfoInterface
{
return $this->elements[$this->index];
}
@@ -73,7 +75,7 @@ public function key(): int
public function valid(): bool
{
- return 0 <= $this->index && $this->index < $this->count();
+ return isset($this->elements[$this->index]);
}
public function rewind(): void
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/DOM/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/DOM/Factory.php
new file mode 100755
index 000000000000..06135d172e02
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/DOM/Factory.php
@@ -0,0 +1,45 @@
+info = $info;
+ }
+
+ public function withDOMNode(DOMNode $node): ParserNodeInfoDOMNodeInterface
+ {
+ return (new ParserDOMNodeInfo(
+ $this->info
+ ))->withDOMNode($node);
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/DOM/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/DOM/Handler.php
similarity index 74%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/DOM/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/DOM/Handler.php
index 5c452fc990a1..8d351a8fdb2a 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/DOM/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/DOM/Handler.php
@@ -18,26 +18,26 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\XML\Node\Info\DOM;
+namespace ILIAS\Export\ImportHandler\Parser\NodeInfo\DOM;
use DOMAttr;
use DOMNode;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\DOM\ilHandlerInterface as ilXMLFileNodeInfoilDOMNodeHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilCollectionInterface as ilXMLFileNodeInfoCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilFactoryInterface as ilXMLFileNodeInfoFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\CollectionInterface as ParserNodeInfoCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\DOM\HandlerInterface as ParserNodeInfoilDOMNodeInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\FactoryInterface as ParserNodeInfoFactoryInterface;
use ilImportException;
-class ilHandler implements ilXMLFileNodeInfoilDOMNodeHandlerInterface
+class Handler implements ParserNodeInfoilDOMNodeInterface
{
/**
* @var array
*/
protected array $attributes;
protected DOMNode $node;
- protected ilXMLFileNodeInfoFactoryInterface $info;
+ protected ParserNodeInfoFactoryInterface $info;
public function __construct(
- ilXMLFileNodeInfoFactoryInterface $info
+ ParserNodeInfoFactoryInterface $info
) {
$this->attributes = [];
$this->info = $info;
@@ -45,7 +45,7 @@ public function __construct(
protected function initAttributes()
{
- if(is_null($this->node->attributes)) {
+ if (is_null($this->node->attributes)) {
return;
}
/** @var DOMAttr $attribute **/
@@ -54,7 +54,7 @@ protected function initAttributes()
}
}
- public function withDOMNode(DOMNode $node): ilHandler
+ public function withDOMNode(DOMNode $node): Handler
{
$clone = clone $this;
$clone->node = $node;
@@ -80,7 +80,7 @@ public function getValueOfAttribute(string $attribute_name): string
return $this->attributes[$attribute_name];
}
- public function getChildren(): ilXMLFileNodeInfoCollectionInterface
+ public function getChildren(): ParserNodeInfoCollectionInterface
{
$collection = $this->info->collection();
$children = $this->node->childNodes;
@@ -90,9 +90,9 @@ public function getChildren(): ilXMLFileNodeInfoCollectionInterface
return $collection;
}
- public function getParent(): ilHandler|null
+ public function getParent(): Handler|null
{
- if(!is_null($this->node->parentNode)) {
+ if (!is_null($this->node->parentNode)) {
return $this->info->DOM()->withDOMNode($this->node->parentNode);
}
return null;
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Factory.php
new file mode 100755
index 000000000000..9ded29275be8
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Factory.php
@@ -0,0 +1,74 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ }
+
+ public function collection(): ParserNodeInfoCollectionInterface
+ {
+ return new ParserNodeInfoCollection();
+ }
+
+ public function tree(): ParserNodeInfoTreeFactoryInterface
+ {
+ return new ParserNodeInfoTreeFactory(
+ $this->import_handler,
+ $this->logger
+ );
+ }
+
+ public function attribute(): ParserNodeInfoAttributeFactoryInterface
+ {
+ return new ParserNodeInfoAttributeFactory(
+ $this->logger
+ );
+ }
+
+ public function DOM(): ParserDOMNodeInfoFactoryInterface
+ {
+ return new ParserDOMNodeInfoFactory(
+ $this
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Tree/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Tree/Factory.php
new file mode 100644
index 000000000000..139f1623dab9
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Tree/Factory.php
@@ -0,0 +1,50 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ }
+
+ public function handler(): ParserNodeInfoTreeInterface
+ {
+ return new ParserNodeInfoTree(
+ $this->import_handler->parser()->nodeInfo(),
+ $this->import_handler->parser(),
+ $this->logger
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilTree.php b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Tree/Handler.php
similarity index 54%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilTree.php
rename to components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Tree/Handler.php
index 0b89d550d14a..e4779b8f9229 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Node/Info/class.ilTree.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Parser/NodeInfo/Tree/Handler.php
@@ -18,30 +18,30 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\XML\Node\Info;
+namespace ILIAS\Export\ImportHandler\Parser\NodeInfo\Tree;
-use ILIAS\Export\ImportHandler\I\File\Path\ilHandlerInterface as ilXMLFilePathHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\ilHandlerInterface as ilXMLFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\Attribute\ilCollectionInterface as ilXMLFileNodeInfoAttributePairCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilCollectionInterface as ilXMLFileNodeInfoCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilFactoryInterface as ilXMLFileNodeInfoFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilHandlerInterface as ilXMLFileNodeInfoInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilTreeInterface as ilXMLFileNodeInfoTreeInterface;
-use ILIAS\Export\ImportHandler\I\Parser\ilFactoryInterface as ilParserFactoryInterface;
-use ILIAS\Export\ImportStatus\Exception\ilException as ilImportStatusException;
+use ILIAS\Export\ImportHandler\I\File\XML\HandlerInterface as XMLFileInterface;
+use ILIAS\Export\ImportHandler\I\Parser\FactoryInterface as ParserFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\Attribute\CollectionInterface as ParserNodeInfoAttributeCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\CollectionInterface as ParserNodeInfoCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\FactoryInterface as ParserNodeInfoFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\HandlerInterface as ParserNodeInfoInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\Tree\HandlerInterface as ParserNodeInfoTreeInterface;
+use ILIAS\Export\ImportHandler\I\Path\HandlerInterface as PathInterface;
+use ILIAS\Export\ImportStatus\Exception\ilException as ImportStatusException;
use ilLogger;
-class ilTree implements ilXMLFileNodeInfoTreeInterface
+class Handler implements ParserNodeInfoTreeInterface
{
- protected ilXMLFileNodeInfoInterface $root;
- protected ilXMLFileNodeInfoFactoryInterface $info;
- protected ilParserFactoryInterface $parser;
- protected ilXMLFileHandlerInterface $xml;
+ protected ParserNodeInfoInterface $root;
+ protected ParserNodeInfoFactoryInterface $info;
+ protected ParserFactoryInterface $parser;
+ protected XMLFileInterface $xml;
protected ilLogger $logger;
public function __construct(
- ilXMLFileNodeInfoFactoryInterface $info,
- ilParserFactoryInterface $parser,
+ ParserNodeInfoFactoryInterface $info,
+ ParserFactoryInterface $parser,
ilLogger $logger
) {
$this->info = $info;
@@ -49,7 +49,7 @@ public function __construct(
$this->logger = $logger;
}
- public function withRoot(ilXMLFileNodeInfoInterface $node_info): ilXMLFileNodeInfoTreeInterface
+ public function withRoot(ParserNodeInfoInterface $node_info): ParserNodeInfoTreeInterface
{
$clone = clone $this;
$clone->root = $node_info;
@@ -57,15 +57,17 @@ public function withRoot(ilXMLFileNodeInfoInterface $node_info): ilXMLFileNodeIn
}
/**
- * @throws ilImportStatusException
+ * @throws ImportStatusException
*/
public function withRootInFile(
- ilXMLFileHandlerInterface $xml_handler,
- ilXMLFilePathHandlerInterface $path_handler
- ): ilXMLFileNodeInfoTreeInterface {
+ XMLFileInterface $xml_handler,
+ PathInterface $path_handler
+ ): ParserNodeInfoTreeInterface {
$clone = clone $this;
$clone->xml = $xml_handler;
- $items = $this->parser->DOM()->withFileHandler($xml_handler)->getNodeInfoAt($path_handler);
+ $items = $this->parser->DOM()->handler()
+ ->withFileHandler($xml_handler)
+ ->getNodeInfoAt($path_handler);
if ($items->count() === 0) {
unset($clone->root);
}
@@ -76,9 +78,9 @@ public function withRootInFile(
}
public function getNodesWith(
- ilXMLFileNodeInfoAttributePairCollectionInterface $attribute_pairs
- ): ilXMLFileNodeInfoCollectionInterface {
- if(!isset($this->root)) {
+ ParserNodeInfoAttributeCollectionInterface $attribute_pairs
+ ): ParserNodeInfoCollectionInterface {
+ if (!isset($this->root)) {
return $this->info->collection();
}
$nodes = $this->info->collection()->withMerged($this->root->getChildren());
@@ -95,14 +97,14 @@ public function getNodesWith(
}
public function getFirstNodeWith(
- ilXMLFileNodeInfoAttributePairCollectionInterface $attribute_pairs
- ): ilXMLFileNodeInfoInterface|null {
+ ParserNodeInfoAttributeCollectionInterface $attribute_pairs
+ ): ParserNodeInfoInterface|null {
$nodes = $this->getNodesWith($attribute_pairs);
return count($nodes) === 0 ? null : $nodes->getFirst();
}
public function getAttributePath(
- ilXMLFileNodeInfoInterface $startNode,
+ ParserNodeInfoInterface $startNode,
string $attribute_name,
string $path_separator,
bool $skip_nodes_without_attribute = true
@@ -110,7 +112,7 @@ public function getAttributePath(
$path_str = '';
$current_node = $startNode;
while (!is_null($current_node)) {
- if($skip_nodes_without_attribute && !$current_node->hasAttribute($attribute_name)) {
+ if ($skip_nodes_without_attribute && !$current_node->hasAttribute($attribute_name)) {
break;
}
$path_str = $current_node->hasAttribute($attribute_name)
diff --git a/components/ILIAS/Export/classes/ImportHandler/Parser/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/Parser/class.ilFactory.php
deleted file mode 100755
index 4a05c53e993c..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/Parser/class.ilFactory.php
+++ /dev/null
@@ -1,44 +0,0 @@
-logger = $logger;
- }
-
- public function DOM(): ilDOMParserFactoryInterface
- {
- return new ilDOMParserFactory($this->logger);
- }
-}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Path/Comparison/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Path/Comparison/Factory.php
new file mode 100755
index 000000000000..2b7a4ba6002e
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Comparison/Factory.php
@@ -0,0 +1,33 @@
+operator) ?? "") . ($this->value ?? "");
+ }
+
+ public function withOperator(
+ PathComparisonOperator $operator
+ ): FilePathComparisonInterface {
+ $clone = clone $this;
+ $clone->operator = $operator;
+ return $clone;
+ }
+
+ public function withValue(
+ string $value
+ ): FilePathComparisonInterface {
+ $clone = clone $this;
+ $clone->value = $value;
+ return $clone;
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Comparison/enum.Operator.php b/components/ILIAS/Export/classes/ImportHandler/Path/Comparison/Operator.php
similarity index 94%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Comparison/enum.Operator.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Comparison/Operator.php
index 26dceec0dbd7..59152f7cfc61 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Comparison/enum.Operator.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Comparison/Operator.php
@@ -18,7 +18,7 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Comparison;
+namespace ILIAS\Export\ImportHandler\Path\Comparison;
enum Operator
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/Path/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Path/Factory.php
new file mode 100755
index 000000000000..aad9ecfbfcd7
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Factory.php
@@ -0,0 +1,58 @@
+logger = $logger;
+ }
+
+ public function handler(): FilePathHandlerInterface
+ {
+ return new Path();
+ }
+
+ public function node(): PathNodeFactoryInterface
+ {
+ return new PathNodeFactory(
+ $this->logger
+ );
+ }
+
+ public function comparison(): PathComparisonFactoryInterface
+ {
+ return new PathComparisonFactory();
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/Path/Handler.php
similarity index 75%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Handler.php
index 241e5e1f46d0..013a728583b1 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Handler.php
@@ -18,15 +18,15 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path;
+namespace ILIAS\Export\ImportHandler\Path;
-use ILIAS\Export\ImportHandler\I\File\Path\ilHandlerInterface as ilParserPathHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilNodeInterface as ilFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\HandlerInterface as ParserPathHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\NodeInterface as FilePathNodeInterface;
-class ilHandler implements ilParserPathHandlerInterface
+class Handler implements ParserPathHandlerInterface
{
/**
- * @var ilFilePathNodeInterface[]
+ * @var FilePathNodeInterface[]
*/
protected array $nodes;
protected int $index;
@@ -39,14 +39,14 @@ public function __construct()
$this->with_start_at_root_enabled = false;
}
- public function withStartAtRoot(bool $enabled): ilParserPathHandlerInterface
+ public function withStartAtRoot(bool $enabled): ParserPathHandlerInterface
{
$clone = clone $this;
$clone->with_start_at_root_enabled = $enabled;
return $clone;
}
- public function withNode(ilFilePathNodeInterface $node): ilParserPathHandlerInterface
+ public function withNode(FilePathNodeInterface $node): ParserPathHandlerInterface
{
$clone = clone $this;
$clone->nodes[] = $node;
@@ -75,7 +75,7 @@ public function toString(): string
return $path_str;
}
- public function subPath(int $start, ?int $end = null): ilParserPathHandlerInterface
+ public function subPath(int $start, ?int $end = null): ParserPathHandlerInterface
{
$clone = clone $this;
$clone->nodes = is_null($end)
@@ -84,14 +84,14 @@ public function subPath(int $start, ?int $end = null): ilParserPathHandlerInterf
return $clone;
}
- public function firstElement(): ilFilePathNodeInterface|null
+ public function firstElement(): FilePathNodeInterface|null
{
return $this->count() > 0
? $this->nodes[0]
: null;
}
- public function lastElement(): ilFilePathNodeInterface|null
+ public function lastElement(): FilePathNodeInterface|null
{
return $this->count() > 0
? $this->nodes[$this->count() - 1]
@@ -99,14 +99,14 @@ public function lastElement(): ilFilePathNodeInterface|null
}
/**
- * @return ilFilePathNodeInterface[]
+ * @return FilePathNodeInterface[]
*/
public function toArray(): array
{
return $this->nodes;
}
- public function current(): ilFilePathNodeInterface
+ public function current(): FilePathNodeInterface
{
return $this->nodes[$this->index];
}
@@ -123,7 +123,7 @@ public function key(): int
public function valid(): bool
{
- return 0 <= $this->index && $this->index < $this->count();
+ return isset($this->nodes[$this->index]);
}
public function rewind(): void
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAnyElement.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/AnyElement.php
similarity index 76%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAnyElement.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Node/AnyElement.php
index 790d91313d26..cb1be6972314 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAnyElement.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/AnyElement.php
@@ -18,11 +18,11 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilAnyElementInterface as ilAnyElementFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\AnyElementInterface as AnyElementFilePathNodeInterface;
-class ilAnyElement implements ilAnyElementFilePathNodeInterface
+class AnyElement implements AnyElementFilePathNodeInterface
{
public function toString(): string
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAnyNode.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/AnyNode.php
similarity index 77%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAnyNode.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Node/AnyNode.php
index 8dd08af8a314..8212ef7830f0 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAnyNode.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/AnyNode.php
@@ -18,11 +18,11 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilAnyNodeInterface as ilAnyNodeFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\AnyNodeInterface as AnyNodeFilePathNodeInterface;
-class ilAnyNode implements ilAnyNodeFilePathNodeInterface
+class AnyNode implements AnyNodeFilePathNodeInterface
{
public function toString(): string
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAttribute.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Attribute.php
similarity index 62%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAttribute.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Node/Attribute.php
index f89d8a13f3a5..6a323976e142 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilAttribute.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Attribute.php
@@ -18,40 +18,38 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\ilHandlerDummy;
-use ILIAS\Export\ImportHandler\I\File\Path\Comparison\ilHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilAttributeInterface as ilAttributeFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\Comparison\HandlerInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\AttributeInterface as AttributeFilePathNodeInterface;
-class ilAttribute implements ilAttributeFilePathNodeInterface
+class Attribute implements AttributeFilePathNodeInterface
{
- protected ilHandlerInterface $comparison;
+ protected HandlerInterface $comparison;
protected string $attribute;
protected bool $any_attribute_enabled;
public function __construct()
{
$this->attribute = '';
- $this->comparison = new ilHandlerDummy();
$this->any_attribute_enabled = false;
}
- public function withAttribute(string $attribute): ilAttributeFilePathNodeInterface
+ public function withAttribute(string $attribute): AttributeFilePathNodeInterface
{
$clone = clone $this;
$clone->attribute = $attribute;
return $clone;
}
- public function withComparison(ilHandlerInterface $comparison): ilAttributeFilePathNodeInterface
+ public function withComparison(HandlerInterface $comparison): AttributeFilePathNodeInterface
{
$clone = clone $this;
$clone->comparison = $comparison;
return $clone;
}
- public function withAnyAttributeEnabled(bool $enabled): ilAttributeFilePathNodeInterface
+ public function withAnyAttributeEnabled(bool $enabled): AttributeFilePathNodeInterface
{
$clone = clone $this;
$clone->any_attribute_enabled = $enabled;
@@ -62,7 +60,7 @@ public function toString(): string
{
$attribute = $this->any_attribute_enabled
? '@*'
- : '@' . $this->attribute . $this->comparison->toString();
+ : '@' . $this->attribute . (isset($this->comparison) ? $this->comparison->toString() : "");
return '[' . $attribute . ']';
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilCloseRoundBracked.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/CloseRoundBracked.php
similarity index 73%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilCloseRoundBracked.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Node/CloseRoundBracked.php
index 2cb2bb9798cc..fb6dab4b4ab3 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilCloseRoundBracked.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/CloseRoundBracked.php
@@ -18,11 +18,11 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilCloseRoundBrackedInterface as ilCloseRoundBrackedFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\CloseRoundBrackedInterface as CloseRoundBrackedFilePathNodeInterface;
-class ilCloseRoundBracked implements ilCloseRoundBrackedFilePathNodeInterface
+class CloseRoundBracked implements CloseRoundBrackedFilePathNodeInterface
{
public function toString(): string
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/Path/Node/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Factory.php
new file mode 100755
index 000000000000..895f3c139705
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Factory.php
@@ -0,0 +1,83 @@
+logger = $logger;
+ }
+
+ public function anyElement(): PathNodeAnyElementInterface
+ {
+ return new PathNodeAnyElement();
+ }
+
+ public function anyNode(): PathNodeAnyNodeInterface
+ {
+ return new PathNodeAnyNode();
+ }
+
+ public function attribute(): PathNodeAttributeInterface
+ {
+ return new PathNodeAttribute();
+ }
+
+ public function index(): PathNodeIndexInterface
+ {
+ return new PathNodeIndex();
+ }
+
+ public function simple(): PathNodeSimpleInterface
+ {
+ return new PathNodeSimple();
+ }
+
+ public function openRoundBracked(): PathNodeOpenRoundBrackedInterface
+ {
+ return new PathNodeOpenRoundBracked();
+ }
+
+ public function closeRoundBracked(): PathNodeCloseRoundBrackedInterface
+ {
+ return new PathNodeCloseRoundBracked();
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilIndex.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Index.php
similarity index 66%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilIndex.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Node/Index.php
index 858ad732d0a4..1b6a2b97c977 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilIndex.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Index.php
@@ -18,40 +18,38 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\ilHandlerDummy;
-use ILIAS\Export\ImportHandler\I\File\Path\Comparison\ilHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilIndexInterface as ilIndexFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\Comparison\HandlerInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\IndexInterface as IndexFilePathNodeInterface;
-class ilIndex implements ilIndexFilePathNodeInterface
+class Index implements IndexFilePathNodeInterface
{
- protected ilHandlerInterface $comparison;
+ protected HandlerInterface $comparison;
protected int $index;
protected bool $indexing_from_end_enabled;
public function __construct()
{
- $this->comparison = new ilHandlerDummy();
$this->index = 0;
$this->indexing_from_end_enabled = false;
}
- public function withIndex(int $index): ilIndexFilePathNodeInterface
+ public function withIndex(int $index): IndexFilePathNodeInterface
{
$clone = clone $this;
$clone->index = $index;
return $clone;
}
- public function withComparison(ilHandlerInterface $comparison): ilIndexFilePathNodeInterface
+ public function withComparison(HandlerInterface $comparison): IndexFilePathNodeInterface
{
$clone = clone $this;
$clone->comparison = $comparison;
return $clone;
}
- public function withIndexingFromEndEnabled(bool $enabled): ilIndexFilePathNodeInterface
+ public function withIndexingFromEndEnabled(bool $enabled): IndexFilePathNodeInterface
{
$clone = clone $this;
$clone->indexing_from_end_enabled = $enabled;
@@ -61,15 +59,13 @@ public function withIndexingFromEndEnabled(bool $enabled): ilIndexFilePathNodeIn
public function toString(): string
{
$indexing = '';
-
- if ($this->comparison instanceof ilHandlerDummy) {
+ if (!isset($this->comparison)) {
$indexing = $this->indexing_from_end_enabled
? '(last)-' . $this->index
: $this->index;
} else {
$indexing = 'position()' . $this->comparison->toString();
}
-
return '[' . $indexing . ']';
}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilOpenRoundBracked.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/OpenRoundBracked.php
similarity index 74%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilOpenRoundBracked.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Node/OpenRoundBracked.php
index c8efae1dffbc..ba1a51e2e3a6 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilOpenRoundBracked.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/OpenRoundBracked.php
@@ -18,11 +18,11 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilOpenRoundBrackedInterface as ilOpenRoundBrackedFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\OpenRoundBrackedInterface as OpenRoundBrackedFilePathNodeInterface;
-class ilOpenRoundBracked implements ilOpenRoundBrackedFilePathNodeInterface
+class OpenRoundBracked implements OpenRoundBrackedFilePathNodeInterface
{
public function toString(): string
{
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilSimple.php b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Simple.php
similarity index 76%
rename from components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilSimple.php
rename to components/ILIAS/Export/classes/ImportHandler/Path/Node/Simple.php
index 1e56b0bbdbf8..db7695d82804 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Path/Node/class.ilSimple.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Path/Node/Simple.php
@@ -18,11 +18,11 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\I\File\Path\Node\ilSimpleInterface as ilSimpleFilePathNodeInterface;
+use ILIAS\Export\ImportHandler\I\Path\Node\SimpleInterface as SimpleFilePathNodeInterface;
-class ilSimple implements ilSimpleFilePathNodeInterface
+class Simple implements SimpleFilePathNodeInterface
{
protected string $node_name;
@@ -31,7 +31,7 @@ public function __construct()
$this->node_name = '';
}
- public function withName(string $node_name): ilSimpleFilePathNodeInterface
+ public function withName(string $node_name): SimpleFilePathNodeInterface
{
$clone = clone $this;
$clone->node_name = $node_name;
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilCollection.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Collection.php
similarity index 66%
rename from components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/Schema/Collection.php
index f22fc0fe3a20..0c6e1023dc0c 100644
--- a/components/ILIAS/Export/classes/ImportHandler/File/XML/Schema/class.ilCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Collection.php
@@ -18,15 +18,15 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\XML\Schema;
+namespace ILIAS\Export\ImportHandler\Schema;
-use ILIAS\Export\ImportHandler\I\File\XML\Schema\ilCollectionInterface as ilXMLFileSchemaCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Schema\ilHandlerInterface as ilXMLFileSchemaHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Schema\CollectionInterface as SchemaCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Schema\HandlerInterface as SchemaInterface;
-class ilCollection implements ilXMLFileSchemaCollectionInterface
+class Collection implements SchemaCollectionInterface
{
/**
- * @var ilXMLFileSchemaHandlerInterface[]
+ * @var SchemaInterface[]
*/
protected array $elements;
protected int $index;
@@ -42,15 +42,17 @@ public function count(): int
return count($this->elements);
}
- public function withElement(ilXMLFileSchemaHandlerInterface $element): ilXMLFileSchemaCollectionInterface
- {
+ public function withElement(
+ SchemaInterface $element
+ ): SchemaCollectionInterface {
$clone = clone $this;
$clone->elements[] = $element;
return $clone;
}
- public function withMerged(ilXMLFileSchemaCollectionInterface $other): ilXMLFileSchemaCollectionInterface
- {
+ public function withMerged(
+ SchemaCollectionInterface $other
+ ): SchemaCollectionInterface {
$clone = clone $this;
$clone->elements = array_merge($clone->elements, $other->toArray());
return $clone;
@@ -61,7 +63,7 @@ public function toArray(): array
return $this->elements;
}
- public function current(): ilXMLFileSchemaHandlerInterface
+ public function current(): SchemaInterface
{
return $this->elements[$this->index];
}
@@ -78,7 +80,7 @@ public function key(): int
public function valid(): bool
{
- return 0 <= $this->index && $this->index < count($this->elements);
+ return isset($this->elements[$this->index]);
}
public function rewind(): void
diff --git a/components/ILIAS/Export/classes/ImportHandler/Schema/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Factory.php
new file mode 100644
index 000000000000..2de7c339cefe
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Factory.php
@@ -0,0 +1,109 @@
+import_handler = $import_handler;
+ $this->data_factory = $data_factory;
+ $this->logger = $logger;
+ }
+
+ public function handler(): SchemaInterface
+ {
+ return new Schema(
+ $this->folder()->handler(),
+ $this->data_factory,
+ $this->import_handler->parser(),
+ $this->import_handler->file()->xsd()
+ );
+ }
+
+ public function collection(): SchemaCollectionInterface
+ {
+ return new SchemaCollection();
+ }
+
+ public function folder(): SchemaFolderFactoryInterface
+ {
+ return new SchemaFolderFactory(
+ $this->import_handler,
+ $this->logger
+ );
+ }
+
+ public function info(): SchemaInfoFactoryInterface
+ {
+ return new SchemaInfoFactory(
+ $this->logger
+ );
+ }
+
+ public function collectionFrom(
+ XMLFileInterface $xml_file_handler,
+ PathInterface $path_to_entities
+ ): SchemaCollectionInterface {
+ $parser_factory = $this->import_handler->parser();
+ $path_factory = $this->import_handler->path();
+ $path_to_export_node = $path_factory->handler()
+ ->withStartAtRoot(true)
+ ->withNode($path_factory->node()->simple()->withName('exp:Export'));
+ $xml_file_node_info = $parser_factory->DOM()->handler()
+ ->withFileHandler($xml_file_handler)
+ ->getNodeInfoAt($path_to_export_node)
+ ->current();
+ $nodes = $parser_factory->DOM()->handler()
+ ->withFileHandler($xml_file_handler)
+ ->getNodeInfoAt($path_to_entities);
+ $collection = $this->import_handler->schema()->collection();
+ foreach ($nodes as $node) {
+ $element = $this->handler()
+ ->withInformationOf($node);
+ $collection = $collection
+ ->withElement($element);
+ }
+ return $collection;
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Schema/Folder/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Folder/Factory.php
new file mode 100644
index 000000000000..b9a8019dcfc5
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Folder/Factory.php
@@ -0,0 +1,49 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ }
+
+ public function handler(): SchemaFolderInterface
+ {
+ return new SchemaFolder(
+ $this->import_handler,
+ $this->logger
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Schema/Folder/Handler.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Folder/Handler.php
new file mode 100644
index 000000000000..bca063d39a01
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Folder/Handler.php
@@ -0,0 +1,92 @@
+import_handler = $import_handler;
+ $this->logger = $logger;
+ $this->collection = $import_handler->schema()->info()->collection();
+ $this->readSchemaFiles();
+ }
+
+ public function getLatest(string $type, string $sub_type = ''): SchemaInfoInterface|null
+ {
+ return $this->collection->getLatest($type, $sub_type);
+ }
+
+ public function getByVersion(Version $version, string $type, string $sub_type = ''): SchemaInfoInterface|null
+ {
+ return $this->collection->getByVersion($version, $type, $sub_type);
+ }
+
+ public function getByVersionOrLatest(Version $version, string $type, string $sub_type = ''): SchemaInfoInterface|null
+ {
+ return $this->collection->getByVersionOrLatest($version, $type, $sub_type);
+ }
+
+ private function readSchemaFiles(): void
+ {
+ foreach (new DirectoryIterator(self::SCHEMA_DEFINITION_LOCATION) as $file) {
+ if (
+ $file->isDot() ||
+ $file->getExtension() !== self::FILE_EXTENSION ||
+ !str_starts_with($file->getFilename(), self::FILE_PREFIX)
+ ) {
+ continue;
+ }
+ $matches = [];
+ if (preg_match('/ilias_([a-zA-Z]+)(_([a-zA-Z]+))?_([3-9]|([1-9][0-9]+))_?([0-9]+)?.xsd/', $file->getFilename(), $matches) !== 1) {
+ $this->logger->debug('Ignoring file (match): ' . $file->getFilename());
+ $this->logger->dump($matches, \ilLogLevel::DEBUG);
+ continue;
+ }
+ $element = $this->import_handler->schema()->info()->handler()
+ ->withSplFileInfo(new SplFileInfo($file->getPathname()))
+ ->withComponent((string) $matches[1])
+ ->withSubtype((string) $matches[3])
+ ->withVersion(new Version($matches[4] . (($matches[6] ?? '') ? '.' . $matches[6] : '')));
+ $this->collection = $this->collection
+ ->withElement($element);
+ $this->logger->debug($file->getFilename() . ' matches');
+ }
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Schema/Handler.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Handler.php
new file mode 100644
index 000000000000..443cb26ec45e
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Handler.php
@@ -0,0 +1,185 @@
+schema_folder = $schema_folder;
+ $this->parser_factory = $parser_factory;
+ $this->xsd_file_factory = $xsd_file_factory;
+ $this->data_factory = $data_factory;
+ $this->type = null;
+ $this->subtype = null;
+ $this->version = null;
+ }
+
+ public function getXSDFileHandlerByVersionOrLatest(): null|XSDFileInterface
+ {
+ if (
+ is_null($this->getVersion()) ||
+ is_null($this->getPrimaryType()) ||
+ is_null($this->getSecondaryType())
+ ) {
+ return null;
+ }
+ $schema_info = $this->schema_folder->getByVersionOrLatest(
+ $this->getVersion(),
+ $this->getPrimaryType(),
+ $this->getSecondaryType()
+ );
+ return is_null($schema_info)
+ ? null
+ : $this->xsd_file_factory->handler()->withFileInfo($schema_info->getFile());
+ }
+
+ public function getXSDFileHandlerLatest(): null|XSDFileInterface
+ {
+ if (
+ is_null($this->getPrimaryType()) ||
+ is_null($this->getSecondaryType())
+ ) {
+ return null;
+ }
+ $schema_info = $this->schema_folder->getLatest(
+ $this->getPrimaryType(),
+ $this->getSecondaryType()
+ );
+ return is_null($schema_info)
+ ? null
+ : $this->xsd_file_factory->handler()->withFileInfo($schema_info->getFile());
+ }
+
+ public function doesXSDFileWithMatchingVersionExist(): bool
+ {
+ if (
+ is_null($this->getVersion()) ||
+ is_null($this->getPrimaryType()) ||
+ is_null($this->getSecondaryType())
+ ) {
+ return false;
+ }
+ $schema_info = $this->schema_folder->getByVersion(
+ $this->getVersion(),
+ $this->getPrimaryType(),
+ $this->getSecondaryType()
+ );
+ return !is_null($schema_info);
+ }
+
+ public function withInformationOf(
+ XMLFileNodeInfoInterface $xml_file_node_info
+ ): SchemaInterface {
+ $type_str = $xml_file_node_info->getValueOfAttribute('Entity');
+ $types = str_contains($type_str, '_')
+ ? explode('_', $type_str)
+ : [$type_str, ''];
+ $version_str = $xml_file_node_info->hasAttribute('SchemaVersion')
+ ? $xml_file_node_info->getValueOfAttribute('SchemaVersion')
+ : '';
+ if ($version_str === '') {
+ return $this
+ ->withType($types[0])
+ ->withSubType($types[1]);
+ }
+ return $this
+ ->withType($types[0])
+ ->withSubType($types[1])
+ ->withVersion($this->data_factory->version($version_str));
+ }
+
+ public function withType(
+ string $type
+ ): SchemaInterface {
+ $clone = clone $this;
+ $clone->type = $type;
+ return $clone;
+ }
+
+ public function withSubType(
+ string $subtype
+ ): SchemaInterface {
+ $clone = clone $this;
+ $clone->subtype = $subtype;
+ return $clone;
+ }
+
+ public function withVersion(
+ Version $version
+ ): SchemaInterface {
+ $clone = clone $this;
+ $clone->version = $version;
+ return $clone;
+ }
+
+ public function getMajorVersionString(): string
+ {
+ return $this->getVersion()->getMajor() . ".0.0";
+ }
+
+ public function getVersion(): null|Version
+ {
+ return $this->version;
+ }
+
+ public function getPrimaryType(): null|string
+ {
+ return $this->type;
+ }
+
+ public function getSecondaryType(): null|string
+ {
+ return $this->subtype;
+ }
+
+ public function getTypeString(): string
+ {
+ if (is_null($this->getPrimaryType())) {
+ return '';
+ }
+ if (is_null($this->getSecondaryType())) {
+ return $this->getPrimaryType();
+ }
+ return $this->getPrimaryType() . '_' . $this->getSecondaryType();
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Collection.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Collection.php
new file mode 100644
index 000000000000..43686a83c138
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Collection.php
@@ -0,0 +1,136 @@
+elements = [];
+ $this->index = 0;
+ $this->logger = $logger;
+ }
+
+ public function withElement(
+ SchemaInfoInterface $element
+ ): SchemaInfoCollectionInterface {
+ $clone = clone $this;
+ $clone->elements[] = $element;
+ return $clone;
+ }
+
+ public function getLatest(
+ string $component,
+ string $sub_type = ''
+ ): SchemaInfoInterface|null {
+ $current = null;
+ foreach ($this->elements as $schema_info) {
+ if (
+ $schema_info->getComponent() !== $component ||
+ $schema_info->getSubType() !== $sub_type
+ ) {
+ continue;
+ }
+ if (
+ is_null($current) ||
+ (
+ !is_null($current) &&
+ $current->getVersion()->isSmallerThan($schema_info->getVersion())
+ )
+ ) {
+ $current = $schema_info;
+ }
+ }
+ return $current;
+ }
+
+ public function getByVersion(
+ Version $version,
+ string $type,
+ string $sub_type = ''
+ ): SchemaInfoInterface|null {
+ foreach ($this->elements as $schema_info) {
+ if (
+ $schema_info->getVersion()->equals($version) &&
+ $schema_info->getComponent() === $type &&
+ $schema_info->getSubtype() === $sub_type
+ ) {
+ return $schema_info;
+ }
+ }
+ return null;
+ }
+
+ public function getByVersionOrLatest(
+ Version $version,
+ string $type,
+ string $sub_type = ''
+ ): SchemaInfoInterface|null {
+ $schema_with_version = $this->getByVersion($version, $type, $sub_type);
+ if (!is_null($schema_with_version)) {
+ return $schema_with_version;
+ }
+ return $this->getLatest($type, $sub_type);
+ }
+
+ public function next(): void
+ {
+ $this->index++;
+ }
+
+ public function rewind(): void
+ {
+ $this->index = 0;
+ }
+
+ public function valid(): bool
+ {
+ return isset($this->elements[$this->index]);
+ }
+
+ public function key(): int
+ {
+ return $this->index;
+ }
+
+ public function current(): SchemaInfoInterface
+ {
+ return $this->elements[$this->index];
+ }
+
+ public function count(): int
+ {
+ return count($this->elements);
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Factory.php
new file mode 100644
index 000000000000..c356764ad9f3
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Factory.php
@@ -0,0 +1,51 @@
+logger = $logger;
+ }
+
+ public function handler(): SchemaInfoInterface
+ {
+ return new SchemaInfo();
+ }
+
+ public function collection(): SchemaInfoCollectionInterface
+ {
+ return new SchemaInfoCollection(
+ $this->logger
+ );
+ }
+}
diff --git a/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaInfo.php b/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Handler.php
old mode 100755
new mode 100644
similarity index 52%
rename from components/ILIAS/Export/classes/Schema/class.ilXmlSchemaInfo.php
rename to components/ILIAS/Export/classes/ImportHandler/Schema/Info/Handler.php
index 1b64939a1531..16eb308ff8f1
--- a/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaInfo.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Schema/Info/Handler.php
@@ -18,12 +18,13 @@
declare(strict_types=1);
-namespace ILIAS\Export\Schema;
+namespace ILIAS\Export\ImportHandler\Schema\Info;
use ILIAS\Data\Version;
-use SplFileInfo as SplFileInfo;
+use ILIAS\Export\ImportHandler\I\Schema\Info\HandlerInterface as SchemaInfoInterface;
+use SplFileInfo;
-class ilXmlSchemaInfo
+class Handler implements SchemaInfoInterface
{
private Version $version;
@@ -33,12 +34,36 @@ class ilXmlSchemaInfo
private SplFileInfo $file;
- public function __construct(SplFileInfo $file, string $component, string $sub_type, Version $version)
- {
- $this->file = $file;
- $this->component = $component;
- $this->sub_type = $sub_type;
- $this->version = $version;
+ public function withSplFileInfo(
+ SplFileInfo $spl_file_info
+ ): SchemaInfoInterface {
+ $clone = clone $this;
+ $clone->file = $spl_file_info;
+ return $clone;
+ }
+
+ public function withComponent(
+ string $component
+ ): SchemaInfoInterface {
+ $clone = clone $this;
+ $clone->component = $component;
+ return $clone;
+ }
+
+ public function withSubtype(
+ string $sub_type
+ ): SchemaInfoInterface {
+ $clone = clone $this;
+ $clone->sub_type = $sub_type;
+ return $clone;
+ }
+
+ public function withVersion(
+ Version $version
+ ): SchemaInfoInterface {
+ $clone = clone $this;
+ $clone->version = $version;
+ return $clone;
}
public function getFile(): SplFileInfo
diff --git a/components/ILIAS/Export/classes/ImportHandler/Validation/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Validation/Factory.php
new file mode 100755
index 000000000000..3078f59cb329
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Validation/Factory.php
@@ -0,0 +1,62 @@
+import_status_factory = $import_status_factory;
+ $this->import_handler = $import_handler;
+ $this->logger = $logger;
+ }
+
+ public function handler(): FileValidationHandlerInterface
+ {
+ return new FileValidationHandler(
+ $this->logger,
+ $this->import_handler->parser(),
+ $this->import_status_factory,
+ $this->import_handler->path()
+ );
+ }
+
+ public function set(): FileValidationSetFactoryInterface
+ {
+ return new FileValidationSetFactory();
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Validation/class.ilHandler.php b/components/ILIAS/Export/classes/ImportHandler/Validation/Handler.php
similarity index 64%
rename from components/ILIAS/Export/classes/ImportHandler/File/Validation/class.ilHandler.php
rename to components/ILIAS/Export/classes/ImportHandler/Validation/Handler.php
index b0866f2fe811..872503794d44 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Validation/class.ilHandler.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Validation/Handler.php
@@ -18,43 +18,43 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Validation;
+namespace ILIAS\Export\ImportHandler\Validation;
use DOMDocument;
use Exception;
-use ILIAS\Export\ImportHandler\I\File\ilHandlerInterface as ilFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\ilFactoryInterface as ilFilePathFactoryInterface;
-use ILIAS\Export\ImportHandler\I\File\Path\ilHandlerInterface as ilFilePathHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Validation\ilHandlerInterface as ilFileValidationHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\Validation\Set\ilCollectionInterface as ilFileValidationSetCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\ilHandlerInterface as ilXMLFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\File\XML\Node\Info\ilCollectionInterface as ilXMLFileNodeInfoCollection;
-use ILIAS\Export\ImportHandler\I\File\XSD\ilHandlerInterface as ilXSDFileHandlerInterface;
-use ILIAS\Export\ImportHandler\I\Parser\ilFactoryInterface as ilParserFactoryInterface;
-use ILIAS\Export\ImportStatus\Exception\ilException as ilImportStatusException;
-use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ilImportStatusHandlerCollectionInterface;
-use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ilImportStatusFactoryInterface;
-use ILIAS\Export\ImportStatus\I\ilHandlerInterface as ilImportStatusHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\HandlerInterface as FileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\XML\HandlerInterface as XMLFileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\File\XSD\HandlerInterface as XSDFileHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Parser\FactoryInterface as ParserFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Parser\NodeInfo\CollectionInterface as XMLFileNodeInfoCollection;
+use ILIAS\Export\ImportHandler\I\Path\FactoryInterface as FilePathFactoryInterface;
+use ILIAS\Export\ImportHandler\I\Path\HandlerInterface as FilePathHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Validation\HandlerInterface as FileValidationHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Validation\Set\CollectionInterface as FileValidationSetCollectionInterface;
+use ILIAS\Export\ImportStatus\Exception\ilException as ImportStatusException;
+use ILIAS\Export\ImportStatus\I\ilCollectionInterface as ImportStatusHandlerCollectionInterface;
+use ILIAS\Export\ImportStatus\I\ilFactoryInterface as ImportStatusFactoryInterface;
+use ILIAS\Export\ImportStatus\I\ilHandlerInterface as ImportStatusHandlerInterface;
use ILIAS\Export\ImportStatus\StatusType;
use ilLogger;
use LibXMLError;
-class ilHandler implements ilFileValidationHandlerInterface
+class Handler implements FileValidationHandlerInterface
{
public const TMP_DIR_NAME = 'temp';
public const XML_DIR_NAME = 'xml';
protected ilLogger $logger;
- protected ilImportStatusFactoryInterface $import_status;
- protected ilParserFactoryInterface $parser;
- protected ilFilePathFactoryInterface $path;
- protected ilImportStatusHandlerInterface $success_status;
+ protected ImportStatusFactoryInterface $import_status;
+ protected ParserFactoryInterface $parser;
+ protected FilePathFactoryInterface $path;
+ protected ImportStatusHandlerInterface $success_status;
public function __construct(
ilLogger $logger,
- ilParserFactoryInterface $parser,
- ilImportStatusFactoryInterface $import_status,
- ilFilePathFactoryInterface $path,
+ ParserFactoryInterface $parser,
+ ImportStatusFactoryInterface $import_status,
+ FilePathFactoryInterface $path,
) {
$this->logger = $logger;
$this->import_status = $import_status;
@@ -66,13 +66,13 @@ public function __construct(
}
/**
- * @param ilFileHandlerInterface $file_handlers
+ * @param FileHandlerInterface $file_handlers
*/
- protected function checkIfFilesExist(array $file_handlers): ilImportStatusHandlerCollectionInterface
+ protected function checkIfFilesExist(array $file_handlers): ImportStatusHandlerCollectionInterface
{
$status_collection = $this->import_status->collection()->withNumberingEnabled(true);
foreach ($file_handlers as $file_handler) {
- if($file_handler->fileExists()) {
+ if ($file_handler->fileExists()) {
continue;
}
$status_collection->withAddedStatus($this->import_status->handler()
@@ -87,10 +87,10 @@ protected function checkIfFilesExist(array $file_handlers): ilImportStatusHandle
* @param LibXMLError[] $errors
*/
protected function collectErrors(
- ?ilXMLFileHandlerInterface $xml_file_handler = null,
- ?ilXSDFileHandlerInterface $xsd_file_handler = null,
+ ?XMLFileHandlerInterface $xml_file_handler = null,
+ ?XSDFileHandlerInterface $xsd_file_handler = null,
array $errors = []
- ): ilImportStatusHandlerCollectionInterface {
+ ): ImportStatusHandlerCollectionInterface {
$status_collection = $this->import_status->collection();
foreach ($errors as $error) {
$status_collection = $status_collection->getMergedCollectionWith(
@@ -102,9 +102,9 @@ protected function collectErrors(
protected function createErrorMessage(
string $msg,
- ?ilXMLFileHandlerInterface $xml_file_handler = null,
- ?ilXSDFileHandlerInterface $xsd_file_handler = null
- ): ilImportStatusHandlerCollectionInterface {
+ ?XMLFileHandlerInterface $xml_file_handler = null,
+ ?XSDFileHandlerInterface $xsd_file_handler = null
+ ): ImportStatusHandlerCollectionInterface {
$status_collection = $this->import_status->collection();
$xml_str = is_null($xml_file_handler)
? ''
@@ -126,16 +126,16 @@ protected function createErrorMessage(
protected function validateXMLAtNodes(
- ilXMLFileHandlerInterface $xml_file_handler,
- ilXSDFileHandlerInterface $xsd_file_handler,
- ilXMLFileNodeInfoCollection $nodes
- ): ilImportStatusHandlerCollectionInterface {
+ XMLFileHandlerInterface $xml_file_handler,
+ XSDFileHandlerInterface $xsd_file_handler,
+ XMLFileNodeInfoCollection $nodes
+ ): ImportStatusHandlerCollectionInterface {
// Check if files exist
$status_collection = $this->checkIfFilesExist([$xsd_file_handler]);
- if($status_collection->hasStatusType(StatusType::FAILED)) {
+ if ($status_collection->hasStatusType(StatusType::FAILED)) {
return $status_collection;
}
- if(count($nodes) === 0) {
+ if (count($nodes) === 0) {
return $this->validateEmptyXML($xml_file_handler, $xsd_file_handler);
}
$old_value = libxml_use_internal_errors(true);
@@ -148,7 +148,7 @@ protected function validateXMLAtNodes(
$doc->createAttributeNS($namespace->getNamespace(), $namespace->getPrefix());
}
try {
- if($doc->schemaValidate($xsd_file_handler->getFilePath())) {
+ if ($doc->schemaValidate($xsd_file_handler->getFilePath())) {
continue;
}
} catch (Exception $e) {
@@ -169,10 +169,10 @@ protected function validateXMLAtNodes(
}
protected function validateEmptyXML(
- ilXMLFileHandlerInterface $xml_file_handler,
- ilXSDFileHandlerInterface $xsd_file_handler
- ): ilImportStatusHandlerCollectionInterface {
- $old_value = libxml_use_internal_errors(true);
+ XMLFileHandlerInterface $xml_file_handler,
+ XSDFileHandlerInterface $xsd_file_handler
+ ): ImportStatusHandlerCollectionInterface {
+ /*$old_value = libxml_use_internal_errors(true);
$status_collection = $this->import_status->collection()->withNumberingEnabled(true);
$doc = new DOMDocument();
$doc->schemaValidate($xsd_file_handler->getFilePath());
@@ -183,13 +183,14 @@ protected function validateEmptyXML(
$xml_file_handler,
$xsd_file_handler,
$errors
- ));
+ ));*/
+ return $this->import_status->collection()->withNumberingEnabled(true);
}
public function validateXMLFile(
- ilXMLFileHandlerInterface $xml_file_handler,
- ilXSDFileHandlerInterface $xsd_file_handler
- ): ilImportStatusHandlerCollectionInterface {
+ XMLFileHandlerInterface $xml_file_handler,
+ XSDFileHandlerInterface $xsd_file_handler
+ ): ImportStatusHandlerCollectionInterface {
return $this->validateXMLAtPath(
$xml_file_handler,
$xsd_file_handler,
@@ -198,26 +199,28 @@ public function validateXMLFile(
}
/**
- * @throws ilImportStatusException
+ * @throws ImportStatusException
*/
public function validateXMLAtPath(
- ilXMLFileHandlerInterface $xml_file_handler,
- ilXSDFileHandlerInterface $xsd_file_handler,
- ilFilePathHandlerInterface $path_handler
- ): ilImportStatusHandlerCollectionInterface {
+ XMLFileHandlerInterface $xml_file_handler,
+ XSDFileHandlerInterface $xsd_file_handler,
+ FilePathHandlerInterface $path_handler
+ ): ImportStatusHandlerCollectionInterface {
return $this->validateXMLAtNodes(
$xml_file_handler,
$xsd_file_handler,
- $this->parser->DOM()->withFileHandler($xml_file_handler)->getNodeInfoAt($path_handler)
+ $this->parser->DOM()->handler()
+ ->withFileHandler($xml_file_handler)
+ ->getNodeInfoAt($path_handler)
);
}
/**
- * @throws ilImportStatusException
+ * @throws ImportStatusException
*/
public function validateSets(
- ilFileValidationSetCollectionInterface $sets
- ): ilImportStatusHandlerCollectionInterface {
+ FileValidationSetCollectionInterface $sets
+ ): ImportStatusHandlerCollectionInterface {
$status_collection = $this->import_status->collection();
foreach ($sets as $set) {
$status_collection = $status_collection->getMergedCollectionWith($this->validateXMLAtPath(
diff --git a/components/ILIAS/Export/classes/ImportHandler/File/Validation/Set/class.ilCollection.php b/components/ILIAS/Export/classes/ImportHandler/Validation/Set/Collection.php
similarity index 64%
rename from components/ILIAS/Export/classes/ImportHandler/File/Validation/Set/class.ilCollection.php
rename to components/ILIAS/Export/classes/ImportHandler/Validation/Set/Collection.php
index 345cde45374a..df2d5a51432b 100755
--- a/components/ILIAS/Export/classes/ImportHandler/File/Validation/Set/class.ilCollection.php
+++ b/components/ILIAS/Export/classes/ImportHandler/Validation/Set/Collection.php
@@ -18,15 +18,15 @@
declare(strict_types=1);
-namespace ILIAS\Export\ImportHandler\File\Validation\Set;
+namespace ILIAS\Export\ImportHandler\Validation\Set;
-use ILIAS\Export\ImportHandler\I\File\Validation\Set\ilCollectionInterface as ilFileValidationSetCollectionInterface;
-use ILIAS\Export\ImportHandler\I\File\Validation\Set\ilHandlerInterface as ilFileValidationPairHandlerInterface;
+use ILIAS\Export\ImportHandler\I\Validation\Set\CollectionInterface as FileValidationSetCollectionInterface;
+use ILIAS\Export\ImportHandler\I\Validation\Set\HandlerInterface as FileValidationPairHandlerInterface;
-class ilCollection implements ilFileValidationSetCollectionInterface
+class Collection implements FileValidationSetCollectionInterface
{
/**
- * @var ilFileValidationPairHandlerInterface[]
+ * @var FileValidationPairHandlerInterface[]
*/
protected array $elements;
protected int $index;
@@ -42,15 +42,17 @@ public function count(): int
return count($this->elements);
}
- public function withElement(ilFileValidationPairHandlerInterface $element): ilFileValidationSetCollectionInterface
- {
+ public function withElement(
+ FileValidationPairHandlerInterface $element
+ ): FileValidationSetCollectionInterface {
$clone = clone $this;
$clone->elements[] = $element;
return $clone;
}
- public function withMerged(ilFileValidationSetCollectionInterface $other): ilFileValidationSetCollectionInterface
- {
+ public function withMerged(
+ FileValidationSetCollectionInterface $other
+ ): FileValidationSetCollectionInterface {
$clone = clone $this;
$clone->elements = array_merge($this->toArray(), $other->toArray());
return $clone;
@@ -61,7 +63,7 @@ public function toArray(): array
return $this->elements;
}
- public function current(): ilFileValidationPairHandlerInterface
+ public function current(): FileValidationPairHandlerInterface
{
return $this->elements[$this->index];
}
@@ -78,7 +80,7 @@ public function key(): int
public function valid(): bool
{
- return 0 <= $this->index && $this->index < $this->count();
+ return isset($this->elements[$this->index]);
}
public function rewind(): void
diff --git a/components/ILIAS/Export/classes/ImportHandler/Validation/Set/Factory.php b/components/ILIAS/Export/classes/ImportHandler/Validation/Set/Factory.php
new file mode 100755
index 000000000000..af517e38ffc5
--- /dev/null
+++ b/components/ILIAS/Export/classes/ImportHandler/Validation/Set/Factory.php
@@ -0,0 +1,40 @@
+path_handler;
+ }
+
+ public function getXSDFileHandler(): XSDFileHandlerInterface
+ {
+ return $this->xsd_file_handler;
+ }
+
+ public function getXMLFileHandler(): XMLFileHandlerInterface
+ {
+ return $this->xml_file_handler;
+ }
+
+ public function withFilePathHandler(
+ FilePathHandlerInterface $path_handler
+ ): FileValidationSetHandlerInterface {
+ $clone = clone $this;
+ $clone->path_handler = $path_handler;
+ return $clone;
+ }
+
+ public function withXSDFileHanlder(
+ XSDFileHandlerInterface $xsd_file_handler
+ ): FileValidationSetHandlerInterface {
+ $clone = clone $this;
+ $clone->xsd_file_handler = $xsd_file_handler;
+ return $clone;
+ }
+
+ public function withXMLFileHandler(
+ XMLFileHandlerInterface $xml_file_handler
+ ): FileValidationSetHandlerInterface {
+ $clone = clone $this;
+ $clone->xml_file_handler = $xml_file_handler;
+ return $clone;
+ }
+}
diff --git a/components/ILIAS/Export/classes/ImportHandler/class.ilFactory.php b/components/ILIAS/Export/classes/ImportHandler/class.ilFactory.php
deleted file mode 100755
index dcb1f25e39d6..000000000000
--- a/components/ILIAS/Export/classes/ImportHandler/class.ilFactory.php
+++ /dev/null
@@ -1,61 +0,0 @@
-logger = $DIC->logger()->root();
- $this->lng = $DIC->language();
- $this->lng->loadLanguageModule("exp");
- $this->schema_factory = new ilXmlSchemaFactory();
- }
-
- public function parser(): ilParserFactoryInterface
- {
- return new ilParserFactory($this->logger);
- }
-
- public function file(): ilFileFactoryInterface
- {
- return new ilFileFactory(
- $this->logger,
- $this->lng,
- $this->schema_factory
- );
- }
-}
diff --git a/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaFactory.php b/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaFactory.php
deleted file mode 100755
index 16067f6aa091..000000000000
--- a/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaFactory.php
+++ /dev/null
@@ -1,141 +0,0 @@
-logger = $DIC->logger()->exp();
- $this->collection = new ilXmlSchemaInfoCollection();
- $this->readSchemaFiles();
- }
-
- public function getLatest(string $type, string $sub_type = ''): ?SplFileInfo
- {
- $collection = $this->getByType($type, $sub_type);
- if ($collection->count() === 0) {
- return null;
- }
- $latest = $collection->offsetGet($collection->count() - 1);
- return $latest->getFile();
- }
-
- public function getByVersion(Version $version, string $type, string $sub_type = ''): ?SplFileInfo
- {
- $collection = $this->getByType($type, $sub_type);
- foreach ($collection as $schema_info) {
- if ($schema_info->getVersion()->equals($version)) {
- return $schema_info->getFile();
- }
- }
- return null;
- }
-
- public function getByVersionOrLatest(Version $version, string $type, string $sub_type = ''): ?SplFileInfo
- {
- $collection = $this->getByType($type, $sub_type);
- foreach ($collection as $schema_info) {
- if ($schema_info->getVersion()->equals($version)) {
- return $schema_info->getFile();
- }
- }
- return $this->getLatest($type, $sub_type);
- }
-
- protected function getByType(string $component, string $sub_type = ''): ilXmlSchemaInfoCollection
- {
- $collection = new ilXmlSchemaInfoCollection();
- foreach ($this->collection as $schema_info) {
- if ($schema_info->getComponent() === $component && $schema_info->getSubtype() === $sub_type) {
- $collection[] = $schema_info;
- $this->logger->info('Found version: ' . $schema_info->getFile()->getFilename());
- }
- }
- return $this->sortByVersion($collection);
- }
-
- protected function sortByVersion(ilXmlSchemaInfoCollection $collection): ilXmlSchemaInfoCollection
- {
- $collection->uasort(function (ilXmlSchemaInfo $a, ilXmlSchemaInfo $b): int {
- if ($a->getVersion()->equals($b->getVersion())) {
- return 0;
- }
- if ($a->getVersion()->isGreaterThan($b->getVersion())) {
- return 1;
- }
- return -1;
- });
- $sorted = new ilXmlSchemaInfoCollection();
- foreach ($collection as $schema_info) {
- $sorted[] = $schema_info;
- }
- return $sorted;
- }
-
- private function readSchemaFiles(): void
- {
- foreach (new \DirectoryIterator(self::SCHEMA_DEFINITION_LOCATION) as $file) {
- if ($file->isDot()) {
- $this->logger->debug('Ignoring file (dot file): ' . $file->getFilename());
- continue;
- }
- if ($file->getExtension() !== 'xsd') {
- $this->logger->debug('Ignoring file (!xsd): ' . $file->getFilename());
- continue;
- }
- $parts = explode('_', $file->getFilename());
- if (!count($parts)) {
- $this->logger->debug('Ignoring file (!_separated): ' . $file->getFilename());
- continue;
- }
- if ($parts[0] !== 'ilias') {
- $this->logger->debug('Ignoring file (!ilias): ' . $file->getFilename() . ' ' . $parts[0]);
- continue;
- }
- $matches = [];
- if (preg_match('/ilias_([a-zA-Z]+)(_([a-zA-Z]+))?_([3-9]|([1-9][0-9]+))_?([0-9]+)?.xsd/', $file->getFilename(), $matches) !== 1) {
- $this->logger->debug('Ignoring file (match): ' . $file->getFilename());
- $this->logger->dump($matches, \ilLogLevel::DEBUG);
- continue;
- }
- $this->collection[] = new ilXmlSchemaInfo(
- new SplFileInfo($file->getPathname()),
- (string) $matches[1],
- (string) $matches[3],
- new Version((string) $matches[4] . (($matches[6] ?? '') ? '.' . $matches[6] : ''))
- );
- $this->logger->debug($file->getFilename() . ' matches');
- }
- }
-}
diff --git a/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaInfoCollection.php b/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaInfoCollection.php
deleted file mode 100755
index 9e8a836f9663..000000000000
--- a/components/ILIAS/Export/classes/Schema/class.ilXmlSchemaInfoCollection.php
+++ /dev/null
@@ -1,36 +0,0 @@
-configs[$a_comp] = $imp_config;
return $imp_config;
@@ -175,7 +175,7 @@ protected function unzipFile(
protected function validateXMLFiles(SplFileInfo $manifest_spl): ilImportStatusHandlerCollectionInterface
{
$export_files = $this->import->file()->xml()->export()->collection();
- $manifest_handlers = $this->import->file()->xml()->manifest()->handlerCollection();
+ $manifest_handlers = $this->import->file()->xml()->manifest()->collection();
$statuses = $this->import_status->collection();
// Find export xmls
try {
@@ -184,19 +184,19 @@ protected function validateXMLFiles(SplFileInfo $manifest_spl): ilImportStatusHa
);
// VALIDATE 1st manifest file, can be either export-set or export-file
$statuses = $manifest_handlers->validateElements();
- if($statuses->hasStatusType(StatusType::FAILED)) {
+ if ($statuses->hasStatusType(StatusType::FAILED)) {
return $statuses;
}
// If export set look for the export file manifests + VALIDATE
- if ($manifest_handlers->containsExportObjectType(ilExportObjectType::EXPORT_SET)) {
+ if ($manifest_handlers->containsExportObjectType(ExportObjectType::EXPORT_SET)) {
$manifest_handlers = $manifest_handlers->findNextFiles();
$statuses = $manifest_handlers->validateElements();
}
- if($statuses->hasStatusType(StatusType::FAILED)) {
+ if ($statuses->hasStatusType(StatusType::FAILED)) {
return $statuses;
}
// If export file look for the export xmls
- if ($manifest_handlers->containsExportObjectType(ilExportObjectType::EXPORT_FILE)) {
+ if ($manifest_handlers->containsExportObjectType(ExportObjectType::EXPORT_FILE)) {
foreach ($manifest_handlers as $manfiest_file_handler) {
$export_files = $export_files->withMerged($manfiest_file_handler->findXMLFileHandlers());
}
@@ -205,12 +205,12 @@ protected function validateXMLFiles(SplFileInfo $manifest_spl): ilImportStatusHa
$this->checkStatuses($e->getStatuses());
}
// VALIDATE export xmls
- $path_to_export_item_child = $this->import->file()->path()->handler()
+ $path_to_export_item_child = $this->import->path()->handler()
->withStartAtRoot(true)
- ->withNode($this->import->file()->path()->node()->simple()->withName('exp:Export'))
- ->withNode($this->import->file()->path()->node()->simple()->withName('exp:ExportItem'))
- ->withNode($this->import->file()->path()->node()->anyNode());
- $component_tree = $this->import->file()->xml()->node()->info()->tree();
+ ->withNode($this->import->path()->node()->simple()->withName('exp:Export'))
+ ->withNode($this->import->path()->node()->simple()->withName('exp:ExportItem'))
+ ->withNode($this->import->path()->node()->anyNode());
+ $component_tree = $this->import->parser()->nodeInfo()->tree()->handler();
foreach ($export_files as $export_file) {
if ($export_file->isContainerExportXML()) {
$component_tree = $component_tree->withRootInFile($export_file, $path_to_export_item_child);
@@ -220,7 +220,7 @@ protected function validateXMLFiles(SplFileInfo $manifest_spl): ilImportStatusHa
foreach ($export_files as $export_file) {
$found_statuses = $export_file->buildValidationSets();
if (!$found_statuses->hasStatusType(StatusType::FAILED)) {
- $found_statuses = $this->import->file()->validation()->handler()->validateSets(
+ $found_statuses = $this->import->validation()->handler()->validateSets(
$export_file->getValidationSets()
);
}
diff --git a/components/ILIAS/Export/tests/ExportHandler/PublicAccess/Repository/HandlerTest.php b/components/ILIAS/Export/tests/ExportHandler/PublicAccess/Repository/HandlerTest.php
index e2eb7dde7db6..06d1a5ba19f3 100644
--- a/components/ILIAS/Export/tests/ExportHandler/PublicAccess/Repository/HandlerTest.php
+++ b/components/ILIAS/Export/tests/ExportHandler/PublicAccess/Repository/HandlerTest.php
@@ -20,7 +20,6 @@
namespace ILIAS\Export\Test\ExportHandler\PublicAccess\Repository;
-use _PHPStan_9815bbba4\Nette\Utils\AssertionException;
use Exception;
use ILIAS\Data\ObjectId;
use PHPUnit\Framework\MockObject\MockObject;
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/ilHandlerTest.php b/components/ILIAS/Export/tests/ImportHandler/File/HandlerTest.php
similarity index 89%
rename from components/ILIAS/Export/tests/ImportHandler/File/ilHandlerTest.php
rename to components/ILIAS/Export/tests/ImportHandler/File/HandlerTest.php
index 83d51283933d..1e9928b297d3 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/ilHandlerTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/File/HandlerTest.php
@@ -18,15 +18,15 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File;
+namespace ILIAS\Export\Test\ImportHandler\File;
-use ILIAS\Export\ImportHandler\File\ilHandler as ilFileHandler;
-use ILIAS\Export\ImportHandler\File\Namespace\ilCollection as ilFileNamespaceCollection;
-use ILIAS\Export\ImportHandler\File\Namespace\ilFactory as ilFileNamespaceFactory;
+use ILIAS\Export\ImportHandler\File\Handler as ilFileHandler;
+use ILIAS\Export\ImportHandler\File\Namespace\Collection as ilFileNamespaceCollection;
+use ILIAS\Export\ImportHandler\File\Namespace\Factory as ilFileNamespaceFactory;
use PHPUnit\Framework\TestCase;
use SplFileInfo;
-class ilHandlerTest extends TestCase
+class HandlerTest extends TestCase
{
public function testFileHandler(): void
{
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Namespace/ilCollectionTest.php b/components/ILIAS/Export/tests/ImportHandler/File/Namespace/CollectionTest.php
similarity index 89%
rename from components/ILIAS/Export/tests/ImportHandler/File/Namespace/ilCollectionTest.php
rename to components/ILIAS/Export/tests/ImportHandler/File/Namespace/CollectionTest.php
index b654ff097aff..0f0b0d2e69ff 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Namespace/ilCollectionTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/File/Namespace/CollectionTest.php
@@ -18,14 +18,14 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Namespace;
+namespace ILIAS\Export\Test\ImportHandler\File\Namespace;
-use ILIAS\Export\ImportHandler\File\Namespace\ilCollection as ilFileNamespaceCollection;
-use ILIAS\Export\ImportHandler\File\Namespace\ilHandler as ilFileNamespaceHandler;
-use ILIAS\Export\ImportHandler\I\File\Namespace\ilCollectionInterface as ilFileNamespaceCollectionInterface;
+use ILIAS\Export\ImportHandler\File\Namespace\Collection as ilFileNamespaceCollection;
+use ILIAS\Export\ImportHandler\File\Namespace\Handler as ilFileNamespaceHandler;
+use ILIAS\Export\ImportHandler\I\File\Namespace\CollectionInterface as ilFileNamespaceCollectionInterface;
use PHPUnit\Framework\TestCase;
-class ilCollectionTest extends TestCase
+class CollectionTest extends TestCase
{
protected function setUp(): void
{
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Namespace/ilHandlerTest.php b/components/ILIAS/Export/tests/ImportHandler/File/Namespace/HandlerTest.php
similarity index 85%
rename from components/ILIAS/Export/tests/ImportHandler/File/Namespace/ilHandlerTest.php
rename to components/ILIAS/Export/tests/ImportHandler/File/Namespace/HandlerTest.php
index ea417671b053..53f00ceb5e46 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Namespace/ilHandlerTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/File/Namespace/HandlerTest.php
@@ -18,12 +18,12 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Namespace;
+namespace ILIAS\Export\Test\ImportHandler\File\Namespace;
-use ILIAS\Export\ImportHandler\File\Namespace\ilHandler as ilFileNamespaceHandler;
+use ILIAS\Export\ImportHandler\File\Namespace\Handler as ilFileNamespaceHandler;
use PHPUnit\Framework\TestCase;
-class ilHandlerTest extends TestCase
+class HandlerTest extends TestCase
{
protected function setUp(): void
{
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/ilDOMNodeHandlerTest.php b/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/ilDOMNodeHandlerTest.php
deleted file mode 100755
index fdc1d05b2559..000000000000
--- a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/ilDOMNodeHandlerTest.php
+++ /dev/null
@@ -1,139 +0,0 @@
-';
-
- $attribute_1 = $this->createMock(DOMAttr::class);
- $attribute_1->name = 'test';
- $attribute_1->value = 'super';
- $attribute_iterator_elements = [
- $attribute_1
- ];
- $attribute_iterator = new class($attribute_iterator_elements) implements \Iterator {
- protected array $children;
- protected int $index;
- public function __construct(array $children)
- {
- $this->children = $children;
- $this->index = 0;
- }
- public function current(): mixed
- {
- return $this->children[$this->index];
- }
- public function next(): void
- {
- $this->index++;
- }
- public function key(): mixed
- {
- return $this->index;
- }
- public function valid(): bool
- {
- return 0 <= $this->index && $this->index < count($this->children);
- }
- public function rewind(): void
- {
- $this->index = 0;
- }
- };
-
- $dom_named_node_map = $this->createMock(DOMNamedNodeMap::class);
- $dom_named_node_map->expects($this->any())->method('getIterator')->willReturn($attribute_iterator);
-
- $dom_document = $this->createMock(DOMDocument::class);
- $dom_document->expects($this->any())->method('saveXML')->willReturn($xml_str);
-
- $iterator_elements = [
- $this->createMock(DOMNode::class),
- $this->createMock(DOMNode::class),
- $this->createMock(DOMNode::class)
- ];
- $child_iterator = new class($iterator_elements) implements \Iterator {
- protected array $children;
- protected int $index;
- public function __construct(array $children)
- {
- $this->children = $children;
- $this->index = 0;
- }
- public function current(): mixed
- {
- return $this->children[$this->index];
- }
- public function next(): void
- {
- $this->index++;
- }
- public function key(): mixed
- {
- return $this->index;
- }
- public function valid(): bool
- {
- return 0 <= $this->index && $this->index < count($this->children);
- }
- public function rewind(): void
- {
- $this->index = 0;
- }
- };
-
- $child_nodes = $this->createMock(DOMNodeList::class);
- $child_nodes->expects($this->any())->method('getIterator')->willReturn($child_iterator);
-
- $parent_node = $this->createMock(DOMNode::class);
- $parent_node->nodeName = 'testParentName';
-
- $dom_node = $this->createMock(DOMNode::class);
- $dom_node->attributes = $dom_named_node_map;
- $dom_node->ownerDocument = $dom_document;
- $dom_node->nodeName = 'testName';
- $dom_node->childNodes = $child_nodes;
- $dom_node->parentNode = $parent_node;
-
- $info = $this->createMock(ilFileXMLNodeInfoFactory::class);
-
- $node_info_handler = new ilFileXMLNodeInfoDOMNodeHandler($info);
-
- $this->assertTrue($node_info_handler->hasAttribute('test'));
- $this->assertFalse($node_info_handler->hasAttribute('args'));
- $this->assertEquals('super', $node_info_handler->getValueOfAttribute('test'));
- $this->assertEquals($xml_str, $node_info_handler->getXML());
- $this->assertEquals('testName', $node_info_handler->getNodeName());
- $this->assertCount(3, $node_info_handler->getChildren());
- $this->assertEquals('testParentName', $node_info_handler->getParent()->getNodeName());
-
- node_info_handler->getAttributePath();
- */
- $this->assertTrue(true);
- }
-}
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/Attribute/ilCollectionTest.php b/components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/Attribute/ilCollectionTest.php
similarity index 87%
rename from components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/Attribute/ilCollectionTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/Attribute/ilCollectionTest.php
index aff379819f7b..a5779390659e 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/Attribute/ilCollectionTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/Attribute/ilCollectionTest.php
@@ -18,11 +18,11 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\XML\Node\Info\Attribute;
+namespace ILIAS\Export\Test\ImportHandler\Parser\NodeInfo\Attribute;
-use ILIAS\Export\ImportHandler\File\XML\Node\Info\Attribute\ilCollection as ilXMLFileNodeInfoAttributeCollection;
-use ILIAS\Export\ImportHandler\File\XML\Node\Info\Attribute\ilPair as ilXMLFileNodeInfoAttributePair;
-use ILIAS\Export\ImportHandler\File\XML\Node\Info\DOM\ilHandler as ilXMLFileNodeInfoDOMNodeHandler;
+use ILIAS\Export\ImportHandler\Parser\NodeInfo\Attribute\Collection as ilXMLFileNodeInfoAttributeCollection;
+use ILIAS\Export\ImportHandler\Parser\NodeInfo\Attribute\Handler as ilXMLFileNodeInfoAttributePair;
+use ILIAS\Export\ImportHandler\Parser\NodeInfo\DOM\Handler as ilXMLFileNodeInfoDOMNodeHandler;
use ilLogger;
use PHPUnit\Framework\TestCase;
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/Attribute/ilPairTest.php b/components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/Attribute/ilPairTest.php
similarity index 84%
rename from components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/Attribute/ilPairTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/Attribute/ilPairTest.php
index f5b136834a5b..8dc1ca55e930 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/Attribute/ilPairTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/Attribute/ilPairTest.php
@@ -18,9 +18,9 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\XML\Node\Info\Attribute;
+namespace ILIAS\Export\Test\ImportHandler\Parser\NodeInfo\Attribute;
-use ILIAS\Export\ImportHandler\File\XML\Node\Info\Attribute\ilPair as ilXMLFileNodeInfoAttributePair;
+use ILIAS\Export\ImportHandler\Parser\NodeInfo\Attribute\Handler as ilXMLFileNodeInfoAttributePair;
use PHPUnit\Framework\TestCase;
class ilPairTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/ilCollectionTest.php b/components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/ilCollectionTest.php
similarity index 78%
rename from components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/ilCollectionTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/ilCollectionTest.php
index 5ab7be3fc282..a5418672e3e2 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/XML/Node/Info/ilCollectionTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Parser/NodeInfo/ilCollectionTest.php
@@ -18,21 +18,21 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\XML\Node\Info;
+namespace ILIAS\Export\Test\ImportHandler\Parser\NodeInfo;
-use ILIAS\Export\ImportHandler\File\XML\Node\Info\DOM\ilHandler;
-use ILIAS\Export\ImportHandler\File\XML\Node\Info\ilCollection;
+use ILIAS\Export\ImportHandler\Parser\NodeInfo\DOM\Handler;
+use ILIAS\Export\ImportHandler\Parser\NodeInfo\Collection;
use PHPUnit\Framework\TestCase;
class ilCollectionTest extends TestCase
{
public function testNodeInfoCollection(): void
{
- $node1 = $this->createMock(ilHandler::class);
- $node2 = $this->createMock(ilHandler::class);
- $node3 = $this->createMock(ilHandler::class);
+ $node1 = $this->createMock(Handler::class);
+ $node2 = $this->createMock(Handler::class);
+ $node3 = $this->createMock(Handler::class);
- $collection = new ilCollection();
+ $collection = new Collection();
$collection = $collection->withElement($node1);
$collection = $collection->withElement($node2);
$collection = $collection->withElement($node3);
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Comparison/ilHandlerTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Comparison/HandlerTest.php
similarity index 64%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Comparison/ilHandlerTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Comparison/HandlerTest.php
index 273d2fb61056..b818ff9f8663 100644
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Comparison/ilHandlerTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Comparison/HandlerTest.php
@@ -18,13 +18,13 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Comparison;
+namespace ILIAS\Export\Test\ImportHandler\Path\Comparison;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\ilHandler as ilFilePathComparison;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\Operator as ilFilePathComparisonOperator;
+use ILIAS\Export\ImportHandler\Path\Comparison\Handler as ilFilePathComparison;
+use ILIAS\Export\ImportHandler\Path\Comparison\Operator as ilFilePathComparisonOperator;
use PHPUnit\Framework\TestCase;
-class ilHandlerTest extends TestCase
+class HandlerTest extends TestCase
{
protected function setUp(): void
{
@@ -33,9 +33,16 @@ protected function setUp(): void
public function testComparison(): void
{
- $comp1 = new ilFilePathComparison(ilFilePathComparisonOperator::EQUAL, 'Args');
- $comp2 = new ilFilePathComparison(ilFilePathComparisonOperator::LOWER_EQUAL, '');
- $comp3 = new ilFilePathComparison(ilFilePathComparisonOperator::GREATER, '2');
+ $comp1 = new ilFilePathComparison();
+ $comp1 = $comp1
+ ->withValue('Args')
+ ->withOperator(ilFilePathComparisonOperator::EQUAL);
+ $comp2 = $comp1
+ ->withOperator(ilFilePathComparisonOperator::LOWER_EQUAL)
+ ->withValue('');
+ $comp3 = $comp1
+ ->withOperator(ilFilePathComparisonOperator::GREATER)
+ ->withValue('2');
$this->assertEquals(
ilFilePathComparisonOperator::toString(ilFilePathComparisonOperator::EQUAL) . 'Args',
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/ilHandlerTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/HandlerTest.php
similarity index 90%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/ilHandlerTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/HandlerTest.php
index fd6c6295b02b..01a96908b221 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/ilHandlerTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/HandlerTest.php
@@ -18,13 +18,13 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path;
+namespace ILIAS\Export\Test\ImportHandler\Path;
-use ILIAS\Export\ImportHandler\File\Path\ilHandler as ilFilePathHandler;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilSimple as ilSimpleFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Handler as ilFilePathHandler;
+use ILIAS\Export\ImportHandler\Path\Node\Simple as ilSimpleFilePathNode;
use PHPUnit\Framework\TestCase;
-class ilHandlerTest extends TestCase
+class HandlerTest extends TestCase
{
protected function setUp(): void
{
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAnyElementTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAnyElementTest.php
similarity index 87%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAnyElementTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAnyElementTest.php
index 551f34e5e827..3f84dff13611 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAnyElementTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAnyElementTest.php
@@ -18,9 +18,9 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\Test\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilAnyElement as ilAnyElementFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Node\AnyElement as ilAnyElementFilePathNode;
use PHPUnit\Framework\TestCase;
class ilAnyElementTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAnyNodeTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAnyNodeTest.php
similarity index 87%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAnyNodeTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAnyNodeTest.php
index 5b293d51af5e..770f4ba656f0 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAnyNodeTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAnyNodeTest.php
@@ -18,9 +18,9 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\Test\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilAnyNode as ilAnyNodeFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Node\AnyNode as ilAnyNodeFilePathNode;
use PHPUnit\Framework\TestCase;
class ilAnyNodeTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAttributeTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAttributeTest.php
similarity index 88%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAttributeTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAttributeTest.php
index e6f422052b76..ca10dc89ac3f 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilAttributeTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilAttributeTest.php
@@ -18,10 +18,10 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\Test\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\ilHandler as ilFilePathComparisonHandler;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilAttribute as ilAttributeFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Comparison\Handler as ilFilePathComparisonHandler;
+use ILIAS\Export\ImportHandler\Path\Node\Attribute as ilAttributeFilePathNode;
use PHPUnit\Framework\TestCase;
class ilAttributeTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilCloseRoundBrackedTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilCloseRoundBrackedTest.php
similarity index 86%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilCloseRoundBrackedTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Node/ilCloseRoundBrackedTest.php
index 1880cdf409c1..bcd898696dde 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilCloseRoundBrackedTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilCloseRoundBrackedTest.php
@@ -18,9 +18,9 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\Test\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilCloseRoundBracked as ilCloseRoundBrackedFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Node\CloseRoundBracked as ilCloseRoundBrackedFilePathNode;
use PHPUnit\Framework\TestCase;
class ilCloseRoundBrackedTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilIndexTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilIndexTest.php
similarity index 87%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilIndexTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Node/ilIndexTest.php
index 8b2b620f8eb0..30928d8bd86c 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilIndexTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilIndexTest.php
@@ -18,10 +18,10 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\Test\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Comparison\ilHandler as ilFilePathComparisonHandler;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilIndex as ilIndexFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Comparison\Handler as ilFilePathComparisonHandler;
+use ILIAS\Export\ImportHandler\Path\Node\Index as ilIndexFilePathNode;
use PHPUnit\Framework\TestCase;
class ilIndexTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilOpenRoundBrackedTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilOpenRoundBrackedTest.php
similarity index 85%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilOpenRoundBrackedTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Node/ilOpenRoundBrackedTest.php
index f0fffaf84f7a..5eefe3b6f526 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilOpenRoundBrackedTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilOpenRoundBrackedTest.php
@@ -18,9 +18,9 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\Test\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilOpenRoundBracked as ilOpenRoundBrackedFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Node\OpenRoundBracked as ilOpenRoundBrackedFilePathNode;
use PHPUnit\Framework\TestCase;
class ilOpenRoundBrackedTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilSimpleTest.php b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilSimpleTest.php
similarity index 88%
rename from components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilSimpleTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Path/Node/ilSimpleTest.php
index 51841b9b7461..6e1872f1a35b 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Path/Node/ilSimpleTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Path/Node/ilSimpleTest.php
@@ -18,9 +18,9 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Path\Node;
+namespace ILIAS\Export\Test\ImportHandler\Path\Node;
-use ILIAS\Export\ImportHandler\File\Path\Node\ilSimple as ilSimpleFilePathNode;
+use ILIAS\Export\ImportHandler\Path\Node\Simple as ilSimpleFilePathNode;
use PHPUnit\Framework\TestCase;
class ilSimpleTest extends TestCase
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Validation/Set/ilHandlerTest.php b/components/ILIAS/Export/tests/ImportHandler/Validation/Set/HandlerTest.php
similarity index 76%
rename from components/ILIAS/Export/tests/ImportHandler/File/Validation/Set/ilHandlerTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Validation/Set/HandlerTest.php
index 17be76420a60..3c006a39774a 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Validation/Set/ilHandlerTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Validation/Set/HandlerTest.php
@@ -18,15 +18,15 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Validation\Set;
+namespace ILIAS\Export\Test\ImportHandler\File\Validation\Set;
-use ILIAS\Export\ImportHandler\File\Path\ilHandler as ilFilePathHandler;
-use ILIAS\Export\ImportHandler\File\Validation\Set\ilHandler as ilFileValidationSetHandler;
-use ILIAS\Export\ImportHandler\File\XML\ilHandler as ilXMLFileHandler;
-use ILIAS\Export\ImportHandler\File\XSD\ilHandler as ilXSDFileHandler;
+use ILIAS\Export\ImportHandler\Path\Handler as ilFilePathHandler;
+use ILIAS\Export\ImportHandler\Validation\Set\Handler as ilFileValidationSetHandler;
+use ILIAS\Export\ImportHandler\File\XML\Handler as ilXMLFileHandler;
+use ILIAS\Export\ImportHandler\File\XSD\Handler as ilXSDFileHandler;
use PHPUnit\Framework\TestCase;
-class ilHandlerTest extends TestCase
+class HandlerTest extends TestCase
{
public function testFileValidationSetHandler(): void
{
diff --git a/components/ILIAS/Export/tests/ImportHandler/File/Validation/Set/ilCollectionTest.php b/components/ILIAS/Export/tests/ImportHandler/Validation/Set/ilCollectionTest.php
similarity index 83%
rename from components/ILIAS/Export/tests/ImportHandler/File/Validation/Set/ilCollectionTest.php
rename to components/ILIAS/Export/tests/ImportHandler/Validation/Set/ilCollectionTest.php
index d88a571bc1ed..b2e6e03c4163 100755
--- a/components/ILIAS/Export/tests/ImportHandler/File/Validation/Set/ilCollectionTest.php
+++ b/components/ILIAS/Export/tests/ImportHandler/Validation/Set/ilCollectionTest.php
@@ -18,10 +18,10 @@
declare(strict_types=1);
-namespace Test\ImportHandler\File\Validation\Set;
+namespace ILIAS\Export\Test\ImportHandler\File\Validation\Set;
-use ILIAS\Export\ImportHandler\File\Validation\Set\ilCollection as ilFileValidationSetCollection;
-use ILIAS\Export\ImportHandler\File\Validation\Set\ilHandler as ilFileValidationSetHandler;
+use ILIAS\Export\ImportHandler\Validation\Set\Collection as ilFileValidationSetCollection;
+use ILIAS\Export\ImportHandler\Validation\Set\Handler as ilFileValidationSetHandler;
use PHPUnit\Framework\TestCase;
class ilCollectionTest extends TestCase