Issue #36 - Fixed missing or inconsistent PhpDocs. Version is now: 1.0.1

This commit is contained in:
Daniel Thee Roperto
2016-10-04 14:47:00 +11:00
parent b12ef98170
commit c7b0cc2410
45 changed files with 915 additions and 177 deletions

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* calendar class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\calendar;
use auth_outage\local\outage;
@@ -23,7 +32,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/calendar/lib.php');
/**
* Manages outages in the calendar.
* calendar class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -33,7 +42,6 @@ require_once($CFG->dirroot.'/calendar/lib.php');
class calendar {
/**
* Private constructor, use static methods instead.
* @codeCoverageIgnore
*/
private function __construct() {
}

View File

@@ -14,6 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* outagedb class.
*
* The DB Context to manipulate Outages.
* It will also commit changes to the calendar as you change outages.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\dml;
use auth_outage\calendar\calendar;
@@ -29,6 +41,8 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/calendar/lib.php');
/**
* outagedb class.
*
* The DB Context to manipulate Outages.
* It will also commit changes to the calendar as you change outages.
*
@@ -40,7 +54,6 @@ require_once($CFG->dirroot.'/calendar/lib.php');
class outagedb {
/**
* Private constructor, use static methods instead.
* @codeCoverageIgnore
*/
private function __construct() {
}
@@ -63,6 +76,7 @@ class outagedb {
}
/**
* Gets an outage based on the given id.
* @param int $id Outage id to get.
* @return outage|null Returns the outage or null if not found.
* @throws coding_exception

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Toutage_created class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\event;
use core\event\base;
@@ -22,7 +31,7 @@ use moodle_url;
defined('MOODLE_INTERNAL') || die();
/**
* The auth_outage outage created class.
* outage_created class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>

View File

@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* outage_deleted class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\event;
use core\event\base;
@@ -22,7 +30,7 @@ use moodle_url;
defined('MOODLE_INTERNAL') || die();
/**
* The auth_outage outage deleted class.
* outage_deleted class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* outage_updated class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\event;
use core\event\base;
@@ -22,7 +31,7 @@ use moodle_url;
defined('MOODLE_INTERNAL') || die();
/**
* The auth_outage outage updated class.
* outage_updated class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* baseform class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\form;
use moodleform;
@@ -23,7 +32,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Outage base for forms, extends Moodle form to fix an issue in the validation method.
* baseform class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -32,16 +41,7 @@ require_once($CFG->libdir.'/formslib.php');
*/
abstract class baseform extends moodleform {
/**
* Validate the form.
*
* You almost always want to call {@link is_validated} instead of this
* because it calls {@link definition_after_data} first, before validating the form,
* which is what you want in 99% of cases.
*
* This is provided as a separate function for those special cases where
* you want the form validated before definition_after_data is called
* for example, to selectively add new elements depending on a no_submit_button press,
* but only when the form is valid when the no_submit_button is pressed,
* Validate the form. See MDL-56250.
*
* @param bool $validateonnosubmit optional, defaults to false. The default behaviour
* is NOT to validate the form when a no submit button has been pressed.
@@ -49,7 +49,6 @@ abstract class baseform extends moodleform {
*
* @return bool true if form data valid
* @SuppressWarnings(PHPMD) It is better to not refactor this method as it is linked to its parent functionality.
* @codeCoverageIgnore
*/
public function validate_defined_fields($validateonnosubmit = false) {
// One validation NOT is enough (if mocking). See parent method.

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* delete class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\form\outage;
defined('MOODLE_INTERNAL') || die();
@@ -23,7 +32,7 @@ require_once($CFG->libdir.'/formslib.php');
defined('MOODLE_INTERNAL') || die();
/**
* Outage delete confirmation form.
* delete class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* edit class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\form\outage;
use auth_outage\form\baseform;
@@ -25,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Outage form.
* edit class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -33,6 +42,9 @@ require_once($CFG->libdir.'/formslib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class edit extends baseform {
/**
* @var int Maximum number of characters for a title.
*/
const TITLE_MAX_CHARS = 100;
/**

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* finish class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\form\outage;
use moodleform;
@@ -23,7 +32,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Outage finish confirmation form.
* finish class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* cli_exception class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use Exception;
@@ -21,7 +30,7 @@ use Exception;
defined('MOODLE_INTERNAL') || die();
/**
* Exception executing CLI.
* cli_exception class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -73,7 +82,7 @@ class cli_exception extends Exception {
* cliexception constructor.
* @param string $message An explanation of the exception.
* @param int $code Exit code to be used.
* @param Exception|null $previous Another exception as reference.
* @param Exception $previous Another exception as reference or null.
*/
public function __construct($message, $code = 1, Exception $previous = null) {
parent::__construct('*ERROR* '.$message, $code, $previous = null);

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* clibase class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use coding_exception;
@@ -22,7 +31,7 @@ use core\session\manager;
defined('MOODLE_INTERNAL') || die();
/**
* Outage CLI base class.
* clibase class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -42,7 +51,7 @@ abstract class clibase {
/**
* clibase constructor.
* @param mixed[]|null $options The parameters to use or null to read from the command line.
* @param array $options The parameters to use.
* @throws cli_exception
*/
public function __construct(array $options = null) {

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* create class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use auth_outage\dml\outagedb;
@@ -23,7 +32,7 @@ use coding_exception;
defined('MOODLE_INTERNAL') || die();
/**
* Outage CLI to create outage.
* create class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -182,6 +191,10 @@ class create extends clibase {
return $id;
}
/**
* Sets the defaults to the outage to clone.
* @throws cli_exception
*/
private function clone_defaults() {
$id = $this->options['clone'];
if (!is_number($id) || ($id <= 0)) {
@@ -201,7 +214,7 @@ class create extends clibase {
/**
* Check parameters converting their type as needed.
* @param mixed $options Input options.
* @param array $options Input options.
* @return mixed Output options.
* @throws cli_exception
*/
@@ -248,7 +261,6 @@ class create extends clibase {
* @return string The converted parameter.
* @throws cli_exception
*/
private function merge_options_check_parameters_string_nonempty($option, $param) {
if (!is_string($option)) {
throw new cli_exception(get_string('clierrorinvalidvalue', 'auth_outage', ['param' => $param]),

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* finish class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use auth_outage\dml\outagedb;
@@ -22,7 +31,7 @@ use auth_outage\local\outage;
defined('MOODLE_INTERNAL') || die();
/**
* Outage CLI to finish an outage.
* finish class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* waitforit class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use auth_outage\dml\outagedb;
@@ -22,7 +31,7 @@ use auth_outage\local\outage;
defined('MOODLE_INTERNAL') || die();
/**
* Outage CLI to wait for an outage to start.
* waitforit class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* infopage class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\controllers;
use auth_outage\dml\outagedb;
@@ -29,7 +38,7 @@ use moodle_url;
defined('MOODLE_INTERNAL') || die();
/**
* Controller for the info page.
* infopage class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -49,7 +58,7 @@ class infopage {
/**
* infopage_controller constructor.
* @param mixed[]|null $params Parameters to use or null to get from Moodle API (request).
* @param array $params Parameters to use or null to get from Moodle API (request).
*/
public function __construct(array $params = null) {
if (is_null($params)) {
@@ -142,6 +151,7 @@ class infopage {
}
/**
* Gets the default template file to use for static info page.
* @return string The default template file to use for static info page.
*/
public static function get_defaulttemplatefile() {

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* outage class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local;
use coding_exception;
@@ -22,7 +31,7 @@ use stdClass;
defined('MOODLE_INTERNAL') || die();
/**
* Outage class with all information about one specific outage.
* outage class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -112,7 +121,7 @@ class outage {
/**
* outage constructor.
* @param stdClass|mixed[]|null The data for the outage.
* @param stdClass|array|null $data The data for the outage.
* @throws coding_exception
*/
public function __construct($data = null) {
@@ -248,7 +257,7 @@ class outage {
/**
* Returns the input string with all placeholders replaced.
* @param $str string Input string.
* @param string $str Input string.
* @return string Output string.
*/
private function replace_placeholders($str) {
@@ -267,6 +276,9 @@ class outage {
);
}
/**
* Converts the type of the fields as needed.
*/
private function adjust_field_types() {
// Adjust int fields.
$fs = ['createdby', 'id', 'lastmodified', 'modifiedby', 'starttime', 'stoptime', 'warntime', 'finished'];

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* outagelib class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local;
use auth_outage\dml\outagedb;
@@ -26,7 +35,7 @@ use stdClass;
defined('MOODLE_INTERNAL') || die();
/**
* Outage related functions.
* outagelib class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -34,6 +43,9 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class outagelib {
/**
* @var bool Flags in the page was already injected with the warning bar if needed.
*/
private static $injected = false;
/**

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* base_table class.
*
* @package auth_outage
* @author Daniel Thee Roperto <danielroperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\output\manage;
use auth_outage\local\outage;
@@ -26,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/tablelib.php');
/**
* Manage outages table base.
* base_table class.
*
* @package auth_outage
* @author Daniel Thee Roperto <danielroperto@catalyst-au.net>
@@ -34,6 +43,9 @@ require_once($CFG->libdir.'/tablelib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class base_table extends flexible_table {
/**
* @var int Autogenerated id.
*/
private static $autoid = 0;
/**

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* history_table class.
*
* @package auth_outage
* @author Daniel Thee Roperto <danielroperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\output\manage;
use auth_outage\local\outage;
@@ -23,7 +32,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/tablelib.php');
/**
* Manage outages table.
* history_table class.
*
* @package auth_outage
* @author Daniel Thee Roperto <danielroperto@catalyst-au.net>

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* planned_table class.
*
* @package auth_outage
* @author Daniel Thee Roperto <danielroperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\output\manage;
use auth_outage\local\outage;
@@ -25,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/tablelib.php');
/**
* Manage outages table.
* planned_table class.
*
* @package auth_outage
* @author Daniel Thee Roperto <danielroperto@catalyst-au.net>

View File

@@ -14,11 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* auth_outage_renderer class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\output;
use auth_outage\local\outage;
use auth_outage\output\manage\history_table;
use auth_outage\output\manage\planned_table;
use coding_exception;
use core_user;
use html_writer;
@@ -28,7 +35,7 @@ use plugin_renderer_base;
defined('MOODLE_INTERNAL') || die();
/**
* auth_outage auth_outage_renderer
* auth_outage_renderer class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
@@ -117,10 +124,8 @@ class renderer extends plugin_renderer_base {
* @param bool $preview If in preview mode the warning bar will not check if we are back online.
* @return string HTML of the warning bar.
* @throws coding_exception
* @SuppressWarnings("unused") because $viewbag is used inside require()
*/
public function render_warningbar(outage $outage, $time, $static, $preview) {
global $CFG;
if (!is_int($time) || ($time <= 0)) {
throw new coding_exception('$time is not an positive int or null.', $time);
}

View File

@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* update_static_page class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\task;
use auth_outage\local\controllers\infopage;
@@ -22,7 +31,8 @@ use core\task\scheduled_task;
defined('MOODLE_INTERNAL') || die();
/**
* Tasks information.
* update_static_page class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT