aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/LanguageModel/TopicsTask.php
blob: 114c3c0ab0679057b4d3534c42256c95ae79057d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

namespace OCP\LanguageModel;

/**
 * @since 28.0.0
 */
final class TopicsTask extends AbstractLanguageModelTask {
	/**
	 * @since 28.0.0
	 */
	public const TYPE = 'topics';

	/**
	 * @inheritDoc
	 */
	public function visitProvider(ILanguageModelProvider $provider): string {
		if (!$provider instanceof ITopicsProvider) {
			throw new \RuntimeException('SummaryTask#visitProvider expects IHeadlineProvider');
		}
		return $provider->findTopics($this->getInput());
	}

	/**
	 * @inheritDoc
	 */
	public function canUseProvider(ILanguageModelProvider $provider): bool {
		return $provider instanceof ITopicsProvider;
	}

	/**
	 * @inheritDoc
	 */
	public function getType(): string {
		return self::TYPE;
	}
}