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

Class Github

lib/Datasource/Github.php:15–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected