Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace GrowthExperiments\NewcomerTasks;
4
5use GrowthExperiments\NewcomerTasks\TaskType\StructuredTaskTypeHandler;
6use GrowthExperiments\NewcomerTasks\TaskType\TaskType;
7use MediaWiki\Linker\LinkTarget;
8use StatusValue;
9
10/**
11 * A shared interface for providing recommendations for articles.
12 * @see StructuredTaskTypeHandler::getRecommendationProvider()
13 */
14interface RecommendationProvider {
15
16    /**
17     * Get a recommendation (or an error message) for a given article.
18     * Recommendations are typically serialized and sent to the frontend logic which converts them
19     * to a wikitext or Parsoid HTML change.
20     * Recommendations are not guaranteed to exist for all pages; typically you should only try to
21     * fetch one for pages returned by TaskSuggester for the appropriate task type. Some task types
22     * don't have recommendations at all.
23     *
24     * @param LinkTarget $title
25     * @param TaskType $taskType This must be the task type matching the recommendation provider.
26     * @return Recommendation|StatusValue The recommendation, or a StatusValue on error.
27     *   The StatusValue's OK flag will determine whether this is an unexpected error that
28     *   should be sent to the production error logs, or something that can happen under normal
29     *   circumstances (e.g. the given article simply not having any recommendations).
30     */
31    public function get( LinkTarget $title, TaskType $taskType );
32
33}