Skip to content

Commit

Permalink
Make codechecker happy again
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Aug 20, 2024
1 parent 69bea39 commit d6eb54b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 32 deletions.
4 changes: 2 additions & 2 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class provider implements \core_privacy\local\metadata\provider,
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->link_subsystem('block', 'privacy:metadata:block');

return $collection;
Expand All @@ -63,7 +63,7 @@ public static function get_metadata(collection $collection) : collection {
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : \core_privacy\local\request\contextlist {
public static function get_contexts_for_userid(int $userid): \core_privacy\local\request\contextlist {
// This block doesn't know who information is stored against unless it
// is at the user context.
$contextlist = new \core_privacy\local\request\contextlist();
Expand Down
29 changes: 10 additions & 19 deletions lang/en/block_cohortspecifichtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,25 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/


$string['pluginname'] = 'Text (on cohorts)';

// Capabilities.
$string['cohortselection'] = 'Show to cohorts';
$string['cohortselection_help'] = 'The block will be only shown to the members of at least one selected cohort. This means that if you selected, for example, two cohorts and a user is only member of one of them, the block will be displayed to him as he is part of at least one selected cohort. This is equivalent to an OR connection.';
$string['cohortspecifichtml:addinstance'] = 'Add a new Text (on cohorts) block';
$string['cohortspecifichtml:myaddinstance'] = 'Add a new Text (on cohorts) block to Dashboard';
$string['cohortspecifichtml:viewalways'] = 'Always view the block';

// Settings.
$string['newhtmlcohortblock'] = 'New Text (on cohorts)';
$string['cohortselection'] = 'Show to cohorts';
$string['cohortselection_help'] = 'The block will be only shown to the members of at least one selected cohort. This means that if you selected, for example, two cohorts and a user is only member of one of them, the block will be displayed to him as he is part of at least one selected cohort. This is equivalent to an OR connection.';
$string['nocohorts'] = 'No cohorts are defined yet. Without any cohorts <strong>the block will not be visible</strong> to anybody, even if you have entered content above. <br/>
Cohorts can be managed in the <a href="{$a->url}">site administration</a>.';
$string['invertcohortselection'] = 'Invert the selection (hide it for the selected cohorts)';
$string['invertcohortselection_help'] = 'With this setting you can invert your selection. This means that the block will not be shown to members of the selected cohort but to everyone else.<br/>
Examples: <ul> <li>If a user matches at least one of the selected cohorts the block will not be displayed to him, even if he is also member of a cohort that is not selected.</li>
<li>If you have selected none of the cohorts and invert that, the block will be visible for <strong>all</strong> users.</li></ul>';
$string['newhtmlcohortblock'] = 'New Text (on cohorts)';
$string['nocohorts'] = 'No cohorts are defined yet. Without any cohorts <strong>the block will not be visible</strong> to anybody, even if you have entered content above. <br/>
Cohorts can be managed in the <a href="{$a->url}">site administration</a>.';
$string['notvisibletoall'] = '<br/>This block is <strong>not visible</strong> to <strong>any</strong> user.';
$string['notvisibletocohorts'] = '<br/><strong>Not</strong> visible to cohorts:';
$string['pluginname'] = 'Text (on cohorts)';
$string['privacy:metadata:block'] = 'The Text (on cohorts) block stores all of its data within the block subsystem.';
$string['resetcohortselection'] = 'Reset selection';
$string['resetcohortselection_help'] = 'If you enable and save this setting, the selection you made will be reset. This means that no cohorts are selected. Unfortunately, this workaround is needed, because unselecting all cohorts would not result in any change as an empty result is passed to the server. <br/>
If you open the block configuration again this setting is reset and won\'t be shown as there is nothing that could be reset anymore.';

// Badges / Information.
$string['notvisibletocohorts'] = '<br/><strong>Not</strong> visible to cohorts:';
$string['notvisibletoall'] = '<br/>This block is <strong>not visible</strong> to <strong>any</strong> user.';
$string['unrestricted'] = 'Unrestricted';
$string['visibletocohorts'] = '<br/><strong>Only</strong> visible to cohorts:';
$string['visibletoall'] = '<br/>This block is <strong>visible</strong> to <strong>all</strong> users.';

// Privacy.
$string['privacy:metadata:block'] = 'The Text (on cohorts) block stores all of its data within the block subsystem.';
$string['visibletocohorts'] = '<br/><strong>Only</strong> visible to cohorts:';
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function block_cohortspecifichtml_global_db_replace($search, $replace) {
* @param array $args The path (the part after the filearea and before the filename).
* @return array The itemid and the filepath inside the $args path, for the defined filearea.
*/
function block_cohortspecifichtml_get_path_from_pluginfile(string $filearea, array $args) : array {
function block_cohortspecifichtml_get_path_from_pluginfile(string $filearea, array $args): array {
// This block never has an itemid (the number represents the revision but it's not stored in database).
array_shift($args);

Expand Down
5 changes: 3 additions & 2 deletions tests/block_cohortspecifichtml_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
* @package block_cohortspecifichtml
* @copyright 2023 Alexander Bias <[email protected]>
* based on code from 2022 Open LMS (https://www.openlms.net/) Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* @coversDefaultClass \block_cohortspecifichtml
*/
class block_cohortspecifichtml_test extends \advanced_testcase {
final class block_cohortspecifichtml_test extends \advanced_testcase {
/**
* Tests instance files copying.
* @covers ::instance_copy
*/
public function test_instance_copy() {
public function test_instance_copy(): void {
global $USER;
$this->resetAfterTest();

Expand Down
16 changes: 8 additions & 8 deletions tests/privacy/privacy_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* based on code from 2018 Andrew Nicols <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class privacy_test extends \core_privacy\tests\provider_testcase {
final class privacy_test extends \core_privacy\tests\provider_testcase {
/**
* Get the list of standard format options for comparison.
*
Expand Down Expand Up @@ -166,7 +166,7 @@ protected function construct_course_page(\stdClass $course) {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_user_block() {
public function test_user_block(): void {
$this->resetAfterTest();

$title = 'Example title';
Expand Down Expand Up @@ -213,7 +213,7 @@ public function test_user_block() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_user_block_unconfigured() {
public function test_user_block_unconfigured(): void {
global $DB;

$this->resetAfterTest();
Expand Down Expand Up @@ -253,7 +253,7 @@ public function test_user_block_unconfigured() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_user_multiple_blocks_exported() {
public function test_user_multiple_blocks_exported(): void {
$this->resetAfterTest();

$title = 'Example title';
Expand Down Expand Up @@ -301,7 +301,7 @@ public function test_user_multiple_blocks_exported() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_course_blocks_not_exported() {
public function test_course_blocks_not_exported(): void {
$this->resetAfterTest();

$title = 'Example title';
Expand Down Expand Up @@ -330,7 +330,7 @@ public function test_course_blocks_not_exported() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_mixed_multiple_blocks_exported() {
public function test_mixed_multiple_blocks_exported(): void {
$this->resetAfterTest();

$title = 'Example title';
Expand Down Expand Up @@ -372,7 +372,7 @@ public function test_mixed_multiple_blocks_exported() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_get_users_in_context() {
public function test_get_users_in_context(): void {
$this->resetAfterTest();

$component = 'block_cohortspecifichtml';
Expand Down Expand Up @@ -419,7 +419,7 @@ public function test_get_users_in_context() {
* It is adopted from block_html and does not have a coverage tag there either. Thus, we set coversNothing.
* @coversNothing
*/
public function test_delete_data_for_users() {
public function test_delete_data_for_users(): void {
$this->resetAfterTest();

$component = 'block_cohortspecifichtml';
Expand Down

0 comments on commit d6eb54b

Please sign in to comment.