MCPcopy Create free account
hub / github.com/Rello/analytics / Github

Class Github

lib/Datasource/Github.php:14–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12use Psr\Log\LoggerInterface;
13
14class Github implements IDatasource, IReportTemplateProvider {
15 private const CACHE_TTL_SECONDS = 60;
16
17 private LoggerInterface $logger;
18 private IL10N $l10n;
19
20 public function __construct(
21 IL10N $l10n,
22 LoggerInterface $logger
23 ) {
24 $this->l10n = $l10n;
25 $this->logger = $logger;
26 }
27
28 /**
29 * @return string Display Name of the data source
30 */
31 public function getName(): string {
32 return 'GitHub';
33 }
34
35 /**
36 * @return int digit unique data source id
37 */
38 public function getId(): int {
39 return 3;
40 }
41
42 /**
43 * @return array available options of the data source
44 */
45 public function getTemplate(): array {
46 $template = array();
47 $template[] = ['id' => 'user', 'name' => 'GitHub Username', 'placeholder' => 'GitHub user'];
48 $template[] = ['id' => 'repository', 'name' => 'Repository / package', 'placeholder' => 'GitHub repository or package'];
49 $template[] = [
50 'id' => 'data',
51 'name' => 'Releases, Packages, Issues or PRs',
52 'placeholder' => 'release-' . $this->l10n->t('Releases') . '/package-' . $this->l10n->t('Packages') . '/issues-' . $this->l10n->t('Issues') . '/pulls-' . $this->l10n->t('Pull Requests'),
53 'type' => 'tf'
54 ];
55 $template[] = [
56 'id' => 'limit',
57 'name' => $this->l10n->t('Limit'),
58 'placeholder' => $this->l10n->t('Number of rows'),
59 'type' => 'number'
60 ];
61 $template[] = [
62 'id' => 'timestamp',
63 'name' => $this->l10n->t('Timestamp of data load'),
64 'placeholder' => 'false-' . $this->l10n->t('No') . '/true-' . $this->l10n->t('Yes'),
65 'type' => 'tf'
66 ];
67 $template[] = ['id' => 'section', 'name' => $this->l10n->t('More options'), 'type' => 'section'];
68 $template[] = [
69 'id' => 'filter',
70 'name' => $this->l10n->t('Filter release assets via extension'),
71 'placeholder' => 'zip,gz'

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected