Skip to content

Commit

Permalink
wip: fixes phpdoc linter warnings/errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
stopfstedt committed Dec 5, 2023
1 parent eb35e6b commit 7b14f8a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
12 changes: 9 additions & 3 deletions classes/ilios_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

defined('MOODLE_INTERNAL') || die();

/** @global $CFG */
require_once($CFG->dirroot . '/lib/filelib.php');

/**
Expand All @@ -55,12 +54,19 @@ class ilios_client {
const API_URL = '/api/v3';

/**
* Constructor.
*
* @param string $iliosbaseurl The Ilios base URL
* @param curl $curl the cURL client
*/
public function __construct(protected string $iliosbaseurl, protected curl $curl) {
}

/**
* Returns the Ilios API base URL.
*
* @return string
*/
protected function get_api_base_url(): string {
return $this->iliosbaseurl . self::API_URL;
}
Expand All @@ -70,8 +76,8 @@ protected function get_api_base_url(): string {
*
* @param string $accesstoken the Ilios API access token
* @param string $entitytype the entity type of data to retrieve
* @param array|string $filters e.g. array('id' => 3)
* @param array|string $sortorder e.g. array('title' => "ASC")
* @param mixed $filters e.g. array('id' => 3)
* @param mixed $sortorder e.g. array('title' => "ASC")
* @param int $batchsize the maximum number of entities to retrieve per batch.
* @return array
* @throws moodle_exception
Expand Down
4 changes: 4 additions & 0 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements null_provider {

/**
* @inheritdoc
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
Expand Down
20 changes: 20 additions & 0 deletions tests/ilios_client_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,19 +374,34 @@ public function test_get_by_ids_fails_with_invalid_token(string $accesstoken): v
$this->ilios_client->get_by_ids($accesstoken, 'does_not_matter', 100);
}

/**
* Returns empty access tokens.
*
* @return array[]
*/
public static function empty_token_provider(): array {
return [
[''],
[' '],
];
}

/**
* Returns "corrupted" access tokens.
*
* @return array[]
*/
public static function corrupted_token_provider(): array {
return [
['AAAAA.BBBBB.CCCCCC'], // Has the right number of segments, but bunk payload.
];
}

/**
* Returns access tokens with invalid numbers of segments.
*
* @return array[]
*/
public static function invalid_token_provider(): array {
return [
['AAAA'], // Not enough segments.
Expand All @@ -395,6 +410,11 @@ public static function invalid_token_provider(): array {
];
}

/**
* Returns expired access tokens.
*
* @return array[]
*/
public static function expired_token_provider(): array {
$key = 'doesnotmatterhere';
$payload = ['exp' => (new DateTime('-2 days'))->getTimestamp()];
Expand Down

0 comments on commit 7b14f8a

Please sign in to comment.