ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilImportDirectoryFactory.php
Go to the documentation of this file.
1<?php
2
4
6{
7 public const TYPE_MOB = 'mob';
8 public const TYPE_SAHS = 'sahs';
9 public const TYPE_EXPORT = 'export';
10
14 protected $logger;
15
19 protected $storage;
20
24 public function __construct()
25 {
26 global $DIC;
27
28 $this->logger = $DIC->logger()->exp();
29 $this->storage_directory = $DIC->filesystem()->storage();
30 }
31
38 {
39 switch ($type) {
40 case self::TYPE_MOB:
41 $instance = new ilMediaObjectImportDirectory(
42 $this->storage_directory,
43 $this->logger
44 );
45 break;
46
47 case self::TYPE_SAHS:
48 $instance = new ilScormImportDirectory(
49 $this->storage_directory,
50 $this->logger
51 );
52 break;
53
55 $instance = new ilExportImportDirectory(
56 $this->storage_directory,
57 $this->logger
58 );
59 break;
60
61 default:
62 $this->logger->error('Invalid type given: ' . $type);
63 throw new InvalidArgumentException(
64 'Invalid type given: ' . $type
65 );
66 }
67 return $instance;
68 }
69}
An exception for terminatinating execution or to throw for unit testing.
__construct()
ilImportDirectoryFactory constructor.
Import directory interface.
global $DIC
Definition: goto.php:24
Interface Filesystem The filesystem interface provides the public interface for the Filesystem servic...
Definition: Filesystem.php:22
$type