1 <?php 2 // This file is part of Moodle - https://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <https://www.gnu.org/licenses/>. 16 17 namespace test_plugin\hook; 18 19 use Psr\EventDispatcher\StoppableEventInterface; 20 21 /** 22 * Fixture for testing of hooks. 23 * 24 * @package core 25 * @author Petr Skoda 26 * @copyright 2022 Open LMS 27 * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 28 */ 29 final class stoppablehook implements 30 StoppableEventInterface, 31 \core\hook\described_hook { 32 33 /** @var bool stoppable flag */ 34 private $stopped = false; 35 36 /** 37 * Hook description. 38 */ 39 public static function get_hook_description(): string { 40 return 'Test hook 2.'; 41 } 42 43 /** 44 * Stop other callbacks. 45 */ 46 public function stop(): void { 47 $this->stopped = true; 48 } 49 50 /** 51 * Indicates if callback propagation should stop. 52 */ 53 public function isPropagationStopped(): bool { 54 return $this->stopped; 55 } 56 57 /** 58 * List of tags that describe this hook. 59 * 60 * @return string[] 61 */ 62 public static function get_hook_tags(): array { 63 return ['test']; 64 } 65 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body