Passed
Push — master ( 078203...c81798 )
by Joas
14:40 queued 14s
created
lib/public/WorkflowEngine/IRuleMatcher.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -36,56 +36,56 @@
 block discarded – undo
36 36
  * @since 18.0.0
37 37
  */
38 38
 interface IRuleMatcher extends IFileCheck {
39
-	/**
40
-	 * This method is left for backwards compatibility and easier porting of
41
-	 * apps. Please use 'getFlows' instead (and setOperation if you implement
42
-	 * an IComplexOperation).
43
-	 *
44
-	 * @since 18.0.0
45
-	 * @deprecated 18.0.0
46
-	 */
47
-	public function getMatchingOperations(string $class, bool $returnFirstMatchingOperationOnly = true): array;
39
+    /**
40
+     * This method is left for backwards compatibility and easier porting of
41
+     * apps. Please use 'getFlows' instead (and setOperation if you implement
42
+     * an IComplexOperation).
43
+     *
44
+     * @since 18.0.0
45
+     * @deprecated 18.0.0
46
+     */
47
+    public function getMatchingOperations(string $class, bool $returnFirstMatchingOperationOnly = true): array;
48 48
 
49
-	/**
50
-	 * @throws RuntimeException
51
-	 * @since 18.0.0
52
-	 */
53
-	public function getFlows(bool $returnFirstMatchingOperationOnly = true): array;
49
+    /**
50
+     * @throws RuntimeException
51
+     * @since 18.0.0
52
+     */
53
+    public function getFlows(bool $returnFirstMatchingOperationOnly = true): array;
54 54
 
55
-	/**
56
-	 * this method can only be called once and is typically called by the
57
-	 * Flow engine, unless for IComplexOperations.
58
-	 *
59
-	 * @throws RuntimeException
60
-	 * @since 18.0.0
61
-	 */
62
-	public function setOperation(IOperation $operation): void;
55
+    /**
56
+     * this method can only be called once and is typically called by the
57
+     * Flow engine, unless for IComplexOperations.
58
+     *
59
+     * @throws RuntimeException
60
+     * @since 18.0.0
61
+     */
62
+    public function setOperation(IOperation $operation): void;
63 63
 
64
-	/**
65
-	 * this method can only be called once and is typically called by the
66
-	 * Flow engine, unless for IComplexOperations.
67
-	 *
68
-	 * @throws RuntimeException
69
-	 * @since 18.0.0
70
-	 */
71
-	public function setEntity(IEntity $entity): void;
64
+    /**
65
+     * this method can only be called once and is typically called by the
66
+     * Flow engine, unless for IComplexOperations.
67
+     *
68
+     * @throws RuntimeException
69
+     * @since 18.0.0
70
+     */
71
+    public function setEntity(IEntity $entity): void;
72 72
 
73
-	/**
74
-	 * returns the entity which might provide more information, depending on
75
-	 * the interfaces it implements
76
-	 *
77
-	 * @return IEntity
78
-	 * @since 18.0.0
79
-	 */
80
-	public function getEntity(): IEntity;
73
+    /**
74
+     * returns the entity which might provide more information, depending on
75
+     * the interfaces it implements
76
+     *
77
+     * @return IEntity
78
+     * @since 18.0.0
79
+     */
80
+    public function getEntity(): IEntity;
81 81
 
82
-	/**
83
-	 * this method can be called once to set the event name that is currently
84
-	 * being processed. The workflow engine takes care of this usually, only an
85
-	 * IComplexOperation might want to make use of it.
86
-	 *
87
-	 * @throws RuntimeException
88
-	 * @since 20.0.0
89
-	 */
90
-	public function setEventName(string $eventName): void;
82
+    /**
83
+     * this method can be called once to set the event name that is currently
84
+     * being processed. The workflow engine takes care of this usually, only an
85
+     * IComplexOperation might want to make use of it.
86
+     *
87
+     * @throws RuntimeException
88
+     * @since 20.0.0
89
+     */
90
+    public function setEventName(string $eventName): void;
91 91
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/AppInfo/Application.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -43,86 +43,86 @@
 block discarded – undo
43 43
 use OCP\WorkflowEngine\IOperationCompat;
44 44
 
45 45
 class Application extends App implements IBootstrap {
46
-	public const APP_ID = 'workflowengine';
46
+    public const APP_ID = 'workflowengine';
47 47
 
48
-	public function __construct() {
49
-		parent::__construct(self::APP_ID);
50
-	}
48
+    public function __construct() {
49
+        parent::__construct(self::APP_ID);
50
+    }
51 51
 
52
-	public function register(IRegistrationContext $context): void {
53
-		$context->registerServiceAlias('RequestTimeController', RequestTime::class);
54
-		$context->registerEventListener(
55
-			LoadSettingsScriptsEvent::class,
56
-			LoadAdditionalSettingsScriptsListener::class,
57
-			-100
58
-		);
59
-	}
52
+    public function register(IRegistrationContext $context): void {
53
+        $context->registerServiceAlias('RequestTimeController', RequestTime::class);
54
+        $context->registerEventListener(
55
+            LoadSettingsScriptsEvent::class,
56
+            LoadAdditionalSettingsScriptsListener::class,
57
+            -100
58
+        );
59
+    }
60 60
 
61
-	public function boot(IBootContext $context): void {
62
-		$context->injectFn(Closure::fromCallable([$this, 'registerRuleListeners']));
63
-	}
61
+    public function boot(IBootContext $context): void {
62
+        $context->injectFn(Closure::fromCallable([$this, 'registerRuleListeners']));
63
+    }
64 64
 
65
-	private function registerRuleListeners(IEventDispatcher $dispatcher,
66
-										   IServerContainer $container,
67
-										   ILogger $logger): void {
68
-		/** @var Manager $manager */
69
-		$manager = $container->query(Manager::class);
70
-		$configuredEvents = $manager->getAllConfiguredEvents();
65
+    private function registerRuleListeners(IEventDispatcher $dispatcher,
66
+                                            IServerContainer $container,
67
+                                            ILogger $logger): void {
68
+        /** @var Manager $manager */
69
+        $manager = $container->query(Manager::class);
70
+        $configuredEvents = $manager->getAllConfiguredEvents();
71 71
 
72
-		foreach ($configuredEvents as $operationClass => $events) {
73
-			foreach ($events as $entityClass => $eventNames) {
74
-				array_map(function (string $eventName) use ($manager, $container, $dispatcher, $logger, $operationClass, $entityClass) {
75
-					$dispatcher->addListener(
76
-						$eventName,
77
-						function ($event) use ($manager, $container, $eventName, $logger, $operationClass, $entityClass) {
78
-							$ruleMatcher = $manager->getRuleMatcher();
79
-							try {
80
-								/** @var IEntity $entity */
81
-								$entity = $container->query($entityClass);
82
-								/** @var IOperation $operation */
83
-								$operation = $container->query($operationClass);
72
+        foreach ($configuredEvents as $operationClass => $events) {
73
+            foreach ($events as $entityClass => $eventNames) {
74
+                array_map(function (string $eventName) use ($manager, $container, $dispatcher, $logger, $operationClass, $entityClass) {
75
+                    $dispatcher->addListener(
76
+                        $eventName,
77
+                        function ($event) use ($manager, $container, $eventName, $logger, $operationClass, $entityClass) {
78
+                            $ruleMatcher = $manager->getRuleMatcher();
79
+                            try {
80
+                                /** @var IEntity $entity */
81
+                                $entity = $container->query($entityClass);
82
+                                /** @var IOperation $operation */
83
+                                $operation = $container->query($operationClass);
84 84
 
85
-								$ruleMatcher->setEventName($eventName);
86
-								$ruleMatcher->setEntity($entity);
87
-								$ruleMatcher->setOperation($operation);
85
+                                $ruleMatcher->setEventName($eventName);
86
+                                $ruleMatcher->setEntity($entity);
87
+                                $ruleMatcher->setOperation($operation);
88 88
 
89
-								$ctx = new LogContext();
90
-								$ctx
91
-									->setOperation($operation)
92
-									->setEntity($entity)
93
-									->setEventName($eventName);
89
+                                $ctx = new LogContext();
90
+                                $ctx
91
+                                    ->setOperation($operation)
92
+                                    ->setEntity($entity)
93
+                                    ->setEventName($eventName);
94 94
 
95
-								/** @var Logger $flowLogger */
96
-								$flowLogger = $container->query(Logger::class);
97
-								$flowLogger->logEventInit($ctx);
95
+                                /** @var Logger $flowLogger */
96
+                                $flowLogger = $container->query(Logger::class);
97
+                                $flowLogger->logEventInit($ctx);
98 98
 
99
-								if ($event instanceof Event) {
100
-									$entity->prepareRuleMatcher($ruleMatcher, $eventName, $event);
101
-									$operation->onEvent($eventName, $event, $ruleMatcher);
102
-								} elseif ($entity instanceof IEntityCompat && $operation instanceof IOperationCompat) {
103
-									// TODO: Remove this block (and the compat classes) in the first major release in 2023
104
-									$entity->prepareRuleMatcherCompat($ruleMatcher, $eventName, $event);
105
-									$operation->onEventCompat($eventName, $event, $ruleMatcher);
106
-								} else {
107
-									$logger->debug(
108
-										'Cannot handle event {name} of {event} against entity {entity} and operation {operation}',
109
-										[
110
-											'app' => self::APP_ID,
111
-											'name' => $eventName,
112
-											'event' => get_class($event),
113
-											'entity' => $entityClass,
114
-											'operation' => $operationClass,
115
-										]
116
-									);
117
-								}
118
-								$flowLogger->logEventDone($ctx);
119
-							} catch (QueryException $e) {
120
-								// Ignore query exceptions since they might occur when an entity/operation were setup before by an app that is disabled now
121
-							}
122
-						}
123
-					);
124
-				}, $eventNames ?? []);
125
-			}
126
-		}
127
-	}
99
+                                if ($event instanceof Event) {
100
+                                    $entity->prepareRuleMatcher($ruleMatcher, $eventName, $event);
101
+                                    $operation->onEvent($eventName, $event, $ruleMatcher);
102
+                                } elseif ($entity instanceof IEntityCompat && $operation instanceof IOperationCompat) {
103
+                                    // TODO: Remove this block (and the compat classes) in the first major release in 2023
104
+                                    $entity->prepareRuleMatcherCompat($ruleMatcher, $eventName, $event);
105
+                                    $operation->onEventCompat($eventName, $event, $ruleMatcher);
106
+                                } else {
107
+                                    $logger->debug(
108
+                                        'Cannot handle event {name} of {event} against entity {entity} and operation {operation}',
109
+                                        [
110
+                                            'app' => self::APP_ID,
111
+                                            'name' => $eventName,
112
+                                            'event' => get_class($event),
113
+                                            'entity' => $entityClass,
114
+                                            'operation' => $operationClass,
115
+                                        ]
116
+                                    );
117
+                                }
118
+                                $flowLogger->logEventDone($ctx);
119
+                            } catch (QueryException $e) {
120
+                                // Ignore query exceptions since they might occur when an entity/operation were setup before by an app that is disabled now
121
+                            }
122
+                        }
123
+                    );
124
+                }, $eventNames ?? []);
125
+            }
126
+        }
127
+    }
128 128
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Activity/Setting/Calendar.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -24,61 +24,61 @@
 block discarded – undo
24 24
 namespace OCA\DAV\CalDAV\Activity\Setting;
25 25
 
26 26
 class Calendar extends CalDAVSetting {
27
-	/**
28
-	 * @return string Lowercase a-z and underscore only identifier
29
-	 * @since 11.0.0
30
-	 */
31
-	public function getIdentifier() {
32
-		return 'calendar';
33
-	}
27
+    /**
28
+     * @return string Lowercase a-z and underscore only identifier
29
+     * @since 11.0.0
30
+     */
31
+    public function getIdentifier() {
32
+        return 'calendar';
33
+    }
34 34
 
35
-	/**
36
-	 * @return string A translated string
37
-	 * @since 11.0.0
38
-	 */
39
-	public function getName() {
40
-		return $this->l->t('A <strong>calendar</strong> was modified');
41
-	}
35
+    /**
36
+     * @return string A translated string
37
+     * @since 11.0.0
38
+     */
39
+    public function getName() {
40
+        return $this->l->t('A <strong>calendar</strong> was modified');
41
+    }
42 42
 
43
-	/**
44
-	 * @return int whether the filter should be rather on the top or bottom of
45
-	 * the admin section. The filters are arranged in ascending order of the
46
-	 * priority values. It is required to return a value between 0 and 100.
47
-	 * @since 11.0.0
48
-	 */
49
-	public function getPriority() {
50
-		return 50;
51
-	}
43
+    /**
44
+     * @return int whether the filter should be rather on the top or bottom of
45
+     * the admin section. The filters are arranged in ascending order of the
46
+     * priority values. It is required to return a value between 0 and 100.
47
+     * @since 11.0.0
48
+     */
49
+    public function getPriority() {
50
+        return 50;
51
+    }
52 52
 
53
-	/**
54
-	 * @return bool True when the option can be changed for the stream
55
-	 * @since 11.0.0
56
-	 */
57
-	public function canChangeStream() {
58
-		return true;
59
-	}
53
+    /**
54
+     * @return bool True when the option can be changed for the stream
55
+     * @since 11.0.0
56
+     */
57
+    public function canChangeStream() {
58
+        return true;
59
+    }
60 60
 
61
-	/**
62
-	 * @return bool True when the option can be changed for the stream
63
-	 * @since 11.0.0
64
-	 */
65
-	public function isDefaultEnabledStream() {
66
-		return true;
67
-	}
61
+    /**
62
+     * @return bool True when the option can be changed for the stream
63
+     * @since 11.0.0
64
+     */
65
+    public function isDefaultEnabledStream() {
66
+        return true;
67
+    }
68 68
 
69
-	/**
70
-	 * @return bool True when the option can be changed for the mail
71
-	 * @since 11.0.0
72
-	 */
73
-	public function canChangeMail() {
74
-		return true;
75
-	}
69
+    /**
70
+     * @return bool True when the option can be changed for the mail
71
+     * @since 11.0.0
72
+     */
73
+    public function canChangeMail() {
74
+        return true;
75
+    }
76 76
 
77
-	/**
78
-	 * @return bool True when the option can be changed for the stream
79
-	 * @since 11.0.0
80
-	 */
81
-	public function isDefaultEnabledMail() {
82
-		return false;
83
-	}
77
+    /**
78
+     * @return bool True when the option can be changed for the stream
79
+     * @since 11.0.0
80
+     */
81
+    public function isDefaultEnabledMail() {
82
+        return false;
83
+    }
84 84
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Activity/Setting/Event.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -24,61 +24,61 @@
 block discarded – undo
24 24
 namespace OCA\DAV\CalDAV\Activity\Setting;
25 25
 
26 26
 class Event extends CalDAVSetting {
27
-	/**
28
-	 * @return string Lowercase a-z and underscore only identifier
29
-	 * @since 11.0.0
30
-	 */
31
-	public function getIdentifier() {
32
-		return 'calendar_event';
33
-	}
27
+    /**
28
+     * @return string Lowercase a-z and underscore only identifier
29
+     * @since 11.0.0
30
+     */
31
+    public function getIdentifier() {
32
+        return 'calendar_event';
33
+    }
34 34
 
35
-	/**
36
-	 * @return string A translated string
37
-	 * @since 11.0.0
38
-	 */
39
-	public function getName() {
40
-		return $this->l->t('A calendar <strong>event</strong> was modified');
41
-	}
35
+    /**
36
+     * @return string A translated string
37
+     * @since 11.0.0
38
+     */
39
+    public function getName() {
40
+        return $this->l->t('A calendar <strong>event</strong> was modified');
41
+    }
42 42
 
43
-	/**
44
-	 * @return int whether the filter should be rather on the top or bottom of
45
-	 * the admin section. The filters are arranged in ascending order of the
46
-	 * priority values. It is required to return a value between 0 and 100.
47
-	 * @since 11.0.0
48
-	 */
49
-	public function getPriority() {
50
-		return 50;
51
-	}
43
+    /**
44
+     * @return int whether the filter should be rather on the top or bottom of
45
+     * the admin section. The filters are arranged in ascending order of the
46
+     * priority values. It is required to return a value between 0 and 100.
47
+     * @since 11.0.0
48
+     */
49
+    public function getPriority() {
50
+        return 50;
51
+    }
52 52
 
53
-	/**
54
-	 * @return bool True when the option can be changed for the stream
55
-	 * @since 11.0.0
56
-	 */
57
-	public function canChangeStream() {
58
-		return true;
59
-	}
53
+    /**
54
+     * @return bool True when the option can be changed for the stream
55
+     * @since 11.0.0
56
+     */
57
+    public function canChangeStream() {
58
+        return true;
59
+    }
60 60
 
61
-	/**
62
-	 * @return bool True when the option can be changed for the stream
63
-	 * @since 11.0.0
64
-	 */
65
-	public function isDefaultEnabledStream() {
66
-		return true;
67
-	}
61
+    /**
62
+     * @return bool True when the option can be changed for the stream
63
+     * @since 11.0.0
64
+     */
65
+    public function isDefaultEnabledStream() {
66
+        return true;
67
+    }
68 68
 
69
-	/**
70
-	 * @return bool True when the option can be changed for the mail
71
-	 * @since 11.0.0
72
-	 */
73
-	public function canChangeMail() {
74
-		return true;
75
-	}
69
+    /**
70
+     * @return bool True when the option can be changed for the mail
71
+     * @since 11.0.0
72
+     */
73
+    public function canChangeMail() {
74
+        return true;
75
+    }
76 76
 
77
-	/**
78
-	 * @return bool True when the option can be changed for the stream
79
-	 * @since 11.0.0
80
-	 */
81
-	public function isDefaultEnabledMail() {
82
-		return false;
83
-	}
77
+    /**
78
+     * @return bool True when the option can be changed for the stream
79
+     * @since 11.0.0
80
+     */
81
+    public function isDefaultEnabledMail() {
82
+        return false;
83
+    }
84 84
 }
Please login to merge, or discard this patch.
lib/public/FullTextSearch/Model/ISearchRequestSimpleQuery.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -39,92 +39,92 @@
 block discarded – undo
39 39
  *
40 40
  */
41 41
 interface ISearchRequestSimpleQuery {
42
-	public const COMPARE_TYPE_TEXT = 1;
43
-	public const COMPARE_TYPE_KEYWORD = 2;
44
-	public const COMPARE_TYPE_INT_EQ = 3;
45
-	public const COMPARE_TYPE_INT_GTE = 4;
46
-	public const COMPARE_TYPE_INT_GT = 5;
47
-	public const COMPARE_TYPE_INT_LTE = 6;
48
-	public const COMPARE_TYPE_INT_LT = 7;
49
-	public const COMPARE_TYPE_BOOL = 8;
50
-	public const COMPARE_TYPE_ARRAY = 9;
51
-	public const COMPARE_TYPE_REGEX = 10;
52
-	public const COMPARE_TYPE_WILDCARD = 11;
42
+    public const COMPARE_TYPE_TEXT = 1;
43
+    public const COMPARE_TYPE_KEYWORD = 2;
44
+    public const COMPARE_TYPE_INT_EQ = 3;
45
+    public const COMPARE_TYPE_INT_GTE = 4;
46
+    public const COMPARE_TYPE_INT_GT = 5;
47
+    public const COMPARE_TYPE_INT_LTE = 6;
48
+    public const COMPARE_TYPE_INT_LT = 7;
49
+    public const COMPARE_TYPE_BOOL = 8;
50
+    public const COMPARE_TYPE_ARRAY = 9;
51
+    public const COMPARE_TYPE_REGEX = 10;
52
+    public const COMPARE_TYPE_WILDCARD = 11;
53 53
 
54 54
 
55
-	/**
56
-	 * Get the compare type of the query
57
-	 *
58
-	 * @return int
59
-	 * @since 17.0.0
60
-	 */
61
-	public function getType(): int;
55
+    /**
56
+     * Get the compare type of the query
57
+     *
58
+     * @return int
59
+     * @since 17.0.0
60
+     */
61
+    public function getType(): int;
62 62
 
63 63
 
64
-	/**
65
-	 * Get the field to apply query
66
-	 *
67
-	 * @return string
68
-	 * @since 17.0.0
69
-	 */
70
-	public function getField(): string;
64
+    /**
65
+     * Get the field to apply query
66
+     *
67
+     * @return string
68
+     * @since 17.0.0
69
+     */
70
+    public function getField(): string;
71 71
 
72
-	/**
73
-	 * Set the field to apply query
74
-	 *
75
-	 * @param string $field
76
-	 *
77
-	 * @return ISearchRequestSimpleQuery
78
-	 * @since 17.0.0
79
-	 */
80
-	public function setField(string $field): ISearchRequestSimpleQuery;
72
+    /**
73
+     * Set the field to apply query
74
+     *
75
+     * @param string $field
76
+     *
77
+     * @return ISearchRequestSimpleQuery
78
+     * @since 17.0.0
79
+     */
80
+    public function setField(string $field): ISearchRequestSimpleQuery;
81 81
 
82 82
 
83
-	/**
84
-	 * Get the all values to compare
85
-	 *
86
-	 * @return array
87
-	 * @since 17.0.0
88
-	 */
89
-	public function getValues(): array;
83
+    /**
84
+     * Get the all values to compare
85
+     *
86
+     * @return array
87
+     * @since 17.0.0
88
+     */
89
+    public function getValues(): array;
90 90
 
91
-	/**
92
-	 * Add value to compare (string)
93
-	 *
94
-	 * @param string $value
95
-	 *
96
-	 * @return ISearchRequestSimpleQuery
97
-	 * @since 17.0.0
98
-	 */
99
-	public function addValue(string $value): ISearchRequestSimpleQuery;
91
+    /**
92
+     * Add value to compare (string)
93
+     *
94
+     * @param string $value
95
+     *
96
+     * @return ISearchRequestSimpleQuery
97
+     * @since 17.0.0
98
+     */
99
+    public function addValue(string $value): ISearchRequestSimpleQuery;
100 100
 
101
-	/**
102
-	 * Add value to compare (int)
103
-	 *
104
-	 * @param int $value
105
-	 *
106
-	 * @return ISearchRequestSimpleQuery
107
-	 * @since 17.0.0
108
-	 */
109
-	public function addValueInt(int $value): ISearchRequestSimpleQuery;
101
+    /**
102
+     * Add value to compare (int)
103
+     *
104
+     * @param int $value
105
+     *
106
+     * @return ISearchRequestSimpleQuery
107
+     * @since 17.0.0
108
+     */
109
+    public function addValueInt(int $value): ISearchRequestSimpleQuery;
110 110
 
111
-	/**
112
-	 * Add value to compare (array)
113
-	 *
114
-	 * @param array $value
115
-	 *
116
-	 * @return ISearchRequestSimpleQuery
117
-	 * @since 17.0.0
118
-	 */
119
-	public function addValueArray(array $value): ISearchRequestSimpleQuery;
111
+    /**
112
+     * Add value to compare (array)
113
+     *
114
+     * @param array $value
115
+     *
116
+     * @return ISearchRequestSimpleQuery
117
+     * @since 17.0.0
118
+     */
119
+    public function addValueArray(array $value): ISearchRequestSimpleQuery;
120 120
 
121
-	/**
122
-	 * Add value to compare (bool)
123
-	 *
124
-	 * @param bool $value
125
-	 *
126
-	 * @return ISearchRequestSimpleQuery
127
-	 * @since 17.0.0
128
-	 */
129
-	public function addValueBool(bool $value): ISearchRequestSimpleQuery;
121
+    /**
122
+     * Add value to compare (bool)
123
+     *
124
+     * @param bool $value
125
+     *
126
+     * @return ISearchRequestSimpleQuery
127
+     * @since 17.0.0
128
+     */
129
+    public function addValueBool(bool $value): ISearchRequestSimpleQuery;
130 130
 }
Please login to merge, or discard this patch.
lib/public/FullTextSearch/Model/IRunner.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -41,92 +41,92 @@
 block discarded – undo
41 41
  *
42 42
  */
43 43
 interface IRunner {
44
-	public const RESULT_TYPE_SUCCESS = 1;
45
-	public const RESULT_TYPE_WARNING = 4;
46
-	public const RESULT_TYPE_FAIL = 9;
44
+    public const RESULT_TYPE_SUCCESS = 1;
45
+    public const RESULT_TYPE_WARNING = 4;
46
+    public const RESULT_TYPE_FAIL = 9;
47 47
 
48 48
 
49
-	/**
50
-	 * Info are displayed in the user interface when an admin execute the
51
-	 * ./occ fulltextsearch:index command.
52
-	 *
53
-	 * quick list of info that can be edited:
54
-	 *   'documentId', 'info', 'title', 'resultIndex', 'resultStatus',
55
-	 *   'content', 'documentCurrent', 'documentTotal', 'progressStatus',
56
-	 *   'errorCurrent', 'errorException', 'errorIndex'.
57
-	 *
58
-	 * List of all editable info can be find in the Command\Index.php of the
59
-	 * FullTextSearch app.
60
-	 * (look for a comment 'full list of info that can be edited')
61
-	 *
62
-	 * @since 15.0.0
63
-	 *
64
-	 * @param string $info
65
-	 * @param string $value
66
-	 */
67
-	public function setInfo(string $info, string $value);
49
+    /**
50
+     * Info are displayed in the user interface when an admin execute the
51
+     * ./occ fulltextsearch:index command.
52
+     *
53
+     * quick list of info that can be edited:
54
+     *   'documentId', 'info', 'title', 'resultIndex', 'resultStatus',
55
+     *   'content', 'documentCurrent', 'documentTotal', 'progressStatus',
56
+     *   'errorCurrent', 'errorException', 'errorIndex'.
57
+     *
58
+     * List of all editable info can be find in the Command\Index.php of the
59
+     * FullTextSearch app.
60
+     * (look for a comment 'full list of info that can be edited')
61
+     *
62
+     * @since 15.0.0
63
+     *
64
+     * @param string $info
65
+     * @param string $value
66
+     */
67
+    public function setInfo(string $info, string $value);
68 68
 
69 69
 
70
-	/**
71
-	 * This method should be used when editing multiple info to avoid too many
72
-	 * refresh of the interface.
73
-	 *
74
-	 * @since 15.0.0
75
-	 *
76
-	 * @param array $data
77
-	 */
78
-	public function setInfoArray(array $data);
70
+    /**
71
+     * This method should be used when editing multiple info to avoid too many
72
+     * refresh of the interface.
73
+     *
74
+     * @since 15.0.0
75
+     *
76
+     * @param array $data
77
+     */
78
+    public function setInfoArray(array $data);
79 79
 
80 80
 
81
-	/**
82
-	 * Method used to update the current Action when an index is running.
83
-	 *
84
-	 * This method should be used instead of manually update the 'action' using
85
-	 * setInfo()/setInfoArray() as it is also used to keep the process alive,
86
-	 * manage the input, and some statistics of the load of the process.
87
-	 *
88
-	 * $action is a string with no space
89
-	 * $force should be set to true if the action is heavy while being executed
90
-	 * multiple times
91
-	 *
92
-	 * @since 15.0.0
93
-	 *
94
-	 * @param string $action
95
-	 * @param bool $force
96
-	 *
97
-	 * @return string
98
-	 * @throws \Exception
99
-	 */
100
-	public function updateAction(string $action = '', bool $force = false): string;
81
+    /**
82
+     * Method used to update the current Action when an index is running.
83
+     *
84
+     * This method should be used instead of manually update the 'action' using
85
+     * setInfo()/setInfoArray() as it is also used to keep the process alive,
86
+     * manage the input, and some statistics of the load of the process.
87
+     *
88
+     * $action is a string with no space
89
+     * $force should be set to true if the action is heavy while being executed
90
+     * multiple times
91
+     *
92
+     * @since 15.0.0
93
+     *
94
+     * @param string $action
95
+     * @param bool $force
96
+     *
97
+     * @return string
98
+     * @throws \Exception
99
+     */
100
+    public function updateAction(string $action = '', bool $force = false): string;
101 101
 
102 102
 
103
-	/**
104
-	 * Call this method in a Search Platform or Content Provider if there is an
105
-	 * issue while generating a document or while indexing the current document.
106
-	 * This is used to store and display errors in the UI during an index to help
107
-	 * admin to keep track of errors.
108
-	 *
109
-	 * @since 15.0.0
110
-	 *
111
-	 * @param IIndex $index
112
-	 * @param string $message
113
-	 * @param string $class
114
-	 * @param int $sev
115
-	 */
116
-	public function newIndexError(IIndex $index, string $message, string $class = '', int $sev = 3);
103
+    /**
104
+     * Call this method in a Search Platform or Content Provider if there is an
105
+     * issue while generating a document or while indexing the current document.
106
+     * This is used to store and display errors in the UI during an index to help
107
+     * admin to keep track of errors.
108
+     *
109
+     * @since 15.0.0
110
+     *
111
+     * @param IIndex $index
112
+     * @param string $message
113
+     * @param string $class
114
+     * @param int $sev
115
+     */
116
+    public function newIndexError(IIndex $index, string $message, string $class = '', int $sev = 3);
117 117
 
118 118
 
119
-	/**
120
-	 * Call this method only in a Search Platform after an index of a document.
121
-	 * This is used to store and display results (good or bad) in the UI during
122
-	 * an index to help admin to keep track of fail and successful indexes.
123
-	 *
124
-	 * @since 15.0.0
125
-	 *
126
-	 * @param IIndex $index
127
-	 * @param string $message
128
-	 * @param string $status
129
-	 * @param int $type
130
-	 */
131
-	public function newIndexResult(IIndex $index, string $message, string $status, int $type);
119
+    /**
120
+     * Call this method only in a Search Platform after an index of a document.
121
+     * This is used to store and display results (good or bad) in the UI during
122
+     * an index to help admin to keep track of fail and successful indexes.
123
+     *
124
+     * @since 15.0.0
125
+     *
126
+     * @param IIndex $index
127
+     * @param string $message
128
+     * @param string $status
129
+     * @param int $type
130
+     */
131
+    public function newIndexResult(IIndex $index, string $message, string $status, int $type);
132 132
 }
Please login to merge, or discard this patch.
lib/public/FullTextSearch/Model/IIndexDocument.php 1 patch
Indentation   +581 added lines, -581 removed lines patch added patch discarded remove patch
@@ -42,585 +42,585 @@
 block discarded – undo
42 42
  * @since 15.0.0
43 43
  */
44 44
 interface IIndexDocument {
45
-	public const NOT_ENCODED = 0;
46
-	public const ENCODED_BASE64 = 1;
47
-
48
-
49
-
50
-	/**
51
-	 * Returns the Id of the original document.
52
-	 *
53
-	 * @since 15.0.0
54
-	 *
55
-	 * @return string
56
-	 */
57
-	public function getId(): string;
58
-
59
-
60
-	/**
61
-	 * Returns the Id of the provider.
62
-	 *
63
-	 * @since 15.0.0
64
-	 *
65
-	 * @return string
66
-	 */
67
-	public function getProviderId(): string;
68
-
69
-
70
-	/**
71
-	 * Set the Index related to the IIndexDocument.
72
-	 *
73
-	 * @see IIndex
74
-	 *
75
-	 * @since 15.0.0
76
-	 *
77
-	 * @param IIndex $index
78
-	 *
79
-	 * @return IIndexDocument
80
-	 */
81
-	public function setIndex(IIndex $index): IIndexDocument;
82
-
83
-	/**
84
-	 * Get the Index.
85
-	 *
86
-	 * @since 15.0.0
87
-	 *
88
-	 * @return IIndex
89
-	 */
90
-	public function getIndex(): IIndex;
91
-
92
-	/**
93
-	 * return if Index is defined.
94
-	 *
95
-	 * @since 16.0.0
96
-	 *
97
-	 * @return bool
98
-	 */
99
-	public function hasIndex(): bool;
100
-
101
-
102
-	/**
103
-	 * Set the modified time of the original document.
104
-	 *
105
-	 * @since 15.0.0
106
-	 *
107
-	 * @param int $modifiedTime
108
-	 *
109
-	 * @return IIndexDocument
110
-	 */
111
-	public function setModifiedTime(int $modifiedTime): IIndexDocument;
112
-
113
-	/**
114
-	 * Get the modified time of the original document.
115
-	 *
116
-	 * @since 15.0.0
117
-	 *
118
-	 * @return int
119
-	 */
120
-	public function getModifiedTime(): int;
121
-
122
-	/**
123
-	 * Check if the original document of the IIndexDocument is older than $time.
124
-	 *
125
-	 * @since 15.0.0
126
-	 *
127
-	 * @param int $time
128
-	 *
129
-	 * @return bool
130
-	 */
131
-	public function isOlderThan(int $time): bool;
132
-
133
-
134
-	/**
135
-	 * Set the read rights of the original document using a IDocumentAccess.
136
-	 *
137
-	 * @see IDocumentAccess
138
-	 *
139
-	 * @since 15.0.0
140
-	 *
141
-	 * @param IDocumentAccess $access
142
-	 *
143
-	 * @return $this
144
-	 */
145
-	public function setAccess(IDocumentAccess $access): IIndexDocument;
146
-
147
-	/**
148
-	 * Get the IDocumentAccess related to the original document.
149
-	 *
150
-	 * @since 15.0.0
151
-	 *
152
-	 * @return IDocumentAccess
153
-	 */
154
-	public function getAccess(): IDocumentAccess;
155
-
156
-
157
-	/**
158
-	 * Add a tag to the list.
159
-	 *
160
-	 * @since 15.0.0
161
-	 *
162
-	 * @param string $tag
163
-	 *
164
-	 * @return IIndexDocument
165
-	 */
166
-	public function addTag(string $tag): IIndexDocument;
167
-
168
-	/**
169
-	 * Set the list of tags assigned to the original document.
170
-	 *
171
-	 * @since 15.0.0
172
-	 *
173
-	 * @param array $tags
174
-	 *
175
-	 * @return IIndexDocument
176
-	 */
177
-	public function setTags(array $tags): IIndexDocument;
178
-
179
-	/**
180
-	 * Get the list of tags assigned to the original document.
181
-	 *
182
-	 * @since 15.0.0
183
-	 *
184
-	 * @return array
185
-	 */
186
-	public function getTags(): array;
187
-
188
-
189
-	/**
190
-	 * Add a meta tag to the list.
191
-	 *
192
-	 * @since 15.0.0
193
-	 *
194
-	 * @param string $tag
195
-	 *
196
-	 * @return IIndexDocument
197
-	 */
198
-	public function addMetaTag(string $tag): IIndexDocument;
199
-
200
-	/**
201
-	 * Set the list of meta tags assigned to the original document.
202
-	 *
203
-	 * @since 15.0.0
204
-	 *
205
-	 * @param array $tags
206
-	 *
207
-	 * @return IIndexDocument
208
-	 */
209
-	public function setMetaTags(array $tags): IIndexDocument;
210
-
211
-	/**
212
-	 * Get the list of meta tags assigned to the original document.
213
-	 *
214
-	 * @since 15.0.0
215
-	 *
216
-	 * @return array
217
-	 */
218
-	public function getMetaTags(): array;
219
-
220
-
221
-	/**
222
-	 * Add a sub tag to the list.
223
-	 *
224
-	 * @since 15.0.0
225
-	 *
226
-	 * @param string $sub
227
-	 * @param string $tag
228
-	 *
229
-	 * @return IIndexDocument
230
-	 */
231
-	public function addSubTag(string $sub, string $tag): IIndexDocument;
232
-
233
-	/**
234
-	 * Set the list of sub tags assigned to the original document.
235
-	 *
236
-	 * @since 15.0.0
237
-	 *
238
-	 * @param array $tags
239
-	 *
240
-	 * @return IIndexDocument
241
-	 */
242
-	public function setSubTags(array $tags): IIndexDocument;
243
-
244
-	/**
245
-	 * Get the list of sub tags assigned to the original document.
246
-	 * If $formatted is true, the result will be formatted in a one
247
-	 * dimensional array.
248
-	 *
249
-	 * @since 15.0.0
250
-	 *
251
-	 * @param bool $formatted
252
-	 *
253
-	 * @return array
254
-	 */
255
-	public function getSubTags(bool $formatted = false): array;
256
-
257
-
258
-	/**
259
-	 * Set the source of the original document.
260
-	 *
261
-	 * @since 15.0.0
262
-	 *
263
-	 * @param string $source
264
-	 *
265
-	 * @return IIndexDocument
266
-	 */
267
-	public function setSource(string $source): IIndexDocument;
268
-
269
-	/**
270
-	 * Get the source of the original document.
271
-	 *
272
-	 * @since 15.0.0
273
-	 *
274
-	 * @return string
275
-	 */
276
-	public function getSource(): string;
277
-
278
-
279
-	/**
280
-	 * Set the title of the original document.
281
-	 *
282
-	 * @since 15.0.0
283
-	 *
284
-	 * @param string $title
285
-	 *
286
-	 * @return IIndexDocument
287
-	 */
288
-	public function setTitle(string $title): IIndexDocument;
289
-
290
-	/**
291
-	 * Get the title of the original document.
292
-	 *
293
-	 * @since 15.0.0
294
-	 *
295
-	 * @return string
296
-	 */
297
-	public function getTitle(): string;
298
-
299
-
300
-	/**
301
-	 * Set the content of the document.
302
-	 * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or
303
-	 * encoded in base64.
304
-	 *
305
-	 * @since 15.0.0
306
-	 *
307
-	 * @param string $content
308
-	 * @param int $encoded
309
-	 *
310
-	 * @return IIndexDocument
311
-	 */
312
-	public function setContent(string $content, int $encoded = 0): IIndexDocument;
313
-
314
-	/**
315
-	 * Get the content of the original document.
316
-	 *
317
-	 * @since 15.0.0
318
-	 *
319
-	 * @return string
320
-	 */
321
-	public function getContent(): string;
322
-
323
-	/**
324
-	 * Returns the type of the encoding on the content.
325
-	 *
326
-	 * @since 15.0.0
327
-	 *
328
-	 * @return int
329
-	 */
330
-	public function isContentEncoded(): int;
331
-
332
-	/**
333
-	 * Return the size of the content.
334
-	 *
335
-	 * @since 15.0.0
336
-	 *
337
-	 * @return int
338
-	 */
339
-	public function getContentSize(): int;
340
-
341
-
342
-	/**
343
-	 * Generate an hash, based on the content of the original document.
344
-	 *
345
-	 * @since 15.0.0
346
-	 *
347
-	 * @return IIndexDocument
348
-	 */
349
-	public function initHash(): IIndexDocument;
350
-
351
-	/**
352
-	 * Set the hash of the original document.
353
-	 *
354
-	 * @since 15.0.0
355
-	 *
356
-	 * @param string $hash
357
-	 *
358
-	 * @return IIndexDocument
359
-	 */
360
-	public function setHash(string $hash): IIndexDocument;
361
-
362
-	/**
363
-	 * Get the hash of the original document.
364
-	 *
365
-	 * @since 15.0.0
366
-	 *
367
-	 * @return string
368
-	 */
369
-	public function getHash(): string;
370
-
371
-
372
-	/**
373
-	 * Add a part, identified by a string, and its content.
374
-	 *
375
-	 * It is strongly advised to use alphanumerical chars with no space in the
376
-	 * $part string.
377
-	 *
378
-	 * @since 15.0.0
379
-	 *
380
-	 * @param string $part
381
-	 * @param string $content
382
-	 *
383
-	 * @return IIndexDocument
384
-	 */
385
-	public function addPart(string $part, string $content): IIndexDocument;
386
-
387
-	/**
388
-	 * Set all parts and their content.
389
-	 *
390
-	 * @since 15.0.0
391
-	 *
392
-	 * @param array $parts
393
-	 *
394
-	 * @return IIndexDocument
395
-	 */
396
-	public function setParts(array $parts): IIndexDocument;
397
-
398
-	/**
399
-	 * Get all parts of the IIndexDocument.
400
-	 *
401
-	 * @since 15.0.0
402
-	 *
403
-	 * @return array
404
-	 */
405
-	public function getParts(): array;
406
-
407
-
408
-	/**
409
-	 * Add a link, usable by the frontend.
410
-	 *
411
-	 * @since 15.0.0
412
-	 *
413
-	 * @param string $link
414
-	 *
415
-	 * @return IIndexDocument
416
-	 */
417
-	public function setLink(string $link): IIndexDocument;
418
-
419
-	/**
420
-	 * Get the link.
421
-	 *
422
-	 * @since 15.0.0
423
-	 *
424
-	 * @return string
425
-	 */
426
-	public function getLink(): string;
427
-
428
-
429
-	/**
430
-	 * Set more information that couldn't be set using other method.
431
-	 *
432
-	 * @since 15.0.0
433
-	 *
434
-	 * @param array $more
435
-	 *
436
-	 * @return IIndexDocument
437
-	 */
438
-	public function setMore(array $more): IIndexDocument;
439
-
440
-	/**
441
-	 * Get more information.
442
-	 *
443
-	 * @since 15.0.0
444
-	 *
445
-	 * @return array
446
-	 */
447
-	public function getMore(): array;
448
-
449
-
450
-	/**
451
-	 * Add some excerpt of the content of the original document, usually based
452
-	 * on the search request.
453
-	 *
454
-	 * @since 16.0.0
455
-	 *
456
-	 * @param string $source
457
-	 * @param string $excerpt
458
-	 *
459
-	 * @return IIndexDocument
460
-	 */
461
-	public function addExcerpt(string $source, string $excerpt): IIndexDocument;
462
-
463
-	/**
464
-	 * Set all excerpts of the content of the original document.
465
-	 *
466
-	 * @since 16.0.0
467
-	 *
468
-	 * @param array $excerpts
469
-	 *
470
-	 * @return IIndexDocument
471
-	 */
472
-	public function setExcerpts(array $excerpts): IIndexDocument;
473
-
474
-	/**
475
-	 * Get all excerpts of the content of the original document.
476
-	 *
477
-	 * @since 15.0.0
478
-	 *
479
-	 * @return array
480
-	 */
481
-	public function getExcerpts(): array;
482
-
483
-
484
-	/**
485
-	 * Set the score to the result assigned to this document during a search
486
-	 * request.
487
-	 *
488
-	 * @since 15.0.0
489
-	 *
490
-	 * @param string $score
491
-	 *
492
-	 * @return IIndexDocument
493
-	 */
494
-	public function setScore(string $score): IIndexDocument;
495
-
496
-	/**
497
-	 * Get the score.
498
-	 *
499
-	 * @since 15.0.0
500
-	 *
501
-	 * @return string
502
-	 */
503
-	public function getScore(): string;
504
-
505
-
506
-	/**
507
-	 * Set some information about the original document that will be available
508
-	 * to the front-end when displaying search result. (as string)
509
-	 * Because this information will not be indexed, this method can also be
510
-	 * used to manage some data while filling the IIndexDocument before its
511
-	 * indexing.
512
-	 *
513
-	 * @since 15.0.0
514
-	 *
515
-	 * @param string $info
516
-	 * @param string $value
517
-	 *
518
-	 * @return IIndexDocument
519
-	 */
520
-	public function setInfo(string $info, string $value): IIndexDocument;
521
-
522
-	/**
523
-	 * Get an information about a document. (string)
524
-	 *
525
-	 * @since 15.0.0
526
-	 *
527
-	 * @param string $info
528
-	 * @param string $default
529
-	 *
530
-	 * @return string
531
-	 */
532
-	public function getInfo(string $info, string $default = ''): string;
533
-
534
-	/**
535
-	 * Set some information about the original document that will be available
536
-	 * to the front-end when displaying search result. (as array)
537
-	 * Because this information will not be indexed, this method can also be
538
-	 * used to manage some data while filling the IIndexDocument before its
539
-	 * indexing.
540
-	 *
541
-	 * @since 15.0.0
542
-	 *
543
-	 * @param string $info
544
-	 * @param array $value
545
-	 *
546
-	 * @return IIndexDocument
547
-	 */
548
-	public function setInfoArray(string $info, array $value): IIndexDocument;
549
-
550
-	/**
551
-	 * Get an information about a document. (array)
552
-	 *
553
-	 * @since 15.0.0
554
-	 *
555
-	 * @param string $info
556
-	 * @param array $default
557
-	 *
558
-	 * @return array
559
-	 */
560
-	public function getInfoArray(string $info, array $default = []): array;
561
-
562
-	/**
563
-	 * Set some information about the original document that will be available
564
-	 * to the front-end when displaying search result. (as int)
565
-	 * Because this information will not be indexed, this method can also be
566
-	 * used to manage some data while filling the IIndexDocument before its
567
-	 * indexing.
568
-	 *
569
-	 * @since 15.0.0
570
-	 *
571
-	 * @param string $info
572
-	 * @param int $value
573
-	 *
574
-	 * @return IIndexDocument
575
-	 */
576
-	public function setInfoInt(string $info, int $value): IIndexDocument;
577
-
578
-	/**
579
-	 * Get an information about a document. (int)
580
-	 *
581
-	 * @since 15.0.0
582
-	 *
583
-	 * @param string $info
584
-	 * @param int $default
585
-	 *
586
-	 * @return int
587
-	 */
588
-	public function getInfoInt(string $info, int $default = 0): int;
589
-
590
-	/**
591
-	 * Set some information about the original document that will be available
592
-	 * to the front-end when displaying search result. (as bool)
593
-	 * Because this information will not be indexed, this method can also be
594
-	 * used to manage some data while filling the IIndexDocument before its
595
-	 * indexing.
596
-	 *
597
-	 * @since 15.0.0
598
-	 *
599
-	 * @param string $info
600
-	 * @param bool $value
601
-	 *
602
-	 * @return IIndexDocument
603
-	 */
604
-	public function setInfoBool(string $info, bool $value): IIndexDocument;
605
-
606
-	/**
607
-	 * Get an information about a document. (bool)
608
-	 *
609
-	 * @since 15.0.0
610
-	 *
611
-	 * @param string $info
612
-	 * @param bool $default
613
-	 *
614
-	 * @return bool
615
-	 */
616
-	public function getInfoBool(string $info, bool $default = false): bool;
617
-
618
-	/**
619
-	 * Get all info.
620
-	 *
621
-	 * @since 15.0.0
622
-	 *
623
-	 * @return array
624
-	 */
625
-	public function getInfoAll(): array;
45
+    public const NOT_ENCODED = 0;
46
+    public const ENCODED_BASE64 = 1;
47
+
48
+
49
+
50
+    /**
51
+     * Returns the Id of the original document.
52
+     *
53
+     * @since 15.0.0
54
+     *
55
+     * @return string
56
+     */
57
+    public function getId(): string;
58
+
59
+
60
+    /**
61
+     * Returns the Id of the provider.
62
+     *
63
+     * @since 15.0.0
64
+     *
65
+     * @return string
66
+     */
67
+    public function getProviderId(): string;
68
+
69
+
70
+    /**
71
+     * Set the Index related to the IIndexDocument.
72
+     *
73
+     * @see IIndex
74
+     *
75
+     * @since 15.0.0
76
+     *
77
+     * @param IIndex $index
78
+     *
79
+     * @return IIndexDocument
80
+     */
81
+    public function setIndex(IIndex $index): IIndexDocument;
82
+
83
+    /**
84
+     * Get the Index.
85
+     *
86
+     * @since 15.0.0
87
+     *
88
+     * @return IIndex
89
+     */
90
+    public function getIndex(): IIndex;
91
+
92
+    /**
93
+     * return if Index is defined.
94
+     *
95
+     * @since 16.0.0
96
+     *
97
+     * @return bool
98
+     */
99
+    public function hasIndex(): bool;
100
+
101
+
102
+    /**
103
+     * Set the modified time of the original document.
104
+     *
105
+     * @since 15.0.0
106
+     *
107
+     * @param int $modifiedTime
108
+     *
109
+     * @return IIndexDocument
110
+     */
111
+    public function setModifiedTime(int $modifiedTime): IIndexDocument;
112
+
113
+    /**
114
+     * Get the modified time of the original document.
115
+     *
116
+     * @since 15.0.0
117
+     *
118
+     * @return int
119
+     */
120
+    public function getModifiedTime(): int;
121
+
122
+    /**
123
+     * Check if the original document of the IIndexDocument is older than $time.
124
+     *
125
+     * @since 15.0.0
126
+     *
127
+     * @param int $time
128
+     *
129
+     * @return bool
130
+     */
131
+    public function isOlderThan(int $time): bool;
132
+
133
+
134
+    /**
135
+     * Set the read rights of the original document using a IDocumentAccess.
136
+     *
137
+     * @see IDocumentAccess
138
+     *
139
+     * @since 15.0.0
140
+     *
141
+     * @param IDocumentAccess $access
142
+     *
143
+     * @return $this
144
+     */
145
+    public function setAccess(IDocumentAccess $access): IIndexDocument;
146
+
147
+    /**
148
+     * Get the IDocumentAccess related to the original document.
149
+     *
150
+     * @since 15.0.0
151
+     *
152
+     * @return IDocumentAccess
153
+     */
154
+    public function getAccess(): IDocumentAccess;
155
+
156
+
157
+    /**
158
+     * Add a tag to the list.
159
+     *
160
+     * @since 15.0.0
161
+     *
162
+     * @param string $tag
163
+     *
164
+     * @return IIndexDocument
165
+     */
166
+    public function addTag(string $tag): IIndexDocument;
167
+
168
+    /**
169
+     * Set the list of tags assigned to the original document.
170
+     *
171
+     * @since 15.0.0
172
+     *
173
+     * @param array $tags
174
+     *
175
+     * @return IIndexDocument
176
+     */
177
+    public function setTags(array $tags): IIndexDocument;
178
+
179
+    /**
180
+     * Get the list of tags assigned to the original document.
181
+     *
182
+     * @since 15.0.0
183
+     *
184
+     * @return array
185
+     */
186
+    public function getTags(): array;
187
+
188
+
189
+    /**
190
+     * Add a meta tag to the list.
191
+     *
192
+     * @since 15.0.0
193
+     *
194
+     * @param string $tag
195
+     *
196
+     * @return IIndexDocument
197
+     */
198
+    public function addMetaTag(string $tag): IIndexDocument;
199
+
200
+    /**
201
+     * Set the list of meta tags assigned to the original document.
202
+     *
203
+     * @since 15.0.0
204
+     *
205
+     * @param array $tags
206
+     *
207
+     * @return IIndexDocument
208
+     */
209
+    public function setMetaTags(array $tags): IIndexDocument;
210
+
211
+    /**
212
+     * Get the list of meta tags assigned to the original document.
213
+     *
214
+     * @since 15.0.0
215
+     *
216
+     * @return array
217
+     */
218
+    public function getMetaTags(): array;
219
+
220
+
221
+    /**
222
+     * Add a sub tag to the list.
223
+     *
224
+     * @since 15.0.0
225
+     *
226
+     * @param string $sub
227
+     * @param string $tag
228
+     *
229
+     * @return IIndexDocument
230
+     */
231
+    public function addSubTag(string $sub, string $tag): IIndexDocument;
232
+
233
+    /**
234
+     * Set the list of sub tags assigned to the original document.
235
+     *
236
+     * @since 15.0.0
237
+     *
238
+     * @param array $tags
239
+     *
240
+     * @return IIndexDocument
241
+     */
242
+    public function setSubTags(array $tags): IIndexDocument;
243
+
244
+    /**
245
+     * Get the list of sub tags assigned to the original document.
246
+     * If $formatted is true, the result will be formatted in a one
247
+     * dimensional array.
248
+     *
249
+     * @since 15.0.0
250
+     *
251
+     * @param bool $formatted
252
+     *
253
+     * @return array
254
+     */
255
+    public function getSubTags(bool $formatted = false): array;
256
+
257
+
258
+    /**
259
+     * Set the source of the original document.
260
+     *
261
+     * @since 15.0.0
262
+     *
263
+     * @param string $source
264
+     *
265
+     * @return IIndexDocument
266
+     */
267
+    public function setSource(string $source): IIndexDocument;
268
+
269
+    /**
270
+     * Get the source of the original document.
271
+     *
272
+     * @since 15.0.0
273
+     *
274
+     * @return string
275
+     */
276
+    public function getSource(): string;
277
+
278
+
279
+    /**
280
+     * Set the title of the original document.
281
+     *
282
+     * @since 15.0.0
283
+     *
284
+     * @param string $title
285
+     *
286
+     * @return IIndexDocument
287
+     */
288
+    public function setTitle(string $title): IIndexDocument;
289
+
290
+    /**
291
+     * Get the title of the original document.
292
+     *
293
+     * @since 15.0.0
294
+     *
295
+     * @return string
296
+     */
297
+    public function getTitle(): string;
298
+
299
+
300
+    /**
301
+     * Set the content of the document.
302
+     * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or
303
+     * encoded in base64.
304
+     *
305
+     * @since 15.0.0
306
+     *
307
+     * @param string $content
308
+     * @param int $encoded
309
+     *
310
+     * @return IIndexDocument
311
+     */
312
+    public function setContent(string $content, int $encoded = 0): IIndexDocument;
313
+
314
+    /**
315
+     * Get the content of the original document.
316
+     *
317
+     * @since 15.0.0
318
+     *
319
+     * @return string
320
+     */
321
+    public function getContent(): string;
322
+
323
+    /**
324
+     * Returns the type of the encoding on the content.
325
+     *
326
+     * @since 15.0.0
327
+     *
328
+     * @return int
329
+     */
330
+    public function isContentEncoded(): int;
331
+
332
+    /**
333
+     * Return the size of the content.
334
+     *
335
+     * @since 15.0.0
336
+     *
337
+     * @return int
338
+     */
339
+    public function getContentSize(): int;
340
+
341
+
342
+    /**
343
+     * Generate an hash, based on the content of the original document.
344
+     *
345
+     * @since 15.0.0
346
+     *
347
+     * @return IIndexDocument
348
+     */
349
+    public function initHash(): IIndexDocument;
350
+
351
+    /**
352
+     * Set the hash of the original document.
353
+     *
354
+     * @since 15.0.0
355
+     *
356
+     * @param string $hash
357
+     *
358
+     * @return IIndexDocument
359
+     */
360
+    public function setHash(string $hash): IIndexDocument;
361
+
362
+    /**
363
+     * Get the hash of the original document.
364
+     *
365
+     * @since 15.0.0
366
+     *
367
+     * @return string
368
+     */
369
+    public function getHash(): string;
370
+
371
+
372
+    /**
373
+     * Add a part, identified by a string, and its content.
374
+     *
375
+     * It is strongly advised to use alphanumerical chars with no space in the
376
+     * $part string.
377
+     *
378
+     * @since 15.0.0
379
+     *
380
+     * @param string $part
381
+     * @param string $content
382
+     *
383
+     * @return IIndexDocument
384
+     */
385
+    public function addPart(string $part, string $content): IIndexDocument;
386
+
387
+    /**
388
+     * Set all parts and their content.
389
+     *
390
+     * @since 15.0.0
391
+     *
392
+     * @param array $parts
393
+     *
394
+     * @return IIndexDocument
395
+     */
396
+    public function setParts(array $parts): IIndexDocument;
397
+
398
+    /**
399
+     * Get all parts of the IIndexDocument.
400
+     *
401
+     * @since 15.0.0
402
+     *
403
+     * @return array
404
+     */
405
+    public function getParts(): array;
406
+
407
+
408
+    /**
409
+     * Add a link, usable by the frontend.
410
+     *
411
+     * @since 15.0.0
412
+     *
413
+     * @param string $link
414
+     *
415
+     * @return IIndexDocument
416
+     */
417
+    public function setLink(string $link): IIndexDocument;
418
+
419
+    /**
420
+     * Get the link.
421
+     *
422
+     * @since 15.0.0
423
+     *
424
+     * @return string
425
+     */
426
+    public function getLink(): string;
427
+
428
+
429
+    /**
430
+     * Set more information that couldn't be set using other method.
431
+     *
432
+     * @since 15.0.0
433
+     *
434
+     * @param array $more
435
+     *
436
+     * @return IIndexDocument
437
+     */
438
+    public function setMore(array $more): IIndexDocument;
439
+
440
+    /**
441
+     * Get more information.
442
+     *
443
+     * @since 15.0.0
444
+     *
445
+     * @return array
446
+     */
447
+    public function getMore(): array;
448
+
449
+
450
+    /**
451
+     * Add some excerpt of the content of the original document, usually based
452
+     * on the search request.
453
+     *
454
+     * @since 16.0.0
455
+     *
456
+     * @param string $source
457
+     * @param string $excerpt
458
+     *
459
+     * @return IIndexDocument
460
+     */
461
+    public function addExcerpt(string $source, string $excerpt): IIndexDocument;
462
+
463
+    /**
464
+     * Set all excerpts of the content of the original document.
465
+     *
466
+     * @since 16.0.0
467
+     *
468
+     * @param array $excerpts
469
+     *
470
+     * @return IIndexDocument
471
+     */
472
+    public function setExcerpts(array $excerpts): IIndexDocument;
473
+
474
+    /**
475
+     * Get all excerpts of the content of the original document.
476
+     *
477
+     * @since 15.0.0
478
+     *
479
+     * @return array
480
+     */
481
+    public function getExcerpts(): array;
482
+
483
+
484
+    /**
485
+     * Set the score to the result assigned to this document during a search
486
+     * request.
487
+     *
488
+     * @since 15.0.0
489
+     *
490
+     * @param string $score
491
+     *
492
+     * @return IIndexDocument
493
+     */
494
+    public function setScore(string $score): IIndexDocument;
495
+
496
+    /**
497
+     * Get the score.
498
+     *
499
+     * @since 15.0.0
500
+     *
501
+     * @return string
502
+     */
503
+    public function getScore(): string;
504
+
505
+
506
+    /**
507
+     * Set some information about the original document that will be available
508
+     * to the front-end when displaying search result. (as string)
509
+     * Because this information will not be indexed, this method can also be
510
+     * used to manage some data while filling the IIndexDocument before its
511
+     * indexing.
512
+     *
513
+     * @since 15.0.0
514
+     *
515
+     * @param string $info
516
+     * @param string $value
517
+     *
518
+     * @return IIndexDocument
519
+     */
520
+    public function setInfo(string $info, string $value): IIndexDocument;
521
+
522
+    /**
523
+     * Get an information about a document. (string)
524
+     *
525
+     * @since 15.0.0
526
+     *
527
+     * @param string $info
528
+     * @param string $default
529
+     *
530
+     * @return string
531
+     */
532
+    public function getInfo(string $info, string $default = ''): string;
533
+
534
+    /**
535
+     * Set some information about the original document that will be available
536
+     * to the front-end when displaying search result. (as array)
537
+     * Because this information will not be indexed, this method can also be
538
+     * used to manage some data while filling the IIndexDocument before its
539
+     * indexing.
540
+     *
541
+     * @since 15.0.0
542
+     *
543
+     * @param string $info
544
+     * @param array $value
545
+     *
546
+     * @return IIndexDocument
547
+     */
548
+    public function setInfoArray(string $info, array $value): IIndexDocument;
549
+
550
+    /**
551
+     * Get an information about a document. (array)
552
+     *
553
+     * @since 15.0.0
554
+     *
555
+     * @param string $info
556
+     * @param array $default
557
+     *
558
+     * @return array
559
+     */
560
+    public function getInfoArray(string $info, array $default = []): array;
561
+
562
+    /**
563
+     * Set some information about the original document that will be available
564
+     * to the front-end when displaying search result. (as int)
565
+     * Because this information will not be indexed, this method can also be
566
+     * used to manage some data while filling the IIndexDocument before its
567
+     * indexing.
568
+     *
569
+     * @since 15.0.0
570
+     *
571
+     * @param string $info
572
+     * @param int $value
573
+     *
574
+     * @return IIndexDocument
575
+     */
576
+    public function setInfoInt(string $info, int $value): IIndexDocument;
577
+
578
+    /**
579
+     * Get an information about a document. (int)
580
+     *
581
+     * @since 15.0.0
582
+     *
583
+     * @param string $info
584
+     * @param int $default
585
+     *
586
+     * @return int
587
+     */
588
+    public function getInfoInt(string $info, int $default = 0): int;
589
+
590
+    /**
591
+     * Set some information about the original document that will be available
592
+     * to the front-end when displaying search result. (as bool)
593
+     * Because this information will not be indexed, this method can also be
594
+     * used to manage some data while filling the IIndexDocument before its
595
+     * indexing.
596
+     *
597
+     * @since 15.0.0
598
+     *
599
+     * @param string $info
600
+     * @param bool $value
601
+     *
602
+     * @return IIndexDocument
603
+     */
604
+    public function setInfoBool(string $info, bool $value): IIndexDocument;
605
+
606
+    /**
607
+     * Get an information about a document. (bool)
608
+     *
609
+     * @since 15.0.0
610
+     *
611
+     * @param string $info
612
+     * @param bool $default
613
+     *
614
+     * @return bool
615
+     */
616
+    public function getInfoBool(string $info, bool $default = false): bool;
617
+
618
+    /**
619
+     * Get all info.
620
+     *
621
+     * @since 15.0.0
622
+     *
623
+     * @return array
624
+     */
625
+    public function getInfoAll(): array;
626 626
 }
Please login to merge, or discard this patch.
apps/files/lib/Service/DirectEditingService.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -33,57 +33,57 @@
 block discarded – undo
33 33
 
34 34
 class DirectEditingService {
35 35
 
36
-	/** @var IManager */
37
-	private $directEditingManager;
38
-	/** @var IEventDispatcher */
39
-	private $eventDispatcher;
36
+    /** @var IManager */
37
+    private $directEditingManager;
38
+    /** @var IEventDispatcher */
39
+    private $eventDispatcher;
40 40
 
41
-	public function __construct(IEventDispatcher $eventDispatcher, IManager $directEditingManager) {
42
-		$this->directEditingManager = $directEditingManager;
43
-		$this->eventDispatcher = $eventDispatcher;
44
-	}
41
+    public function __construct(IEventDispatcher $eventDispatcher, IManager $directEditingManager) {
42
+        $this->directEditingManager = $directEditingManager;
43
+        $this->eventDispatcher = $eventDispatcher;
44
+    }
45 45
 
46
-	public function getDirectEditingETag(): string {
47
-		return \md5(\json_encode($this->getDirectEditingCapabilitites()));
48
-	}
46
+    public function getDirectEditingETag(): string {
47
+        return \md5(\json_encode($this->getDirectEditingCapabilitites()));
48
+    }
49 49
 
50
-	public function getDirectEditingCapabilitites(): array {
51
-		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
50
+    public function getDirectEditingCapabilitites(): array {
51
+        $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
52 52
 
53
-		$capabilities = [
54
-			'editors' => [],
55
-			'creators' => []
56
-		];
53
+        $capabilities = [
54
+            'editors' => [],
55
+            'creators' => []
56
+        ];
57 57
 
58
-		if (!$this->directEditingManager->isEnabled()) {
59
-			return $capabilities;
60
-		}
58
+        if (!$this->directEditingManager->isEnabled()) {
59
+            return $capabilities;
60
+        }
61 61
 
62
-		/**
63
-		 * @var string $id
64
-		 * @var IEditor $editor
65
-		 */
66
-		foreach ($this->directEditingManager->getEditors() as $id => $editor) {
67
-			$capabilities['editors'][$id] = [
68
-				'id' => $editor->getId(),
69
-				'name' => $editor->getName(),
70
-				'mimetypes' => $editor->getMimetypes(),
71
-				'optionalMimetypes' => $editor->getMimetypesOptional(),
72
-				'secure' => $editor->isSecure(),
73
-			];
74
-			/** @var ACreateEmpty|ACreateFromTemplate $creator */
75
-			foreach ($editor->getCreators() as $creator) {
76
-				$id = $creator->getId();
77
-				$capabilities['creators'][$id] = [
78
-					'id' => $id,
79
-					'editor' => $editor->getId(),
80
-					'name' => $creator->getName(),
81
-					'extension' => $creator->getExtension(),
82
-					'templates' => $creator instanceof ACreateFromTemplate,
83
-					'mimetype' => $creator->getMimetype()
84
-				];
85
-			}
86
-		}
87
-		return $capabilities;
88
-	}
62
+        /**
63
+         * @var string $id
64
+         * @var IEditor $editor
65
+         */
66
+        foreach ($this->directEditingManager->getEditors() as $id => $editor) {
67
+            $capabilities['editors'][$id] = [
68
+                'id' => $editor->getId(),
69
+                'name' => $editor->getName(),
70
+                'mimetypes' => $editor->getMimetypes(),
71
+                'optionalMimetypes' => $editor->getMimetypesOptional(),
72
+                'secure' => $editor->isSecure(),
73
+            ];
74
+            /** @var ACreateEmpty|ACreateFromTemplate $creator */
75
+            foreach ($editor->getCreators() as $creator) {
76
+                $id = $creator->getId();
77
+                $capabilities['creators'][$id] = [
78
+                    'id' => $id,
79
+                    'editor' => $editor->getId(),
80
+                    'name' => $creator->getName(),
81
+                    'extension' => $creator->getExtension(),
82
+                    'templates' => $creator instanceof ACreateFromTemplate,
83
+                    'mimetype' => $creator->getMimetype()
84
+                ];
85
+            }
86
+        }
87
+        return $capabilities;
88
+    }
89 89
 }
Please login to merge, or discard this patch.
apps/files/lib/Controller/DirectEditingController.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -37,97 +37,97 @@
 block discarded – undo
37 37
 
38 38
 class DirectEditingController extends OCSController {
39 39
 
40
-	/** @var IEventDispatcher */
41
-	private $eventDispatcher;
42
-
43
-	/** @var IManager */
44
-	private $directEditingManager;
45
-
46
-	/** @var IURLGenerator */
47
-	private $urlGenerator;
48
-
49
-	/** @var ILogger */
50
-	private $logger;
51
-
52
-	/** @var DirectEditingService */
53
-	private $directEditingService;
54
-
55
-	public function __construct($appName, IRequest $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge,
56
-								IEventDispatcher $eventDispatcher, IURLGenerator $urlGenerator, IManager $manager, DirectEditingService $directEditingService, ILogger $logger) {
57
-		parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge);
58
-
59
-		$this->eventDispatcher = $eventDispatcher;
60
-		$this->directEditingManager = $manager;
61
-		$this->directEditingService = $directEditingService;
62
-		$this->logger = $logger;
63
-		$this->urlGenerator = $urlGenerator;
64
-	}
65
-
66
-	/**
67
-	 * @NoAdminRequired
68
-	 */
69
-	public function info(): DataResponse {
70
-		$response = new DataResponse($this->directEditingService->getDirectEditingCapabilitites());
71
-		$response->setETag($this->directEditingService->getDirectEditingETag());
72
-		return $response;
73
-	}
74
-
75
-	/**
76
-	 * @NoAdminRequired
77
-	 */
78
-	public function create(string $path, string $editorId, string $creatorId, string $templateId = null): DataResponse {
79
-		if (!$this->directEditingManager->isEnabled()) {
80
-			return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
81
-		}
82
-		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
83
-
84
-		try {
85
-			$token = $this->directEditingManager->create($path, $editorId, $creatorId, $templateId);
86
-			return new DataResponse([
87
-				'url' => $this->urlGenerator->linkToRouteAbsolute('files.DirectEditingView.edit', ['token' => $token])
88
-			]);
89
-		} catch (Exception $e) {
90
-			$this->logger->logException($e, ['message' => 'Exception when creating a new file through direct editing']);
91
-			return new DataResponse(['message' => 'Failed to create file: ' . $e->getMessage()], Http::STATUS_FORBIDDEN);
92
-		}
93
-	}
94
-
95
-	/**
96
-	 * @NoAdminRequired
97
-	 */
98
-	public function open(string $path, string $editorId = null): DataResponse {
99
-		if (!$this->directEditingManager->isEnabled()) {
100
-			return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
101
-		}
102
-		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
103
-
104
-		try {
105
-			$token = $this->directEditingManager->open($path, $editorId);
106
-			return new DataResponse([
107
-				'url' => $this->urlGenerator->linkToRouteAbsolute('files.DirectEditingView.edit', ['token' => $token])
108
-			]);
109
-		} catch (Exception $e) {
110
-			$this->logger->logException($e, ['message' => 'Exception when opening a file through direct editing']);
111
-			return new DataResponse(['message' => 'Failed to open file: ' . $e->getMessage()], Http::STATUS_FORBIDDEN);
112
-		}
113
-	}
114
-
115
-
116
-
117
-	/**
118
-	 * @NoAdminRequired
119
-	 */
120
-	public function templates(string $editorId, string $creatorId): DataResponse {
121
-		if (!$this->directEditingManager->isEnabled()) {
122
-			return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
123
-		}
124
-		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
125
-
126
-		try {
127
-			return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId));
128
-		} catch (Exception $e) {
129
-			$this->logger->logException($e);
130
-			return new DataResponse(['message' => 'Failed to obtain template list: ' . $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
131
-		}
132
-	}
40
+    /** @var IEventDispatcher */
41
+    private $eventDispatcher;
42
+
43
+    /** @var IManager */
44
+    private $directEditingManager;
45
+
46
+    /** @var IURLGenerator */
47
+    private $urlGenerator;
48
+
49
+    /** @var ILogger */
50
+    private $logger;
51
+
52
+    /** @var DirectEditingService */
53
+    private $directEditingService;
54
+
55
+    public function __construct($appName, IRequest $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge,
56
+                                IEventDispatcher $eventDispatcher, IURLGenerator $urlGenerator, IManager $manager, DirectEditingService $directEditingService, ILogger $logger) {
57
+        parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge);
58
+
59
+        $this->eventDispatcher = $eventDispatcher;
60
+        $this->directEditingManager = $manager;
61
+        $this->directEditingService = $directEditingService;
62
+        $this->logger = $logger;
63
+        $this->urlGenerator = $urlGenerator;
64
+    }
65
+
66
+    /**
67
+     * @NoAdminRequired
68
+     */
69
+    public function info(): DataResponse {
70
+        $response = new DataResponse($this->directEditingService->getDirectEditingCapabilitites());
71
+        $response->setETag($this->directEditingService->getDirectEditingETag());
72
+        return $response;
73
+    }
74
+
75
+    /**
76
+     * @NoAdminRequired
77
+     */
78
+    public function create(string $path, string $editorId, string $creatorId, string $templateId = null): DataResponse {
79
+        if (!$this->directEditingManager->isEnabled()) {
80
+            return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
81
+        }
82
+        $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
83
+
84
+        try {
85
+            $token = $this->directEditingManager->create($path, $editorId, $creatorId, $templateId);
86
+            return new DataResponse([
87
+                'url' => $this->urlGenerator->linkToRouteAbsolute('files.DirectEditingView.edit', ['token' => $token])
88
+            ]);
89
+        } catch (Exception $e) {
90
+            $this->logger->logException($e, ['message' => 'Exception when creating a new file through direct editing']);
91
+            return new DataResponse(['message' => 'Failed to create file: ' . $e->getMessage()], Http::STATUS_FORBIDDEN);
92
+        }
93
+    }
94
+
95
+    /**
96
+     * @NoAdminRequired
97
+     */
98
+    public function open(string $path, string $editorId = null): DataResponse {
99
+        if (!$this->directEditingManager->isEnabled()) {
100
+            return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
101
+        }
102
+        $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
103
+
104
+        try {
105
+            $token = $this->directEditingManager->open($path, $editorId);
106
+            return new DataResponse([
107
+                'url' => $this->urlGenerator->linkToRouteAbsolute('files.DirectEditingView.edit', ['token' => $token])
108
+            ]);
109
+        } catch (Exception $e) {
110
+            $this->logger->logException($e, ['message' => 'Exception when opening a file through direct editing']);
111
+            return new DataResponse(['message' => 'Failed to open file: ' . $e->getMessage()], Http::STATUS_FORBIDDEN);
112
+        }
113
+    }
114
+
115
+
116
+
117
+    /**
118
+     * @NoAdminRequired
119
+     */
120
+    public function templates(string $editorId, string $creatorId): DataResponse {
121
+        if (!$this->directEditingManager->isEnabled()) {
122
+            return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
123
+        }
124
+        $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
125
+
126
+        try {
127
+            return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId));
128
+        } catch (Exception $e) {
129
+            $this->logger->logException($e);
130
+            return new DataResponse(['message' => 'Failed to obtain template list: ' . $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
131
+        }
132
+    }
133 133
 }
Please login to merge, or discard this patch.