From 7ad1539ed048c6247d9748f3767155783d5fc89d Mon Sep 17 00:00:00 2001
From: Tobias Reischmann <tobias.reischmann@wi.uni-muenster.de>
Date: Fri, 6 Sep 2019 11:29:29 +0200
Subject: [PATCH] Fix phpdoc problems (#85)

* Improved phpdoc
---
 .travis.yml                                   |  1 +
 adminlib.php                                  | 74 +++++++++++++++----
 classes/action.php                            | 28 ++++++-
 classes/entity/process.php                    | 31 ++++++--
 classes/entity/step_subplugin.php             | 10 ++-
 classes/entity/subplugin.php                  | 20 +++--
 classes/entity/trigger_subplugin.php          | 10 ++-
 classes/entity/workflow.php                   | 44 ++++++++---
 classes/event/process_proceeded.php           |  8 +-
 classes/event/process_rollback.php            |  7 ++
 classes/event/process_triggered.php           |  7 ++
 classes/form/form_step_instance.php           |  5 +-
 classes/form/form_trigger_instance.php        | 14 +++-
 classes/form/form_upload_workflow.php         |  5 +-
 classes/form/form_workflow_instance.php       |  7 +-
 .../backup/backup_lifecycle_workflow.php      | 21 ++++++
 .../backup/restore_lifecycle_workflow.php     | 16 ++++
 classes/local/data/manual_trigger_tool.php    | 23 ++++--
 classes/manager/backup_manager.php            |  7 ++
 classes/manager/delayed_courses_manager.php   | 30 +++++++-
 classes/manager/interaction_manager.php       | 16 +++-
 classes/manager/lib_manager.php               | 11 ++-
 classes/manager/process_data_manager.php      | 16 +++-
 classes/manager/process_manager.php           | 30 +++++++-
 classes/manager/settings_manager.php          | 17 ++++-
 classes/manager/step_manager.php              | 42 ++++++++++-
 classes/manager/subplugin_manager.php         | 25 ++++++-
 classes/manager/trigger_manager.php           | 49 ++++++++++--
 classes/manager/workflow_manager.php          | 61 ++++++++++++---
 classes/plugininfo/lifecyclestep.php          | 24 +++++-
 classes/plugininfo/lifecycletrigger.php       | 23 +++++-
 classes/processor.php                         | 26 ++++---
 .../response/step_interactive_response.php    | 12 +++
 classes/response/step_response.php            | 11 +++
 classes/response/trigger_response.php         | 11 +++
 classes/settings_type.php                     | 10 ++-
 .../active_automatic_workflows_table.php      | 20 ++++-
 .../table/active_manual_workflows_table.php   | 16 ++++
 classes/table/active_processes_table.php      | 22 +++++-
 classes/table/active_workflows_table.php      | 11 ++-
 classes/table/course_backups_table.php        | 30 ++++++--
 classes/table/deactivated_workflows_table.php | 20 +++--
 classes/table/interaction_attention_table.php | 25 +++++--
 classes/table/interaction_remaining_table.php | 35 ++++++++-
 classes/table/interaction_table.php           | 26 +++++--
 classes/table/step_table.php                  | 50 ++++++++++---
 classes/table/workflow_definition_table.php   | 22 +++++-
 classes/table/workflow_table.php              | 33 +++++++--
 classes/task/lifecycle_task.php               | 16 ++++
 classes/view_controller.php                   | 13 +++-
 db/install.php                                | 29 --------
 db/upgrade.php                                | 11 +++
 lib.php                                       |  3 +
 renderer.php                                  | 13 +++-
 step/createbackup/db/upgrade.php              | 14 +++-
 .../lang/de/lifecyclestep_createbackup.php    |  3 +-
 .../lang/en/lifecyclestep_createbackup.php    |  3 +-
 step/createbackup/lib.php                     | 41 ++++++++--
 step/createbackup/version.php                 |  3 +-
 step/deletecourse/db/upgrade.php              | 16 +++-
 .../lang/de/lifecyclestep_deletecourse.php    |  3 +-
 .../lang/en/lifecyclestep_deletecourse.php    |  3 +-
 step/deletecourse/lib.php                     | 30 +++++++-
 step/deletecourse/version.php                 |  3 +-
 step/duplicate/classes/form_duplicate.php     | 17 +++--
 step/duplicate/db/access.php                  |  3 +-
 step/duplicate/interactionlib.php             | 26 +++++--
 .../lang/de/lifecyclestep_duplicate.php       |  3 +-
 .../lang/en/lifecyclestep_duplicate.php       |  3 +-
 step/duplicate/lib.php                        | 38 +++++++++-
 step/duplicate/version.php                    |  5 +-
 step/email/db/access.php                      |  3 +-
 step/email/interactionlib.php                 | 26 +++++--
 step/email/lang/de/lifecyclestep_email.php    |  3 +-
 step/email/lang/en/lifecyclestep_email.php    |  3 +-
 step/email/lib.php                            | 50 +++++++++++--
 step/email/version.php                        |  3 +-
 step/interactionlib.php                       | 20 ++++-
 step/lib.php                                  | 20 +++--
 tests/active_workflow_is_manual_test.php      | 18 +++++
 .../active_workflow_sortindex_updown_test.php |  9 +++
 tests/backup_and_restore_workflow_test.php    | 13 ++++
 tests/backup_manager_test.php                 | 15 +++-
 tests/behat/behat_tool_lifecycle.php          | 58 ++++++++-------
 tests/generator/lib.php                       | 38 ++++++++--
 tests/manual_trigger_tools_test.php           | 27 ++++++-
 tests/manually_triggered_process_test.php     | 21 ++++++
 .../persistence/persist_process_data_test.php | 18 ++++-
 tests/persistence/persist_process_test.php    | 18 ++++-
 tests/persistence/persist_step_test.php       | 19 ++++-
 tests/persistence/persist_workflow_test.php   | 13 +++-
 tests/process_status_message_test.php         | 19 +++++
 tests/settings_manager_test.php               | 20 ++++-
 tests/workflow_actions_testcase.php           | 17 ++++-
 ...rkflow_activate_disable_duplicate_test.php |  9 +++
 .../lang/de/lifecycletrigger_categories.php   |  5 +-
 .../lang/en/lifecycletrigger_categories.php   |  5 +-
 trigger/categories/lib.php                    | 37 ++++++++--
 trigger/categories/tests/generator/lib.php    | 12 ++-
 trigger/categories/tests/trigger_test.php     | 24 +++++-
 trigger/categories/version.php                |  3 +-
 trigger/delayedcourses/db/install.php         |  7 +-
 .../de/lifecycletrigger_delayedcourses.php    |  5 +-
 .../en/lifecycletrigger_delayedcourses.php    |  5 +-
 trigger/delayedcourses/lib.php                | 23 ++++--
 .../delayedcourses/tests/generator/lib.php    |  8 ++
 trigger/delayedcourses/tests/trigger_test.php | 21 ++++--
 trigger/delayedcourses/version.php            |  4 +-
 trigger/lib.php                               | 45 ++++++++---
 .../lang/de/lifecycletrigger_manual.php       |  3 +-
 .../lang/en/lifecycletrigger_manual.php       |  3 +-
 trigger/manual/lib.php                        | 22 ++++--
 trigger/manual/version.php                    |  3 +-
 trigger/sitecourse/db/install.php             |  6 +-
 .../lang/de/lifecycletrigger_sitecourse.php   |  3 +-
 .../lang/en/lifecycletrigger_sitecourse.php   |  3 +-
 trigger/sitecourse/lib.php                    | 24 ++++--
 trigger/sitecourse/tests/generator/lib.php    |  8 ++
 trigger/sitecourse/tests/trigger_test.php     | 19 ++++-
 trigger/sitecourse/version.php                |  3 +-
 .../lang/de/lifecycletrigger_specificdate.php |  5 +-
 .../lang/en/lifecycletrigger_specificdate.php |  5 +-
 trigger/specificdate/lib.php                  | 50 ++++++++++---
 trigger/specificdate/version.php              |  3 +-
 .../de/lifecycletrigger_startdatedelay.php    |  3 +-
 .../en/lifecycletrigger_startdatedelay.php    |  3 +-
 trigger/startdatedelay/lib.php                | 40 ++++++++--
 .../startdatedelay/tests/generator/lib.php    |  9 +++
 trigger/startdatedelay/tests/trigger_test.php | 17 ++++-
 trigger/startdatedelay/version.php            |  3 +-
 version.php                                   |  1 +
 131 files changed, 1811 insertions(+), 450 deletions(-)
 delete mode 100644 db/install.php

diff --git a/.travis.yml b/.travis.yml
index 0ae6601..ed0c41f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -66,6 +66,7 @@ jobs:
       install:
       - moodle-plugin-ci install --no-init
       script:
+      - moodle-plugin-ci phpdoc
       - moodle-plugin-ci phplint
       - moodle-plugin-ci phpcpd
       - moodle-plugin-ci phpmd
diff --git a/adminlib.php b/adminlib.php
index 6171d60..90ea5a1 100644
--- a/adminlib.php
+++ b/adminlib.php
@@ -14,6 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Admin lib providing multiple classes for admin settings.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle;
 
 use tool_lifecycle\entity\trigger_subplugin;
@@ -50,6 +57,7 @@ class admin_page_active_processes extends \admin_externalpage {
     /**
      * The constructor - calls parent constructor
      *
+     * @throws \moodle_exception
      */
     public function __construct() {
         $url = new \moodle_url('/admin/tool/lifecycle/activeprocesses.php');
@@ -67,6 +75,11 @@ class admin_page_active_processes extends \admin_externalpage {
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class admin_page_deactivated_workflows extends \admin_externalpage {
+    /**
+     * admin_page_deactivated_workflows constructor.
+     * @throws \coding_exception
+     * @throws \moodle_exception
+     */
     public function __construct() {
         $url = new \moodle_url('/admin/tool/lifecycle/deactivatedworkflows.php');
         parent::__construct('tool_lifecycle_deactivatedworkflows',
@@ -87,6 +100,7 @@ class admin_page_course_backups extends \admin_externalpage {
     /**
      * The constructor - calls parent constructor
      *
+     * @throws \moodle_exception
      */
     public function __construct() {
         $url = new \moodle_url('/admin/tool/lifecycle/coursebackups.php');
@@ -108,6 +122,7 @@ class admin_page_sublugins extends \admin_externalpage {
     /**
      * The constructor - calls parent constructor
      *
+     * @throws \moodle_exception
      */
     public function __construct() {
         $url = new \moodle_url('/admin/tool/lifecycle/adminsettings.php');
@@ -131,6 +146,7 @@ class admin_settings {
 
     /**
      * Constructor for this subplugin settings
+     * @throws \moodle_exception
      */
     public function __construct() {
         global $PAGE;
@@ -141,6 +157,7 @@ class admin_settings {
 
     /**
      * Write the HTML for the submission plugins table.
+     * @throws \moodle_exception
      */
     private function view_plugins_table() {
         global $OUTPUT, $PAGE;
@@ -188,6 +205,7 @@ class admin_settings {
      * Write the HTML for the add workflow form.
      *
      * @param form_workflow_instance $form
+     * @throws \coding_exception
      */
     private function view_workflow_instance_form($form) {
         global $OUTPUT;
@@ -205,7 +223,7 @@ class admin_settings {
     /**
      * Redirect to workflow details page.
      *
-     * @param $workflowid int id of the workflow.
+     * @param int $workflowid Id of the workflow.
      * @throws \moodle_exception
      */
     private function view_workflow_details($workflowid) {
@@ -233,6 +251,11 @@ class admin_settings {
 
     /**
      * Check this user has permission to edit the subplugin settings
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \moodle_exception
+     * @throws \require_login_exception
+     * @throws \required_capability_exception
      */
     private function check_permissions() {
         // Check permissions.
@@ -243,7 +266,13 @@ class admin_settings {
 
     /**
      * This is the entry point for this controller class.
+     * @param string $action Action string (see {@link action}).
+     * @param int $workflowid Id of the workflow.
+     * @throws \coding_exception
+     * @throws \dml_exception
      * @throws \moodle_exception
+     * @throws \require_login_exception
+     * @throws \required_capability_exception
      */
     public function execute($action, $workflowid) {
         global $PAGE;
@@ -340,6 +369,9 @@ class workflow_settings {
 
     /**
      * Constructor for this subplugin settings
+     * @param int $workflowid Id of the workflow.
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function __construct($workflowid) {
         global $PAGE;
@@ -353,6 +385,7 @@ class workflow_settings {
 
     /**
      * Write the HTML for the submission plugins table.
+     * @throws \moodle_exception
      */
     private function view_plugins_table() {
         global $OUTPUT, $PAGE;
@@ -393,7 +426,8 @@ class workflow_settings {
     /**
      * Write the HTML for the step instance form.
      *
-     * @param $form \moodleform form to be displayed.
+     * @param \moodleform $form Form to be displayed.
+     * @throws \coding_exception
      */
     private function view_step_instance_form($form) {
         $workflow = workflow_manager::get_workflow($this->workflowid);
@@ -405,7 +439,8 @@ class workflow_settings {
     /**
      * Write the HTML for the trigger instance form.
      *
-     * @param $form \moodleform form to be displayed.
+     * @param \moodleform $form Form to be displayed.
+     * @throws \coding_exception
      */
     private function view_trigger_instance_form($form) {
         $workflow = workflow_manager::get_workflow($this->workflowid);
@@ -417,8 +452,8 @@ class workflow_settings {
     /**
      * Write the HTML for subplugin instance form with specific header.
      *
-     * @param $form \moodleform form to be displayed.
-     * @param $header string header of the form.
+     * @param \moodleform $form Form to be displayed.
+     * @param string $header Header of the form.
      */
     private function view_instance_form($form, $header) {
         global $OUTPUT;
@@ -452,6 +487,11 @@ class workflow_settings {
 
     /**
      * Check this user has permission to edit the subplugin settings
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \moodle_exception
+     * @throws \require_login_exception
+     * @throws \required_capability_exception
      */
     private function check_permissions() {
         // Check permissions.
@@ -462,10 +502,11 @@ class workflow_settings {
 
     /**
      * This is the entry point for this controller class.
-     * @param $action string action string to be executed.
-     * @param $subpluginid int id of the subplugin associated.
-     * @param $workflowid int id of the workflow associated.
+     * @param string $action Action string to be executed.
+     * @param int $subpluginid Id of the subplugin associated.
+     * @param int $workflowid Id of the workflow associated.
      * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function execute($action, $subpluginid, $workflowid) {
         $this->check_permissions();
@@ -495,6 +536,7 @@ class workflow_settings {
      *
      * @return bool True, if no further action handling or output should be conducted.
      * @throws \coding_exception
+     * @throws \moodle_exception
      */
     private function handle_trigger_instance_form() {
         global $PAGE;
@@ -540,11 +582,12 @@ class workflow_settings {
     /**
      * Retrieves the relevant parameters for the trigger instance form from the sent params.
      * Thereby it store the data in the given parameters.
-     * @param $triggertomodify int id of the trigger instance to be modified.
-     * @param $subpluginname string name of the subplugin, the trigger instance belongs to.
-     * @param $triggersettings array settings of the trigger instance.
+     * @param int $triggertomodify Id of the trigger instance to be modified.
+     * @param string $subpluginname Name of the subplugin, the trigger instance belongs to.
+     * @param array $triggersettings Settings of the trigger instance.
      * @return bool
      * @throws \coding_exception
+     * @throws \dml_exception
      */
     private function retrieve_trigger_parameters(&$triggertomodify, &$subpluginname, &$triggersettings) {
         if ($triggerid = optional_param('subplugin', null, PARAM_INT)) {
@@ -568,6 +611,8 @@ class workflow_settings {
      * Handles actions for the trigger instance form and causes related forms to be rendered.
      *
      * @return bool True, if no further action handling or output should be conducted.
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     private function handle_step_instance_form() {
         global $PAGE;
@@ -610,11 +655,12 @@ class workflow_settings {
     /**
      * Retrieves the relevant parameters for the step instance form from the sent params.
      * Thereby it store the data in the given parameters.
-     * @param $steptomodify int id of the step instance to be modified.
-     * @param $subpluginname string name of the subplugin, the step instance belongs to.
-     * @param $stepsettings array settings of the step instance.
+     * @param int $steptomodify Id of the step instance to be modified.
+     * @param string $subpluginname Name of the subplugin, the step instance belongs to.
+     * @param array $stepsettings Settings of the step instance.
      * @return bool
      * @throws \coding_exception
+     * @throws \dml_exception
      */
     private function retrieve_step_parameters(&$steptomodify, &$subpluginname, &$stepsettings) {
         if ($stepid = optional_param('subplugin', null, PARAM_INT)) {
diff --git a/classes/action.php b/classes/action.php
index ce30634..85150f3 100644
--- a/classes/action.php
+++ b/classes/action.php
@@ -14,6 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Delivers all available action names throughout the plugin.
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle;
 
 defined('MOODLE_INTERNAL') || die();
@@ -21,30 +27,48 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Delivers all available action names throughout the plugin.
  * @package    tool_lifecycle
- * @group      tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class action {
 
-    const UP_TRIGGER = 'enable';
+    /** @var string Moving a trigger one position up. */
+    const UP_TRIGGER = 'up_trigger';
+    /** @var string Moving a trigger one position down. */
     const DOWN_TRIGGER = 'down_trigger';
+    /** @var string Moving a step one position up. */
     const UP_STEP = 'up_step';
+    /** @var string Moving a step one position down. */
     const DOWN_STEP = 'down_step';
+    /** @var string Moving a workflow one position up. */
     const UP_WORKFLOW = 'up_workflow';
+    /** @var string Moving a workflow one position down. */
     const DOWN_WORKFLOW = 'down_workflow';
+    /** @var string View the step instance form. */
     const STEP_INSTANCE_FORM = 'step_instance_form';
+    /** @var string View the trigger instance form. */
     const TRIGGER_INSTANCE_FORM = 'trigger_instance_form';
+    /** @var string Delete a trigger instance. */
     const TRIGGER_INSTANCE_DELETE = 'trigger_instance_delete';
+    /** @var string Delete a step instance. */
     const STEP_INSTANCE_DELETE = 'step_instance_delete';
+    /** @var string View the workflow instance form. */
     const WORKFLOW_INSTANCE_FROM = 'workflow_instance_form';
+    /** @var string Upload a workflow definition file. */
     const WORKFLOW_UPLOAD_FROM = 'workflow_upload_form';
+    /** @var string Create a backup for a workflow. */
     const WORKFLOW_BACKUP = 'workflow_instance_backup';
+    /** @var string Delete a workflow. */
     const WORKFLOW_DELETE = 'workflow_instance_delete';
+    /** @var string Duplicate a workflow. */
     const WORKFLOW_DUPLICATE = 'workflow_instance_duplicate';
+    /** @var string Activate a workflow. */
     const WORKFLOW_ACTIVATE = 'workflow_instance_activate';
+    /** @var string Disable e a workflow. */
     const WORKFLOW_DISABLE = 'workflow_instance_disable';
+    /** @var string Abort and disable a workflow. */
     const WORKFLOW_ABORTDISABLE = 'workflow_instance_abortdisable';
+    /** @var string Abort a workflow. */
     const WORKFLOW_ABORT = 'workflow_instance_abort';
 
 }
\ No newline at end of file
diff --git a/classes/entity/process.php b/classes/entity/process.php
index a0ce049..5a21cb0 100644
--- a/classes/entity/process.php
+++ b/classes/entity/process.php
@@ -14,6 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Life Cycle Process class
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\entity;
 
 defined('MOODLE_INTERNAL') || die();
@@ -25,27 +32,35 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class process {
 
-    /** int id of the process*/
+    /** @var int $id Id of the process*/
     public $id;
 
-    /** int id of the workflow */
+    /** @var int $workflowid Id of the workflow */
     public $workflowid;
 
-    /** int id of the course*/
+    /** @var int $courseid Id of the course*/
     public $courseid;
 
-    /** bool true if course is in status waiting*/
+    /** @var bool $waiting True if course is in status waiting*/
     public $waiting;
 
-    /** int sortindex of the step within the workflow */
+    /** @var int $stepindex Sortindex of the step within the workflow */
     public $stepindex;
 
-    /** timestamp date the process was moved to the current step instance */
+    /** @var /timestamp $timestepchanged Date the process was moved to the current step instance */
     public $timestepchanged;
 
+    /**
+     * Process constructor.
+     * @param int $id Id of the process.
+     * @param int $workflowid Id of the workflow.
+     * @param int $courseid Id of the course.
+     * @param int $stepindex Sortindex of the step within the workflow.
+     * @param bool $waiting True if course is in status waiting.
+     * @param null $timestepchanged Date the process was moved to the current step instance.
+     */
     private function __construct($id, $workflowid, $courseid, $stepindex, $waiting = false, $timestepchanged = null) {
         $this->id = $id;
         $this->workflowid = $workflowid;
@@ -61,7 +76,7 @@ class process {
 
     /**
      * Creates a Life Cycle Process from a db record.
-     * @param $record
+     * @param object $record Data object.
      * @return process
      */
     public static function from_record($record) {
diff --git a/classes/entity/step_subplugin.php b/classes/entity/step_subplugin.php
index d75dd56..4e4ce20 100644
--- a/classes/entity/step_subplugin.php
+++ b/classes/entity/step_subplugin.php
@@ -14,6 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Subplugin class
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\entity;
 
 defined('MOODLE_INTERNAL') || die();
@@ -25,12 +32,11 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class step_subplugin extends subplugin {
 
     /**
      * Creates a subplugin from a db record.
-     * @param $record
+     * @param object $record Data object.
      * @return step_subplugin
      */
     public static function from_record($record) {
diff --git a/classes/entity/subplugin.php b/classes/entity/subplugin.php
index b968b6b..ca8f51c 100644
--- a/classes/entity/subplugin.php
+++ b/classes/entity/subplugin.php
@@ -14,6 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Subplugin class
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\entity;
 
 defined('MOODLE_INTERNAL') || die();
@@ -25,28 +32,27 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 abstract class subplugin{
 
-    /** int Id of subplugin */
+    /** @var int $id Id of subplugin */
     public $id;
 
-    /** string instancename of the step*/
+    /** @var string $instancename Instancename of the step*/
     public $instancename;
 
-    /** int id of the workflow this step belongs to*/
+    /** @var int $workflowid Id of the workflow this step belongs to*/
     public $workflowid;
 
-    /** string name of subplugin */
+    /** @var string $subpluginname Name of subplugin */
     public $subpluginname;
 
-    /** int sort index, which defines the order,
+    /** @var int $sortindex Sort index, which defines the order,
      * in which the steps wihtin a workflow are executed*/
     public $sortindex;
 
     /**
      * Creates a subplugin with subpluginname and optional id.
-     * @oaram string $instancename name of the subplugin instance
+     * @param string $instancename name of the subplugin instance
      * @param string $subpluginname name of the subplugin
      * @param int $workflowid id of the workflow the subplugin belongs to
      * @param int $id id of the subplugin
diff --git a/classes/entity/trigger_subplugin.php b/classes/entity/trigger_subplugin.php
index 73b2acf..9d50937 100644
--- a/classes/entity/trigger_subplugin.php
+++ b/classes/entity/trigger_subplugin.php
@@ -14,6 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Trigger subplugin class
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\entity;
 
 defined('MOODLE_INTERNAL') || die();
@@ -25,12 +32,11 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class trigger_subplugin extends subplugin{
 
     /**
      * Creates a subplugin from a db record.
-     * @param $record
+     * @param object $record Data object.
      * @return trigger_subplugin
      */
     public static function from_record($record) {
diff --git a/classes/entity/workflow.php b/classes/entity/workflow.php
index 43f34f3..f442da1 100644
--- a/classes/entity/workflow.php
+++ b/classes/entity/workflow.php
@@ -14,6 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Life Cycle Workflow class
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\entity;
 
 defined('MOODLE_INTERNAL') || die();
@@ -25,40 +32,53 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class workflow {
 
-    /** int id of the workflow*/
+    /** @var int $id Id of the workflow. */
     public $id;
 
-    /** title of the workflow */
+    /** @var string @title Title of the workflow. */
     public $title;
 
-    /** timestamp the workflow was set active */
+    /** @var /timestamp $timeactive Time the workflow was set active. */
     public $timeactive;
 
-    /** timestamp the workflow was deactivated */
+    /** @var /timestamp $timedeactive Time the workflow was deactivated. */
     public $timedeactive;
 
-    /** int sort index of all active workflows */
+    /** @var int $sortindex Sort index of all active workflows. */
     public $sortindex;
 
-    /** bool|null true if workflow is manually triggered*/
+    /** @var bool|null $manual True if workflow is manually triggered. */
     public $manual;
 
-    /** title that is displayed to users */
+    /** @var string $displaytitle Title that is displayed to users. */
     public $displaytitle;
 
-    /** @var int the delay in case of rollback */
+    /** @var int $rollbackdelay The delay in case of rollback. */
     public $rollbackdelay;
 
-    /** @var int the delay in case of finished course */
+    /** @var int $finishdelay The delay in case of finished course. */
     public $finishdelay;
 
+    /** @var bool $delayforallworkflows True if a delay counts for all workflows. */
     public $delayforallworkflows;
 
+    /**
+     * Workflow constructor.
+     * @param int $id Id of the workflow.
+     * @param string $title Title of the workflow.
+     * @param /timestamp $timeactive Time the workflow was set active.
+     * @param /timestamp $timedeactive Time the workflow was deactivated.
+     * @param int $sortindex Sort index of all active workflows.
+     * @param bool $manual True if workflow is manually triggered.
+     * @param string $displaytitle Title that is displayed to users.
+     * @param int $rollbackdelay The delay in case of rollback.
+     * @param int $finishdelay The delay in case of finished course.
+     * @param bool $delayforallworkflows True if a delay counts for all workflows.
+     */
     private function __construct($id, $title, $timeactive, $timedeactive, $sortindex, $manual, $displaytitle,
-            $rollbackdelay, $finishdelay, $delayforallworkflows) {
+                                 $rollbackdelay, $finishdelay, $delayforallworkflows) {
         $this->id = $id;
         $this->title = $title;
         $this->timeactive = $timeactive;
@@ -73,7 +93,7 @@ class workflow {
 
     /**
      * Creates a Workflow from a DB record.
-     * @param $record
+     * @param object $record Data object.
      * @return workflow
      */
     public static function from_record($record) {
diff --git a/classes/event/process_proceeded.php b/classes/event/process_proceeded.php
index a05a116..47a9775 100644
--- a/classes/event/process_proceeded.php
+++ b/classes/event/process_proceeded.php
@@ -21,7 +21,6 @@
  * @copyright  2019 Justus Dieckmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\event;
 
 use moodle_url;
@@ -52,6 +51,8 @@ class process_proceeded extends \core\event\base {
      *
      * @param process $process
      * @return process_proceeded
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function event_from_process($process) {
         $data = array(
@@ -95,6 +96,7 @@ class process_proceeded extends \core\event\base {
      * Return localised event name.
      *
      * @return string
+     * @throws \coding_exception
      */
     public static function get_name() {
         return get_string('process_proceeded_event', 'tool_lifecycle');
@@ -104,6 +106,7 @@ class process_proceeded extends \core\event\base {
      * Returns relevant URL.
      *
      * @return moodle_url
+     * @throws \moodle_exception
      */
     public function get_url() {
         return new moodle_url('/admin/tool/lifecycle/view.php');
@@ -134,6 +137,9 @@ class process_proceeded extends \core\event\base {
         }
     }
 
+    /**
+     * Implementation of get_other_mapping.
+     */
     public static function get_other_mapping() {
         // No backup and restore.
         return false;
diff --git a/classes/event/process_rollback.php b/classes/event/process_rollback.php
index a5be9dc..85331a6 100644
--- a/classes/event/process_rollback.php
+++ b/classes/event/process_rollback.php
@@ -51,6 +51,8 @@ class process_rollback extends \core\event\base {
      *
      * @param process $process
      * @return process_rollback
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function event_from_process($process) {
         $data = array(
@@ -94,6 +96,7 @@ class process_rollback extends \core\event\base {
      * Return localised event name.
      *
      * @return string
+     * @throws \coding_exception
      */
     public static function get_name() {
         return get_string('process_rollback_event', 'tool_lifecycle');
@@ -103,6 +106,7 @@ class process_rollback extends \core\event\base {
      * Returns relevant URL.
      *
      * @return moodle_url
+     * @throws \moodle_exception
      */
     public function get_url() {
         return new moodle_url('/admin/tool/lifecycle/view.php');
@@ -133,6 +137,9 @@ class process_rollback extends \core\event\base {
         }
     }
 
+    /**
+     * Implementation of get_other_mapping.
+     */
     public static function get_other_mapping() {
         // No backup and restore.
         return false;
diff --git a/classes/event/process_triggered.php b/classes/event/process_triggered.php
index 4155924..ab25e44 100644
--- a/classes/event/process_triggered.php
+++ b/classes/event/process_triggered.php
@@ -50,6 +50,8 @@ class process_triggered extends \core\event\base {
      *
      * @param process $process
      * @return process_triggered
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function event_from_process($process) {
         $data = array(
@@ -90,6 +92,7 @@ class process_triggered extends \core\event\base {
      * Return localised event name.
      *
      * @return string
+     * @throws \coding_exception
      */
     public static function get_name() {
         return get_string('process_triggered_event', 'tool_lifecycle');
@@ -99,6 +102,7 @@ class process_triggered extends \core\event\base {
      * Returns relevant URL.
      *
      * @return moodle_url
+     * @throws \moodle_exception
      */
     public function get_url() {
         return new moodle_url('/admin/tool/lifecycle/view.php');
@@ -125,6 +129,9 @@ class process_triggered extends \core\event\base {
         }
     }
 
+    /**
+     * Implementation of get_other_mapping.
+     */
     public static function get_other_mapping() {
         // No backup and restore.
         return false;
diff --git a/classes/form/form_step_instance.php b/classes/form/form_step_instance.php
index 010558d..c098a66 100644
--- a/classes/form/form_step_instance.php
+++ b/classes/form/form_step_instance.php
@@ -21,7 +21,6 @@
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\form;
 
 use tool_lifecycle\action;
@@ -36,10 +35,12 @@ require_once($CFG->libdir . '/formslib.php');
 
 /**
  * Provides a form to modify a step instance
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class form_step_instance extends \moodleform {
 
-
     /**
      * @var step_subplugin
      */
diff --git a/classes/form/form_trigger_instance.php b/classes/form/form_trigger_instance.php
index 3ca5047..4847b0b 100644
--- a/classes/form/form_trigger_instance.php
+++ b/classes/form/form_trigger_instance.php
@@ -21,7 +21,6 @@
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\form;
 
 use tool_lifecycle\action;
@@ -37,10 +36,12 @@ require_once($CFG->libdir . '/formslib.php');
 
 /**
  * Provides a form to modify a step instance
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class form_trigger_instance extends \moodleform {
 
-
     /**
      * @var trigger_subplugin
      */
@@ -74,7 +75,7 @@ class form_trigger_instance extends \moodleform {
      * @param trigger_subplugin $trigger step entity.
      * @param string $subpluginname name of the trigger subplugin.
      * @param array $settings settings of the step.
-     * @throws \moodle_exception if neither step nor subpluginname are set.
+     * @throws \coding_exception
      */
     public function __construct($url, $workflowid, $trigger = null, $subpluginname = null, $settings = null) {
         $this->trigger = $trigger;
@@ -189,6 +190,13 @@ class form_trigger_instance extends \moodleform {
         }
     }
 
+    /** Validate the form.
+     * @param array $data array of ("fieldname"=>value) of submitted data
+     * @param array $files array of uploaded files "element_name"=>tmp_file_path
+     * @return array of "element_name"=>"error_description" if there are errors,
+     *         or an empty array if everything is OK (true allowed for backwards compatibility too).
+     * @throws \coding_exception
+     */
     public function validation($data, $files) {
         $error = parent::validation($data, $files);
         if (empty($data['instancename'])) {
diff --git a/classes/form/form_upload_workflow.php b/classes/form/form_upload_workflow.php
index 04d785e..8573c0d 100644
--- a/classes/form/form_upload_workflow.php
+++ b/classes/form/form_upload_workflow.php
@@ -23,14 +23,15 @@
  */
 namespace tool_lifecycle\form;
 
-use tool_lifecycle\entity\workflow;
-
 defined('MOODLE_INTERNAL') || die();
 
 require_once($CFG->libdir . '/formslib.php');
 
 /**
  * Provides a form to modify a workflow instance
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class form_upload_workflow extends \moodleform {
 
diff --git a/classes/form/form_workflow_instance.php b/classes/form/form_workflow_instance.php
index afaffd2..71e934d 100644
--- a/classes/form/form_workflow_instance.php
+++ b/classes/form/form_workflow_instance.php
@@ -31,10 +31,12 @@ require_once($CFG->libdir . '/formslib.php');
 
 /**
  * Provides a form to modify a workflow instance
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class form_workflow_instance extends \moodleform {
 
-
     /**
      * @var workflow
      */
@@ -42,9 +44,8 @@ class form_workflow_instance extends \moodleform {
 
     /**
      * Constructor
-     * @param \moodle_url $url.
+     * @param \moodle_url $url Url of the page.
      * @param workflow $workflow workflow entity.
-     * @throws \moodle_exception if neither step nor subpluginname are set.
      */
     public function __construct($url, $workflow) {
         $this->workflow = $workflow;
diff --git a/classes/local/backup/backup_lifecycle_workflow.php b/classes/local/backup/backup_lifecycle_workflow.php
index 46a172d..1abe072 100644
--- a/classes/local/backup/backup_lifecycle_workflow.php
+++ b/classes/local/backup/backup_lifecycle_workflow.php
@@ -14,6 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Class to backup a workflow.
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\local\backup;
 
 use tool_lifecycle\entity\step_subplugin;
@@ -27,6 +33,12 @@ use tool_lifecycle\settings_type;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Class to backup a workflow.
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class backup_lifecycle_workflow {
 
     /** @var $workflow workflow */
@@ -40,6 +52,11 @@ class backup_lifecycle_workflow {
     /** @var $tempfilename string */
     private $tempfilename;
 
+    /**
+     * backup_lifecycle_workflow constructor.
+     * @param int $workflowid Id of the workflow a backup should be created for.
+     * @throws \dml_exception
+     */
     public function __construct($workflowid) {
         $this->workflow = workflow_manager::get_workflow($workflowid);
         $this->steps = step_manager::get_step_instances($workflowid);
@@ -137,6 +154,10 @@ class backup_lifecycle_workflow {
         }
     }
 
+    /**
+     * Get temporary filename
+     * @return string
+     */
     public function get_temp_filename() {
         return $this->tempfilename;
     }
diff --git a/classes/local/backup/restore_lifecycle_workflow.php b/classes/local/backup/restore_lifecycle_workflow.php
index 08af3da..d02b184 100644
--- a/classes/local/backup/restore_lifecycle_workflow.php
+++ b/classes/local/backup/restore_lifecycle_workflow.php
@@ -14,6 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Class to restore a workflow.
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\local\backup;
 
 use tool_lifecycle\entity\step_subplugin;
@@ -27,6 +33,12 @@ use tool_lifecycle\settings_type;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Class to restore a workflow.
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class restore_lifecycle_workflow {
 
     /** @var $workflow workflow */
@@ -42,6 +54,10 @@ class restore_lifecycle_workflow {
     /** @var $writer \XMLWriter */
     private $reader;
 
+    /**
+     * Restore_lifecycle_workflow constructor.
+     * @param string $xmldata XML-Data the workflow should be restored from.
+     */
     public function __construct($xmldata) {
         $this->reader = new \XMLReader();
         $this->reader->XML($xmldata);
diff --git a/classes/local/data/manual_trigger_tool.php b/classes/local/data/manual_trigger_tool.php
index cd211de..39126fa 100644
--- a/classes/local/data/manual_trigger_tool.php
+++ b/classes/local/data/manual_trigger_tool.php
@@ -14,6 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Class representing a manual trigger tool
+ *
+ * @package tool_lifecycle
+ * @copyright  2018 WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\local\data;
 
 use renderable;
@@ -27,21 +34,27 @@ defined('MOODLE_INTERNAL') || die();
  * @copyright  2018 WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 class manual_trigger_tool implements renderable {
 
-    /** int id of the trigger the tool belongs to*/
+    /** @var int $triggerid Id of the trigger the tool belongs to. */
     public $triggerid;
 
-    /** string icon, which is displayed to the user in the trigger tools menu*/
+    /** @var string $icon Icon, which is displayed to the user in the trigger tools menu. */
     public $icon;
 
-    /** string name, which is displayed to the user in the trigger tools menu*/
+    /** @var string $displayname Name, which is displayed to the user in the trigger tools menu. */
     public $displayname;
 
-    /** string capability required to use and display this tool*/
+    /** @var string $capability Capability, which is required to use and display this tool. */
     public $capability;
 
+    /**
+     * manual_trigger_tool constructor.
+     * @param int $triggerid Id of the trigger the tool belongs to.
+     * @param string $icon Icon, which is displayed to the user in the trigger tools menu.
+     * @param string $displayname Name, which is displayed to the user in the trigger tools menu.
+     * @param string $capability Capability, which is required to use and display this tool.
+     */
     public function __construct($triggerid, $icon, $displayname, $capability) {
         $this->triggerid = $triggerid;
         $this->icon = $icon;
diff --git a/classes/manager/backup_manager.php b/classes/manager/backup_manager.php
index c272849..7c270ba 100644
--- a/classes/manager/backup_manager.php
+++ b/classes/manager/backup_manager.php
@@ -29,6 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
 require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
 
+/**
+ * Manager to create & restore backups for courses
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class backup_manager {
 
     /**
diff --git a/classes/manager/delayed_courses_manager.php b/classes/manager/delayed_courses_manager.php
index 93e2c1f..d07a698 100644
--- a/classes/manager/delayed_courses_manager.php
+++ b/classes/manager/delayed_courses_manager.php
@@ -15,20 +15,33 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Manager for Delayed Courses
- * Each entry tells that the trigger-check for a certain course is delayed until a certain timestamp.
+ * Manager for Delayed Courses.
  *
+ * Each entry tells that the trigger-check for a certain course is delayed until a certain timestamp.
  * @package tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\manager;
 
 defined('MOODLE_INTERNAL') || die();
-
+/**
+ * Manager for Delayed Courses.
+ *
+ * Each entry tells that the trigger-check for a certain course is delayed until a certain timestamp.
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class delayed_courses_manager {
 
+    /**
+     * Sets a delay for a course for specific workflow.
+     * @param int $courseid Id of the course.
+     * @param bool $becauserollback True, if the delay is caused by a rollback.
+     * @param int $workfloworid Id of the workflow.
+     * @throws \dml_exception
+     */
     public static function set_course_delayed_for_workflow($courseid, $becauserollback, $workfloworid) {
         global $DB;
         if (is_object($workfloworid)) {
@@ -63,6 +76,12 @@ class delayed_courses_manager {
 
     }
 
+    /**
+     * Get the delayes courses for specific workflow.
+     * @param int $workflowid Id of the workflow.
+     * @return array
+     * @throws \dml_exception
+     */
     public static function get_delayed_courses_for_workflow($workflowid) {
         global $DB;
         $sql = 'SELECT courseid FROM {tool_lifecycle_delayed_workf} WHERE delayeduntil > :now AND workflowid = :workflowid';
@@ -73,6 +92,7 @@ class delayed_courses_manager {
      * Creates an instance of a delayed course.
      * @param int $courseid id of the course
      * @param int $duration number of seconds
+     * @throws \dml_exception
      */
     public static function set_course_delayed($courseid, $duration) {
         global $DB;
@@ -95,6 +115,7 @@ class delayed_courses_manager {
      * Queries if a course was delayed.
      * @param int $courseid id of the course
      * @return null|int timestamp until when the course is delayed (null if no entry exists).
+     * @throws \dml_exception
      */
     public static function get_course_delayed($courseid) {
         global $DB;
@@ -119,6 +140,7 @@ class delayed_courses_manager {
     /**
      * Deletes the delay entry for a course.
      * @param int $courseid id of the course
+     * @throws \dml_exception
      */
     public static function remove_delay_entry($courseid) {
         global $DB;
diff --git a/classes/manager/interaction_manager.php b/classes/manager/interaction_manager.php
index 1dc9904..67996fc 100644
--- a/classes/manager/interaction_manager.php
+++ b/classes/manager/interaction_manager.php
@@ -29,6 +29,13 @@ use tool_lifecycle\response\step_interactive_response;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Manager to handle interactions by users
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class interaction_manager {
 
     /**
@@ -50,6 +57,8 @@ class interaction_manager {
      * @param string $action action string
      * @return boolean if true, interaction finished.
      *      If false, the current step is still processing and cares for displaying the view.
+     * @throws \coding_exception
+     * @throws \dml_exception
      * @throws \invalid_parameter_exception
      */
     public static function handle_interaction($stepid, $processid, $action) {
@@ -85,7 +94,9 @@ class interaction_manager {
     }
 
     /**
+     * Save the interaction that happened in the database.
      * @param process $process
+     * @param string $action Action name.
      * @throws \dml_exception
      */
     public static function save_interaction($process, $action) {
@@ -134,6 +145,8 @@ class interaction_manager {
      * @param int $processid if of the process the action tools are requested for
      * @return array of action tools
      * @throws \invalid_parameter_exception
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function get_action_tools($subpluginname, $processid) {
         $interactionlib = lib_manager::get_step_interactionlib($subpluginname);
@@ -146,10 +159,11 @@ class interaction_manager {
 
     /**
      * Returns the status message for the given process.
-     * @param string $subpluginname name of the step subplugin
      * @param int $processid id of the process the status message is requested for
      * @return string status message
      * @throws \invalid_parameter_exception
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function get_process_status_message($processid) {
         $process = process_manager::get_process_by_id($processid);
diff --git a/classes/manager/lib_manager.php b/classes/manager/lib_manager.php
index 2db928d..3d4873d 100644
--- a/classes/manager/lib_manager.php
+++ b/classes/manager/lib_manager.php
@@ -23,11 +23,20 @@
  */
 namespace tool_lifecycle\manager;
 
+use tool_lifecycle\step\libbase;
+use tool_lifecycle\trigger\base;
 use tool_lifecycle\trigger\base_automatic;
 use tool_lifecycle\trigger\base_manual;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Manager to retrive the lib of each subplugin.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class lib_manager {
 
     /**
@@ -92,7 +101,7 @@ class lib_manager {
      * @param string $subpluginname name of the subplugin
      * @param string $subplugintype type of the subplugin (e.g. trigger, step)
      * @param string $libsubtype allows to query different lib classes.
-     * @return
+     * @return null|base|libbase
      */
     private static function get_lib($subpluginname, $subplugintype, $libsubtype = '') {
         $triggerlist = \core_component::get_plugin_list('lifecycle' . $subplugintype);
diff --git a/classes/manager/process_data_manager.php b/classes/manager/process_data_manager.php
index eae43e1..afd2dd9 100644
--- a/classes/manager/process_data_manager.php
+++ b/classes/manager/process_data_manager.php
@@ -15,7 +15,8 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Manager for data of Life Cycle Processes
+ * Manager for data of Life Cycle Processes.
+ *
  * Data means every additional data, which is produced, stored and queried by steps during the process.
  * This class stores and queries the process data using a key/value-store.
  * Only strings can be stored. Every other data has to be parsed manually!
@@ -31,6 +32,17 @@ use tool_lifecycle\entity\trigger_subplugin;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Manager for data of Life Cycle Processes.
+ *
+ * Data means every additional data, which is produced, stored and queried by steps during the process.
+ * This class stores and queries the process data using a key/value-store.
+ * Only strings can be stored. Every other data has to be parsed manually!
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class process_data_manager {
 
     /**
@@ -39,6 +51,7 @@ class process_data_manager {
      * @param int $stepid id of the step.
      * @param string $key key the value is stored at.
      * @return string | null value for the given parameters.
+     * @throws \dml_exception
      */
     public static function get_process_data($processid, $stepid, $key) {
         global $DB;
@@ -63,6 +76,7 @@ class process_data_manager {
      * @param int $stepid id of the step.
      * @param string $key key the value is stored at.
      * @param string $value value for the given parameters.
+     * @throws \dml_exception
      */
     public static function set_process_data($processid, $stepid, $key, $value) {
         global $DB;
diff --git a/classes/manager/process_manager.php b/classes/manager/process_manager.php
index c064fe0..97af8d4 100644
--- a/classes/manager/process_manager.php
+++ b/classes/manager/process_manager.php
@@ -29,6 +29,13 @@ use tool_lifecycle\event\process_rollback;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Manager for Life Cycle Processes
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class process_manager {
 
     /**
@@ -36,6 +43,7 @@ class process_manager {
      * @param int $courseid id of the course
      * @param int $workflowid id of the workflow
      * @return process|null
+     * @throws \dml_exception
      */
     public static function create_process($courseid, $workflowid) {
         global $DB;
@@ -54,8 +62,8 @@ class process_manager {
 
     /**
      * Creates a process based on a manual trigger.
-     * @param $courseid int id of the course to be triggerd.
-     * @param $triggerid int id of the triggering trigger.
+     * @param int $courseid Id of the course to be triggerd.
+     * @param int $triggerid Id of the triggering trigger.
      * @return process the triggered process instance.
      * @throws \moodle_exception for invalid workflow definition or missing trigger.
      */
@@ -75,6 +83,7 @@ class process_manager {
     /**
      * Returns all current active processes.
      * @return process[]
+     * @throws \dml_exception
      */
     public static function get_processes() {
         global $DB;
@@ -90,6 +99,7 @@ class process_manager {
      * Creates a process for the course which is at the respective step the trigger is followed by.
      * @param int $processid id of the process
      * @return process
+     * @throws \dml_exception
      */
     public static function get_process_by_id($processid) {
         global $DB;
@@ -105,6 +115,7 @@ class process_manager {
      * Counts all processes for the given workflow id.
      * @param int $workflowid id of the workflow
      * @return int number of processes.
+     * @throws \dml_exception
      */
     public static function count_processes_by_workflow($workflowid) {
         global $DB;
@@ -115,6 +126,7 @@ class process_manager {
      * Returns all processes for given workflow id
      * @param int $workflowid id of the workflow
      * @return array of proccesses initiated by specifed workflow id
+     * @throws \dml_exception
      */
     public static function get_processes_by_workflow($workflowid) {
         global $DB;
@@ -129,7 +141,9 @@ class process_manager {
     /**
      * Proceeds the process to the next step.
      * @param process $process
-     * @return true, if followedby another step; otherwise false.
+     * @return true, if followed by another step; otherwise false.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function proceed_process(&$process) {
         global $DB;
@@ -150,6 +164,7 @@ class process_manager {
     /**
      * Sets the process status on waiting.
      * @param process $process
+     * @throws \dml_exception
      */
     public static function set_process_waiting(&$process) {
         global $DB;
@@ -160,6 +175,8 @@ class process_manager {
     /**
      * Currently only removes the current process.
      * @param process $process process the rollback should be triggered for.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function rollback_process($process) {
         process_rollback::event_from_process($process)->trigger();
@@ -180,6 +197,7 @@ class process_manager {
     /**
      * Removes the process and all data connected to it.
      * @param process $process process to be deleted.
+     * @throws \dml_exception
      */
     private static function remove_process($process) {
         global $DB;
@@ -187,6 +205,12 @@ class process_manager {
         $DB->delete_records('tool_lifecycle_process', (array) $process);
     }
 
+    /**
+     * Return the process of a course.
+     * @param int $courseid Id of the course.
+     * @return process|null Process instance or null if none exists.
+     * @throws \dml_exception
+     */
     public static function get_process_by_course_id($courseid) {
         global $DB;
         $record = $DB->get_record('tool_lifecycle_process', array('courseid' => $courseid));
diff --git a/classes/manager/settings_manager.php b/classes/manager/settings_manager.php
index c4201f9..fbdd296 100644
--- a/classes/manager/settings_manager.php
+++ b/classes/manager/settings_manager.php
@@ -28,6 +28,13 @@ use tool_lifecycle\settings_type;
 defined('MOODLE_INTERNAL') || die();
 require_once(__DIR__.'/../../lib.php');
 
+/**
+ * Manager to retrive the local settings for each step subplugin.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class settings_manager {
 
     /**
@@ -115,8 +122,10 @@ class settings_manager {
     /**
      * Returns an array of local subplugin settings for a given instance id
      * @param int $instanceid id of the step instance
-     * @param 'step'|'trigger' $type type of the subplugin.
+     * @param string $type Type of the setting (see {@link settings_type}).
      * @return array|null settings key-value pairs
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function get_settings($instanceid, $type) {
         global $DB;
@@ -155,7 +164,9 @@ class settings_manager {
     /**
      * Removes all local settings for a given instance id
      * @param int $instanceid id of the step instance
-     * @param 'step'|'trigger' $type type of the subplugin.
+     * @param string $type Type of the setting (see {@link settings_type}).
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function remove_settings($instanceid, $type) {
         global $DB;
@@ -168,7 +179,7 @@ class settings_manager {
 
     /**
      * Validates the type param for the two possibilities 'step' and 'trigger'.
-     * @param $type string type subplugin the settings should be saved, queried or removed.
+     * @param string $type Type of the setting (see {@link settings_type}).
      * @throws \coding_exception
      */
     private static function validate_type($type) {
diff --git a/classes/manager/step_manager.php b/classes/manager/step_manager.php
index e3d1181..3eb7698 100644
--- a/classes/manager/step_manager.php
+++ b/classes/manager/step_manager.php
@@ -29,12 +29,20 @@ use tool_lifecycle\settings_type;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Manager for Subplugins
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class step_manager extends subplugin_manager {
 
     /**
      * Returns a step instance if one with the is is available.
      * @param int $stepinstanceid id of the step instance
      * @return step_subplugin|null
+     * @throws \dml_exception
      */
     public static function get_step_instance($stepinstanceid) {
         global $DB;
@@ -52,6 +60,7 @@ class step_manager extends subplugin_manager {
      * @param int $workflowid id of the workflow
      * @param int $sortindex sortindex of the step within the workflow
      * @return step_subplugin|null
+     * @throws \dml_exception
      */
     public static function get_step_instance_by_workflow_index($workflowid, $sortindex) {
         global $DB;
@@ -71,6 +80,8 @@ class step_manager extends subplugin_manager {
     /**
      * Persists a subplugin to the database.
      * @param step_subplugin $subplugin
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function insert_or_update(step_subplugin &$subplugin) {
         global $DB;
@@ -88,6 +99,9 @@ class step_manager extends subplugin_manager {
      * Removes all step instances from the database.
      * Should only be used, when uninstalling the subplugin.
      * @param string $subpluginname step instance id
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function remove_all_instances($subpluginname) {
         $steps = self::get_step_instances_by_subpluginname($subpluginname);
@@ -99,6 +113,9 @@ class step_manager extends subplugin_manager {
     /**
      * Removes a step instance from the database.
      * @param int $stepinstanceid step instance id
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     private static function remove($stepinstanceid) {
         global $DB;
@@ -115,6 +132,8 @@ class step_manager extends subplugin_manager {
     /**
      * Removes a subplugin from the sortindex of a workflow and adjusts all other indizes.
      * @param step_subplugin $toberemoved
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     private static function remove_from_sortindex(&$toberemoved) {
         global $DB;
@@ -134,6 +153,8 @@ class step_manager extends subplugin_manager {
      * Changes the sortindex of a step by swapping it with another.
      * @param int $stepid id of the step
      * @param bool $up tells if the step should be set up or down
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function change_sortindex($stepid, $up) {
         global $DB;
@@ -173,6 +194,7 @@ class step_manager extends subplugin_manager {
      * Gets the list of step instances of a workflow.
      * @param int $workflowid id of the workflow
      * @return array of step instances.
+     * @throws \dml_exception
      */
     public static function get_step_instances($workflowid) {
         global $DB;
@@ -188,7 +210,9 @@ class step_manager extends subplugin_manager {
 
     /**
      * Gets the list of step instances for a specific subpluginname.
+     * @param string $subpluginname Name of the subplugin.
      * @return step_subplugin[] array of step instances.
+     * @throws \dml_exception
      */
     public static function get_step_instances_by_subpluginname($subpluginname) {
         global $DB;
@@ -203,6 +227,7 @@ class step_manager extends subplugin_manager {
     /**
      * Gets the list of step subplugins.
      * @return array of step subplugins.
+     * @throws \coding_exception
      */
     public static function get_step_types() {
         $subplugins = \core_component::get_plugin_list('lifecyclestep');
@@ -218,6 +243,9 @@ class step_manager extends subplugin_manager {
      * @param string $action action to be executed
      * @param int $subpluginid id of the step instance
      * @param int $workflowid id of the workflow
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function handle_action($action, $subpluginid, $workflowid) {
         $step = self::get_step_instance($subpluginid);
@@ -245,6 +273,7 @@ class step_manager extends subplugin_manager {
      * @param int $stepid id of the step process data should be saved for.
      * @return bool if true data is saved instance dependent.
      * Otherwise it does not matter which instance of a subplugin created the data.
+     * @throws \dml_exception
      */
     public static function is_process_data_instance_dependent($stepid) {
         $step = self::get_step_instance($stepid);
@@ -259,6 +288,7 @@ class step_manager extends subplugin_manager {
      * Gets the count of steps belonging to a workflow.
      * @param int $workflowid id of the workflow.
      * @return int count of the steps.
+     * @throws \dml_exception
      */
     public static function count_steps_of_workflow($workflowid) {
         global $DB;
@@ -269,7 +299,9 @@ class step_manager extends subplugin_manager {
 
     /**
      * Removes all instances, which belong to the workflow instance.
-     * @param $workflowid int id of the workflow.
+     * @param int $workflowid Id of the workflow.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function remove_instances_of_workflow($workflowid) {
         global $DB;
@@ -282,8 +314,12 @@ class step_manager extends subplugin_manager {
 
     /**
      * Copies all steps of a workflow to a new one.
-     * @param $oldworkflowid int id of the old workflow
-     * @param $newworkflowid int id of the new workflow
+     * @param int $oldworkflowid Id of the old workflow
+     * @param int $newworkflowid Id of the new workflow
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
+     * @throws \moodle_exception
      */
     public static function duplicate_steps($oldworkflowid, $newworkflowid) {
         $steps = self::get_step_instances($oldworkflowid);
diff --git a/classes/manager/subplugin_manager.php b/classes/manager/subplugin_manager.php
index a702048..1e53076 100644
--- a/classes/manager/subplugin_manager.php
+++ b/classes/manager/subplugin_manager.php
@@ -24,13 +24,34 @@
 namespace tool_lifecycle\manager;
 
 defined('MOODLE_INTERNAL') || die();
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Manager for Subplugins
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 abstract class subplugin_manager {
 
     /**
      * Determines if there exists a subplugin for the given name and type
-     * @param $subpluginname
-     * @param $subplugintype
+     * @param string $subpluginname Name of the subplugin.
+     * @param string $subplugintype Type of the subplugin.
      * @return bool
      */
     protected static function is_subplugin($subpluginname, $subplugintype) {
diff --git a/classes/manager/trigger_manager.php b/classes/manager/trigger_manager.php
index 7833104..ddae60b 100644
--- a/classes/manager/trigger_manager.php
+++ b/classes/manager/trigger_manager.php
@@ -30,11 +30,21 @@ use tool_lifecycle\settings_type;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Manager for Trigger subplugins
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class trigger_manager extends subplugin_manager {
 
     /**
      * Creates a preset workflow for the trigger subplugin.
-     * @param $subpluginname string name of the trigger subplugin.
+     * @param string $subpluginname Name of the trigger subplugin.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function register_workflow($subpluginname) {
         $workflow = workflow_manager::create_workflow(
@@ -50,8 +60,9 @@ class trigger_manager extends subplugin_manager {
 
     /**
      * Returns a subplugin object.
-     * @param int $subpluginid id of the subplugin
+     * @param int $instanceid Id of the subplugin.
      * @return trigger_subplugin
+     * @throws \dml_exception
      */
     public static function get_instance($instanceid) {
         return self::get_subplugin_by_id($instanceid);
@@ -61,6 +72,7 @@ class trigger_manager extends subplugin_manager {
      * Returns all instances for a trigger subplugin.
      * @param string $subpluginname name of the subplugin
      * @return trigger_subplugin[]
+     * @throws \dml_exception
      */
     public static function get_instances($subpluginname) {
         global $DB;
@@ -77,6 +89,7 @@ class trigger_manager extends subplugin_manager {
      * Returns a subplugin object.
      * @param int $subpluginid id of the subplugin
      * @return trigger_subplugin
+     * @throws \dml_exception
      */
     private static function get_subplugin_by_id($subpluginid) {
         global $DB;
@@ -92,6 +105,8 @@ class trigger_manager extends subplugin_manager {
     /**
      * Persists a subplugin to the database.
      * @param trigger_subplugin $subplugin
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function insert_or_update(trigger_subplugin &$subplugin) {
         global $DB;
@@ -109,6 +124,8 @@ class trigger_manager extends subplugin_manager {
      * Removes all trigger instances from the database.
      * Should only be used, when uninstalling the subplugin.
      * @param string $subpluginname trigger instance id
+     * @throws \dml_exception
+     * @throws \coding_exception
      */
     public static function remove_all_instances($subpluginname) {
         $triggers = self::get_instances($subpluginname);
@@ -120,6 +137,9 @@ class trigger_manager extends subplugin_manager {
     /**
      * Removes a trigger instance from the database.
      * @param int $triggerinstanceid trigger instance id
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     private static function remove($triggerinstanceid) {
         global $DB;
@@ -136,8 +156,9 @@ class trigger_manager extends subplugin_manager {
 
     /**
      * Returns the triggers instances for the workflow id.
-     * @param $workflowid int id of the workflow definition.
+     * @param int $workflowid Id of the workflow definition.
      * @return trigger_subplugin[] returns the trigger instances for the workflow.
+     * @throws \dml_exception
      */
     public static function get_triggers_for_workflow($workflowid) {
         global $DB;
@@ -153,6 +174,8 @@ class trigger_manager extends subplugin_manager {
     /**
      * Removes a subplugin from the sortindex of a workflow and adjusts all other indizes.
      * @param trigger_subplugin $toberemoved
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     private static function remove_from_sortindex(&$toberemoved) {
         global $DB;
@@ -172,6 +195,8 @@ class trigger_manager extends subplugin_manager {
      * Changes the sortindex of a trigger by swapping it with another.
      * @param int $triggerid id of the trigger
      * @param bool $up tells if the trigger should be set up or down
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function change_sortindex($triggerid, $up) {
         global $DB;
@@ -210,6 +235,7 @@ class trigger_manager extends subplugin_manager {
     /**
      * Gets the list of step subplugins.
      * @return array of step subplugins.
+     * @throws \coding_exception
      */
     public static function get_trigger_types() {
         $subplugins = \core_component::get_plugin_list('lifecycletrigger');
@@ -223,6 +249,7 @@ class trigger_manager extends subplugin_manager {
     /**
      * Gets the list of step subplugins, which are not preset and can therefore be chosen from trigger form dropdown..
      * @return array of step subplugins.
+     * @throws \coding_exception
      */
     public static function get_chooseable_trigger_types() {
         $triggers = self::get_trigger_types();
@@ -242,6 +269,9 @@ class trigger_manager extends subplugin_manager {
      * @param string $action action to be executed
      * @param int $subpluginid id of the trigger instance
      * @param int $workflowid id of the workflow
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function handle_action($action, $subpluginid, $workflowid) {
         $trigger = self::get_instance($subpluginid);
@@ -267,6 +297,7 @@ class trigger_manager extends subplugin_manager {
      * Gets the count of triggers belonging to a workflow.
      * @param int $workflowid id of the workflow.
      * @return int count of the steps.
+     * @throws \dml_exception
      */
     public static function count_triggers_of_workflow($workflowid) {
         global $DB;
@@ -277,7 +308,9 @@ class trigger_manager extends subplugin_manager {
 
     /**
      * Removes all instances, which belong to the workflow instance.
-     * @param $workflowid int id of the workflow.
+     * @param int $workflowid Id of the workflow.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function remove_instances_of_workflow($workflowid) {
         global $DB;
@@ -290,8 +323,12 @@ class trigger_manager extends subplugin_manager {
 
     /**
      * Copies the triggers of a workflow to a new one.
-     * @param $oldworkflowid int id of the old workflow
-     * @param $newworkflowid int id of the new workflow
+     * @param int $oldworkflowid Id of the old workflow
+     * @param int $newworkflowid Id of the new workflow
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
+     * @throws \moodle_exception
      */
     public static function duplicate_triggers($oldworkflowid, $newworkflowid) {
         $triggers = self::get_triggers_for_workflow($oldworkflowid);
diff --git a/classes/manager/workflow_manager.php b/classes/manager/workflow_manager.php
index e256546..6aa0d25 100644
--- a/classes/manager/workflow_manager.php
+++ b/classes/manager/workflow_manager.php
@@ -21,25 +21,32 @@
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\manager;
 
 use tool_lifecycle\action;
 use tool_lifecycle\entity\trigger_subplugin;
 use tool_lifecycle\entity\workflow;
 use tool_lifecycle\local\backup\backup_lifecycle_workflow;
-use tool_lifecycle\local\exporter\workflow_exporter;
 use tool_lifecycle\local\data\manual_trigger_tool;
 use tool_lifecycle\settings_type;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Manager for Life Cycle Workflows
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class workflow_manager {
 
     /**
      * Persists a workflow to the database.
      *
      * @param workflow $workflow
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function insert_or_update(workflow &$workflow) {
         global $DB;
@@ -57,6 +64,7 @@ class workflow_manager {
      *
      * @param int $workflowid id of the workflow
      * @param boolean $hard if set, will remove the workflow without checking if it's removable! Mainly for testing.
+     * @throws \dml_exception
      */
     public static function remove($workflowid, $hard = false) {
         global $DB;
@@ -71,6 +79,8 @@ class workflow_manager {
      * Disables a workflow
      *
      * @param int $workflowid id of the workflow
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function disable($workflowid) {
         $workflow = self::get_workflow($workflowid);
@@ -86,6 +96,8 @@ class workflow_manager {
      * Deletes all running processes of given workflow
      *
      * @param int $workflowid id of the workflow
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function abortprocesses($workflowid) {
         $processes = process_manager::get_processes_by_workflow($workflowid);
@@ -99,6 +111,7 @@ class workflow_manager {
      *
      * @param int $workflowid id of the workflow
      * @return workflow|null
+     * @throws \dml_exception
      */
     public static function get_workflow($workflowid) {
         global $DB;
@@ -115,6 +128,7 @@ class workflow_manager {
      * Returns all existing workflows.
      *
      * @return workflow[]
+     * @throws \dml_exception
      */
     public static function get_workflows() {
         global $DB;
@@ -130,6 +144,7 @@ class workflow_manager {
      * Returns all active workflows.
      *
      * @return workflow[]
+     * @throws \dml_exception
      */
     public static function get_active_workflows() {
         global $DB;
@@ -147,6 +162,7 @@ class workflow_manager {
      * Returns all active automatic workflows.
      *
      * @return workflow[]
+     * @throws \dml_exception
      */
     public static function get_active_automatic_workflows() {
         global $DB;
@@ -165,6 +181,7 @@ class workflow_manager {
      * Returns triggers of active manual workflows.
      *
      * @return trigger_subplugin[]
+     * @throws \dml_exception
      */
     public static function get_active_manual_workflow_triggers() {
         global $DB;
@@ -183,6 +200,8 @@ class workflow_manager {
      * You need to check the capability based on course and user before diplaying it.
      *
      * @return manual_trigger_tool[] list of tools, available in the whole system.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public static function get_manual_trigger_tools_for_active_workflows() {
         $triggers = self::get_active_manual_workflow_triggers();
@@ -198,6 +217,9 @@ class workflow_manager {
      * Activate a workflow
      *
      * @param int $workflowid id of the workflow
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function activate_workflow($workflowid) {
         global $DB;
@@ -228,6 +250,10 @@ class workflow_manager {
      *
      * @param string $action action to be executed
      * @param int $workflowid id of the workflow
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
+     * @throws \moodle_exception
      */
     public static function handle_action($action, $workflowid) {
         if (!empty($action)) {
@@ -277,6 +303,8 @@ class workflow_manager {
      *
      * @param int $workflowid id of the workflow
      * @param bool $up tells if the workflow should be set up or down
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function change_sortindex($workflowid, $up) {
         global $DB;
@@ -319,7 +347,7 @@ class workflow_manager {
      * Checks if the workflow definition is valid.
      * The main purpose of this function is, to check if a trigger definition exists and if this definition is complete.
      *
-     * @param $workflowid int id of the workflow.
+     * @param int $workflowid Id of the workflow.
      * @return bool true, if the definition is valid.
      */
     public static function is_valid($workflowid) {
@@ -333,8 +361,9 @@ class workflow_manager {
     /**
      * Checks if the workflow is active.
      *
-     * @param $workflowid int id of the workflow.
+     * @param int $workflowid Id of the workflow.
      * @return bool true, if the workflow is active.
+     * @throws \dml_exception
      */
     public static function is_active($workflowid) {
         $workflow = self::get_workflow($workflowid);
@@ -344,8 +373,9 @@ class workflow_manager {
     /**
      * Checks if the workflow is deactive.
      *
-     * @param $workflowid int id of the workflow.
+     * @param int $workflowid Id of the workflow.
      * @return bool true, if the workflow was deactivated.
+     * @throws \dml_exception
      */
     public static function is_deactivated($workflowid) {
         $workflow = self::get_workflow($workflowid);
@@ -359,9 +389,11 @@ class workflow_manager {
      * Creates a workflow with a specific title. Is used to create preset workflows for trigger plugins or for
      * duplication of workflows.
      *
-     * @param $title string title of the workflow.
-     * @param $displaytitle string display title of the workflow.
+     * @param string $title Title of the workflow.
+     * @param string $displaytitle Display title of the workflow.
      * @return workflow the created workflow.
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function create_workflow($title, $displaytitle = null) {
         $record = new \stdClass();
@@ -377,8 +409,10 @@ class workflow_manager {
     /**
      * Duplicates a workflow including its trigger, all its steps and their settings.
      *
-     * @param $workflowid int id of the workflow to copy.
+     * @param int $workflowid Id of the workflow to copy.
      * @return workflow the created workflow.
+     * @throws \dml_exception
+     * @throws \dml_transaction_exception
      */
     public static function duplicate_workflow($workflowid) {
         $oldworkflow = self::get_workflow($workflowid);
@@ -413,7 +447,7 @@ class workflow_manager {
     /**
      * Checks if it should be possible to disable a workflow
      *
-     * @param $workflowid
+     * @param int $workflowid Id of the workflow.
      * @return bool
      */
     public static function is_disableable($workflowid) {
@@ -430,8 +464,9 @@ class workflow_manager {
     /**
      * Workflows should only be editable if never been activated before
      *
-     * @param $workflowid
+     * @param int $workflowid Id of the workflow
      * @return bool
+     * @throws \dml_exception
      */
     public static function is_editable($workflowid) {
         if (self::is_active($workflowid) ||
@@ -444,8 +479,9 @@ class workflow_manager {
     /**
      * Workflows should only be abortable if disabled but some processes are still running
      *
-     * @param $workflowid
+     * @param int $workflowid Id of the workflow.
      * @return bool
+     * @throws \dml_exception
      */
     public static function is_abortable($workflowid) {
         $countprocesses = process_manager::count_processes_by_workflow($workflowid);
@@ -458,8 +494,9 @@ class workflow_manager {
     /**
      * Workflows should only be removable if disableable and no more processes are running
      *
-     * @param $workflowid
+     * @param int $workflowid Id of the workflow.
      * @return bool
+     * @throws \dml_exception
      */
     public static function is_removable($workflowid) {
         $countprocesses = process_manager::count_processes_by_workflow($workflowid);
diff --git a/classes/plugininfo/lifecyclestep.php b/classes/plugininfo/lifecyclestep.php
index c98c550..cfc53df 100644
--- a/classes/plugininfo/lifecyclestep.php
+++ b/classes/plugininfo/lifecyclestep.php
@@ -17,11 +17,10 @@
 /**
  * Pluginfo for life cycle step
  *
- * @package tool_lifecycle
+ * @package    tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\plugininfo;
 
 use core\plugininfo\base;
@@ -30,8 +29,22 @@ use tool_lifecycle\manager\workflow_manager;
 
 defined('MOODLE_INTERNAL') || die();
 
-
+/**
+ * Pluginfo for life cycle step
+ *
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class lifecyclestep extends base {
+
+    /**
+     * Should there be a way to uninstall the plugin via the administration UI.
+     *
+     * By default uninstallation is not allowed, plugin developers must enable it explicitly!
+     *
+     * @return bool
+     */
     public function is_uninstall_allowed() {
         if ($this->is_standard()) {
             return false;
@@ -46,6 +59,11 @@ class lifecyclestep extends base {
         return true;
     }
 
+    /**
+     * Remove the plugin.
+     * @param \progress_trace $progress
+     * @return bool
+     */
     public function uninstall(\progress_trace $progress) {
         step_manager::remove_all_instances($this->name);
         return true;
diff --git a/classes/plugininfo/lifecycletrigger.php b/classes/plugininfo/lifecycletrigger.php
index 7b252e9..12652a3 100644
--- a/classes/plugininfo/lifecycletrigger.php
+++ b/classes/plugininfo/lifecycletrigger.php
@@ -21,7 +21,6 @@
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\plugininfo;
 
 use core\plugininfo\base;
@@ -33,8 +32,22 @@ use tool_usertours\step;
 
 defined('MOODLE_INTERNAL') || die();
 
-
+/**
+ * Pluginfo for life cycle trigger
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class lifecycletrigger extends base {
+
+    /**
+     * Should there be a way to uninstall the plugin via the administration UI.
+     *
+     * By default uninstallation is not allowed, plugin developers must enable it explicitly!
+     *
+     * @return bool
+     */
     public function is_uninstall_allowed() {
         if ($this->is_standard()) {
             return false;
@@ -49,6 +62,12 @@ class lifecycletrigger extends base {
         return true;
     }
 
+    /**
+     * Uninstall the plugin.
+     * @param \progress_trace $progress
+     * @return bool
+     * @throws \moodle_exception
+     */
     public function uninstall(\progress_trace $progress) {
         $lib = lib_manager::get_trigger_lib($this->name);
         if ($lib->has_multiple_instances()) {
diff --git a/classes/processor.php b/classes/processor.php
index f01a985..3256c59 100644
--- a/classes/processor.php
+++ b/classes/processor.php
@@ -38,12 +38,15 @@ use tool_lifecycle\response\trigger_response;
 
 defined('MOODLE_INTERNAL') || die;
 
+/**
+ * Offers functionality to trigger, process and finish lifecycle processes.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class processor {
 
-    public function __construct() {
-
-    }
-
     /**
      * Processes the trigger plugins for all relevant courses.
      */
@@ -95,7 +98,6 @@ class processor {
      * Calls the process_course() method of each step submodule currently responsible for a given course.
      */
     public function process_courses() {
-        global $CFG;
         foreach (process_manager::get_processes() as $process) {
             $workflow = workflow_manager::get_workflow($process->workflowid);
             while (true) {
@@ -138,13 +140,17 @@ class processor {
     }
 
     /**
+     * In case we are in an interactive environment because the user is lead through the interactive interfaces
+     * of multiple steps, this function cares for a redirection and processing through these steps until we reach a
+     * no longer interactive state of the workflow.
      *
-     * @param $processid int id of the process
+     * @param int $processid Id of the process
      * @return boolean if true, interaction finished.
      *      If false, the current step is still processing and cares for displaying the view.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function process_course_interactive($processid) {
-        global $CFG;
         $process = process_manager::get_process_by_id($processid);
         $step = step_manager::get_step_instance_by_workflow_index($process->workflowid, $process->stepindex + 1);
         // If there is no next step, then proceed, which will delete/finish the process.
@@ -180,9 +186,11 @@ class processor {
     /**
      * Returns a record set with all relevant courses.
      * Relevant means that there is currently no lifecycle process running for this course.
-     * @params $triggers trigger[] list of triggers, which will be asked for additional where requirements.
-     * @params $exclude int[] list of course id, which should be excluded from execution.
+     * @param trigger[] $triggers List of triggers, which will be asked for additional where requirements.
+     * @param int[] $exclude List of course id, which should be excluded from execution.
      * @return \moodle_recordset with relevant courses.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function get_course_recordset($triggers, $exclude) {
         global $DB;
diff --git a/classes/response/step_interactive_response.php b/classes/response/step_interactive_response.php
index c9e2cb2..d373404 100644
--- a/classes/response/step_interactive_response.php
+++ b/classes/response/step_interactive_response.php
@@ -25,13 +25,25 @@ namespace tool_lifecycle\response;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Possible Responses of a Subplugin for interaction handling
+ *
+ * @package tool_lifecycle
+ * @copyright  2018 WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class step_interactive_response {
 
+    /** @var string Proceed the workflow to the next step. */
     const PROCEED = 'proceed';
+    /** @var string The called action is not known to the processing plugin. */
     const NOACTION = 'noaction';
+    /** @var string The processing plugin is still processing. */
     const STILLPROCESSING = 'stillprocessing';
+    /** @var string The process should be rolled back. */
     const ROLLBACK = 'rollback';
 
+    /** @var string Value of the response. */
     private $value;
 
     /**
diff --git a/classes/response/step_response.php b/classes/response/step_response.php
index 6008503..9a1c643 100644
--- a/classes/response/step_response.php
+++ b/classes/response/step_response.php
@@ -25,12 +25,23 @@ namespace tool_lifecycle\response;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Possible Responses of a Subplugin
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class step_response {
 
+    /** @var string Proceed the workflow to the next step. */
     const PROCEED = 'proceed';
+    /** @var string The step is still processing the course and probably waiting for some interaction. */
     const WAITING = 'waiting';
+    /** @var string The process should be rolled back. */
     const ROLLBACK = 'rollback';
 
+    /** @var string Value of the response. */
     private $value;
 
     /**
diff --git a/classes/response/trigger_response.php b/classes/response/trigger_response.php
index 090704e..4c3fcec 100644
--- a/classes/response/trigger_response.php
+++ b/classes/response/trigger_response.php
@@ -25,12 +25,23 @@ namespace tool_lifecycle\response;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Possible Responses of a Trigger Subplugin
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class trigger_response {
 
+    /** @var string Ask the next workflow if it wants to trigger the course. */
     const NEXT = 'next';
+    /** @var string Exclude the course from being processed by this and any succeeding workflow. */
     const EXCLUDE = 'exclude';
+    /** @var string Trigger a process for this workflow if all other triggers of this workflow say the same. */
     const TRIGGER = 'trigger';
 
+    /** @var string Value of the response. */
     private $value;
 
     /**
diff --git a/classes/settings_type.php b/classes/settings_type.php
index 20c5699..245630b 100644
--- a/classes/settings_type.php
+++ b/classes/settings_type.php
@@ -14,6 +14,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Defines available settings_types.
+ * @package    tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle;
 
 defined('MOODLE_INTERNAL') || die();
@@ -21,13 +27,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Defines available settings_types.
  * @package    tool_lifecycle
- * @category
- * @group      tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class settings_type {
 
+    /** @var string Represents the type for a step subplugin. */
     const STEP = 'step';
+    /** @var string Represents the type for a trigger subplugin. */
     const TRIGGER = 'trigger';
 }
\ No newline at end of file
diff --git a/classes/table/active_automatic_workflows_table.php b/classes/table/active_automatic_workflows_table.php
index 6b5b998..b647704 100644
--- a/classes/table/active_automatic_workflows_table.php
+++ b/classes/table/active_automatic_workflows_table.php
@@ -21,7 +21,6 @@
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\table;
 
 use tool_lifecycle\action;
@@ -34,8 +33,21 @@ defined('MOODLE_INTERNAL') || die;
 require_once($CFG->libdir . '/tablelib.php');
 require_once(__DIR__ . '/../../lib.php');
 
+/**
+ * Table listing all active automatically triggered workflows.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class active_automatic_workflows_table extends active_workflows_table {
 
+    /**
+     * Constructor for active_automatic_workflows_table.
+     * @param int $uniqueid Unique id of this table.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
         global $PAGE, $DB;
@@ -49,6 +61,9 @@ class active_automatic_workflows_table extends active_workflows_table {
         $this->init();
     }
 
+    /**
+     * Initialize the table.
+     */
     public function init() {
         $this->define_columns(['title', 'timeactive', 'trigger', 'processes', 'sortindex', 'tools']);
         $this->define_headers([
@@ -66,8 +81,9 @@ class active_automatic_workflows_table extends active_workflows_table {
     /**
      * Render sortindex column.
      *
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for changing sortorder of active workflows
+     * @throws \coding_exception
      */
     public function col_sortindex($row) {
         global $OUTPUT;
diff --git a/classes/table/active_manual_workflows_table.php b/classes/table/active_manual_workflows_table.php
index e82afaa..f1bdfd6 100644
--- a/classes/table/active_manual_workflows_table.php
+++ b/classes/table/active_manual_workflows_table.php
@@ -33,8 +33,21 @@ defined('MOODLE_INTERNAL') || die;
 require_once($CFG->libdir . '/tablelib.php');
 require_once(__DIR__ . '/../../lib.php');
 
+/**
+ * Table listing all active manually triggered workflows.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class active_manual_workflows_table extends active_workflows_table {
 
+    /**
+     * Constructor for active_manual_workflows_table.
+     * @param int $uniqueid Unique id of this table.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
         global $PAGE, $DB;
@@ -48,6 +61,9 @@ class active_manual_workflows_table extends active_workflows_table {
         $this->init();
     }
 
+    /**
+     * Initialize the table.
+     */
     public function init() {
         $this->define_columns(['title', 'timeactive', 'trigger', 'processes', 'tools']);
         $this->define_headers([
diff --git a/classes/table/active_processes_table.php b/classes/table/active_processes_table.php
index d0b220d..6330869 100644
--- a/classes/table/active_processes_table.php
+++ b/classes/table/active_processes_table.php
@@ -27,8 +27,19 @@ defined('MOODLE_INTERNAL') || die;
 
 require_once($CFG->libdir . '/tablelib.php');
 
+/**
+ * Table listing active processes
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class active_processes_table extends \table_sql {
 
+    /**
+     * Constructor for active_processes_table.
+     * @param int $uniqueid Unique id of this table.
+     */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
         global $PAGE;
@@ -46,6 +57,9 @@ class active_processes_table extends \table_sql {
         $this->init();
     }
 
+    /**
+     * Initialize the table.
+     */
     public function init() {
         $this->define_columns(['courseid', 'courseshortname', 'coursefullname', 'instancename']);
         $this->define_headers([
@@ -58,7 +72,7 @@ class active_processes_table extends \table_sql {
 
     /**
      * Render courseid column.
-     * @param $row
+     * @param object $row Row data.
      * @return string course link
      */
     public function col_courseid($row) {
@@ -67,7 +81,7 @@ class active_processes_table extends \table_sql {
 
     /**
      * Render courseshortname column.
-     * @param $row
+     * @param object $row Row data.
      * @return string course link
      */
     public function col_courseshortname($row) {
@@ -76,7 +90,7 @@ class active_processes_table extends \table_sql {
 
     /**
      * Render coursefullname column.
-     * @param $row
+     * @param object $row Row data.
      * @return string course link
      */
     public function col_coursefullname($row) {
@@ -85,7 +99,7 @@ class active_processes_table extends \table_sql {
 
     /**
      * Render instancename column.
-     * @param $row
+     * @param object $row Row data.
      * @return string pluginname of the instance
      */
     public function col_instancename($row) {
diff --git a/classes/table/active_workflows_table.php b/classes/table/active_workflows_table.php
index c2d5b27..9bd5d81 100644
--- a/classes/table/active_workflows_table.php
+++ b/classes/table/active_workflows_table.php
@@ -34,13 +34,22 @@ defined('MOODLE_INTERNAL') || die;
 require_once($CFG->libdir . '/tablelib.php');
 require_once(__DIR__ . '/../../lib.php');
 
+/**
+ * Table listing all active workflow definitions.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 abstract class active_workflows_table extends workflow_table {
 
     /**
      * Render tools column for active workflows.
      *
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for workflows
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_tools($row) {
         global $OUTPUT;
diff --git a/classes/table/course_backups_table.php b/classes/table/course_backups_table.php
index 6925409..78d1f08 100644
--- a/classes/table/course_backups_table.php
+++ b/classes/table/course_backups_table.php
@@ -27,8 +27,19 @@ defined('MOODLE_INTERNAL') || die;
 
 require_once($CFG->libdir . '/tablelib.php');
 
+/**
+ * Table listing course backups
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class course_backups_table extends \table_sql {
 
+    /**
+     * Constructor for course_backups_table.
+     * @param int $uniqueid Unique id of this table.
+     */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
         global $PAGE;
@@ -42,6 +53,9 @@ class course_backups_table extends \table_sql {
         $this->init();
     }
 
+    /**
+     * Initialize the table.
+     */
     public function init() {
         $this->define_columns(['courseid', 'courseshortname', 'coursefullname', 'backupcreated', 'download', 'restore']);
         $this->define_headers([
@@ -56,7 +70,7 @@ class course_backups_table extends \table_sql {
 
     /**
      * Render courseid column.
-     * @param $row
+     * @param object $row Row data.
      * @return string course link
      */
     public function col_courseid($row) {
@@ -69,7 +83,7 @@ class course_backups_table extends \table_sql {
 
     /**
      * Render courseshortname column.
-     * @param $row
+     * @param object $row Row data.
      * @return string course link
      */
     public function col_courseshortname($row) {
@@ -82,7 +96,7 @@ class course_backups_table extends \table_sql {
 
     /**
      * Render coursefullname column.
-     * @param $row
+     * @param object $row Row data.
      * @return string course link
      */
     public function col_coursefullname($row) {
@@ -95,7 +109,7 @@ class course_backups_table extends \table_sql {
 
     /**
      * Render backupcreated column.
-     * @param $row
+     * @param object $row Row data.
      * @return string date of the backupcreated
      */
     public function col_backupcreated($row) {
@@ -104,8 +118,10 @@ class course_backups_table extends \table_sql {
 
     /**
      * Render download column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for downloading a backup.
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_download($row) {
         return \html_writer::link(
@@ -116,8 +132,10 @@ class course_backups_table extends \table_sql {
 
     /**
      * Render restore column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for restoring a course.
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_restore($row) {
         return \html_writer::link(
diff --git a/classes/table/deactivated_workflows_table.php b/classes/table/deactivated_workflows_table.php
index 58becc0..7c7f59e 100644
--- a/classes/table/deactivated_workflows_table.php
+++ b/classes/table/deactivated_workflows_table.php
@@ -21,7 +21,6 @@
  * @copyright  2018 Yorick Reum, JMU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-
 namespace tool_lifecycle\table;
 
 use tool_lifecycle\action;
@@ -33,12 +32,18 @@ defined('MOODLE_INTERNAL') || die;
 
 require_once($CFG->libdir . '/tablelib.php');
 
+/**
+ * Table listing deactivated workflows
+ *
+ * @package tool_lifecycle
+ * @copyright  2018 Yorick Reum, JMU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class deactivated_workflows_table extends workflow_table {
 
     /**
-     * deactivated_workflows_table constructor.
-     *
-     * @param string $uniqueid
+     * Constructor for deactivated_workflows_table.
+     * @param int $uniqueid Unique id of this table.
      */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
@@ -53,6 +58,9 @@ class deactivated_workflows_table extends workflow_table {
         $this->init();
     }
 
+    /**
+     * Initialize the table.
+     */
     public function init() {
         $this->define_columns(['title', 'timedeactive', 'processes', 'tools']);
         $this->define_headers([
@@ -68,8 +76,10 @@ class deactivated_workflows_table extends workflow_table {
     /**
      * Render tools column.
      *
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for workflows
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_tools($row) {
         global $OUTPUT;
diff --git a/classes/table/interaction_attention_table.php b/classes/table/interaction_attention_table.php
index ded5263..845b413 100644
--- a/classes/table/interaction_attention_table.php
+++ b/classes/table/interaction_attention_table.php
@@ -31,8 +31,20 @@ defined('MOODLE_INTERNAL') || die;
 
 require_once($CFG->libdir . '/tablelib.php');
 
+/**
+ * Table listing all courses for a specific user and a specific subplugin
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class interaction_attention_table extends interaction_table {
 
+    /**
+     * Constructor for deactivated_workflows_table.
+     * @param int $uniqueid Unique id of this table.
+     * @param int[] $courseids List of ids for courses that require attention.
+     */
     public function __construct($uniqueid, $courseids) {
         parent::__construct($uniqueid);
         global $PAGE;
@@ -76,8 +88,10 @@ class interaction_attention_table extends interaction_table {
 
     /**
      * Render tools column.
-     * @param $row
+     * @param object $row Row data.
      * @return string pluginname of the subplugin
+     * @throws \coding_exception
+     * @throws \invalid_parameter_exception
      */
     public function col_tools($row) {
         $output = '';
@@ -92,7 +106,7 @@ class interaction_attention_table extends interaction_table {
 
     /**
      * Render date column.
-     * @param $row
+     * @param object $row Row data.
      * @return string pluginname of the subplugin
      */
     public function col_date($row) {
@@ -109,12 +123,13 @@ class interaction_attention_table extends interaction_table {
     /**
      * Util function for writing an action icon link
      *
-     * @param string $action    URL parameter to include in the link
+     * @param string $action URL parameter to include in the link
      * @param string $processid URL parameter to include in the link
-     * @param int    $stepinstanceid ID of the step instance
-     * @param string $alt       The string description of the link used as the title and alt text
+     * @param int $stepinstanceid ID of the step instance
+     * @param string $alt The string description of the link used as the title and alt text
      *
      * @return string The icon/link
+     * @throws \moodle_exception
      */
     private function format_icon_link($action, $processid, $stepinstanceid, $alt) {
         global $PAGE, $OUTPUT;
diff --git a/classes/table/interaction_remaining_table.php b/classes/table/interaction_remaining_table.php
index 63569ac..8d84ea9 100644
--- a/classes/table/interaction_remaining_table.php
+++ b/classes/table/interaction_remaining_table.php
@@ -30,11 +30,23 @@ defined('MOODLE_INTERNAL') || die;
 
 require_once($CFG->libdir . '/tablelib.php');
 
+/**
+ * Table listing all courses for a specific user and a specific subplugin
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class interaction_remaining_table extends interaction_table {
 
-    /** manual_trigger_tool[] list of all available trigger tools. */
+    /** @var manual_trigger_tool[] $availabletools list of all available trigger tools. */
     private $availabletools;
 
+    /**
+     * Constructor for deactivated_workflows_table.
+     * @param int $uniqueid Unique id of this table.
+     * @param int[] $courseids List of ids for courses that require no attention.
+     */
     public function __construct($uniqueid, $courseids) {
         parent::__construct($uniqueid);
         global $PAGE;
@@ -97,8 +109,10 @@ class interaction_remaining_table extends interaction_table {
 
     /**
      * Render tools column.
-     * @param $row
-     * @return string pluginname of the subplugin
+     * @param object $row Row data.
+     * @return string Rendered tools html
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_tools($row) {
         global $PAGE, $OUTPUT;
@@ -130,6 +144,14 @@ class interaction_remaining_table extends interaction_table {
         return $OUTPUT->render($menu);
     }
 
+    /**
+     * Render status column.
+     * @param object $row Row data.
+     * @return string Rendered status html
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \invalid_parameter_exception
+     */
     public function col_status($row) {
         $processstatus = parent::col_status($row);
         // If current process has status, show status.
@@ -147,6 +169,13 @@ class interaction_remaining_table extends interaction_table {
         return $interactionlib->get_action_string($row->action, $userlink);
     }
 
+
+    /**
+     * Render lastmodified column.
+     * @param object $row Row data.
+     * @return string Rendered lastmodified html
+     * @throws \coding_exception
+     */
     public function col_lastmodified($row) {
         if (!$row->lastmodified) {
             return '';
diff --git a/classes/table/interaction_table.php b/classes/table/interaction_table.php
index ba207ea..8b2db10 100644
--- a/classes/table/interaction_table.php
+++ b/classes/table/interaction_table.php
@@ -33,8 +33,19 @@ defined('MOODLE_INTERNAL') || die;
 
 require_once($CFG->libdir . '/tablelib.php');
 
+/**
+ * Table listing all courses for a specific user and a specific subplugin
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 abstract class interaction_table extends \table_sql {
 
+    /**
+     * Constructor for interaction_table.
+     * @param int $uniqueid Unique id of this table.
+     */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
         $this->set_attribute('class', $this->attributes['class'] . ' ' . $uniqueid);
@@ -47,7 +58,7 @@ abstract class interaction_table extends \table_sql {
 
     /**
      * Render coursefullname column.
-     * @param $row
+     * @param object $row Row data.
      * @return string course link
      */
     public function col_coursefullname($row) {
@@ -57,7 +68,7 @@ abstract class interaction_table extends \table_sql {
 
     /**
      * Render startdate column.
-     * @param $row
+     * @param object $row Row data.
      * @return string human readable date
      * @throws \coding_exception
      */
@@ -72,15 +83,18 @@ abstract class interaction_table extends \table_sql {
 
     /**
      * Render tools column.
-     * @param $row
-     * @return string pluginname of the subplugin
+     * @param object $row Row data.
+     * @return string Rendered tools html
      */
     public abstract function col_tools($row);
 
     /**
      * Render status column.
-     * @param $row
-     * @return string pluginname of the subplugin
+     * @param object $row Row data.
+     * @return string Rendered status html.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \invalid_parameter_exception
      */
     public function col_status($row) {
         if ($row->processid !== null) {
diff --git a/classes/table/step_table.php b/classes/table/step_table.php
index 4afb9a8..0b85115 100644
--- a/classes/table/step_table.php
+++ b/classes/table/step_table.php
@@ -34,15 +34,25 @@ defined('MOODLE_INTERNAL') || die;
 require_once($CFG->libdir . '/tablelib.php');
 require_once(__DIR__ . '/../../lib.php');
 
+/**
+ * Table listing step instances
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class step_table extends \table_sql {
 
-    /** int workflowid */
+    /** @var int $workflowid If of the workflow. */
     private $workflowid;
 
     /**
      * step_table constructor.
-     * @param string $uniqueid
-     * @param int $workflowid
+     * @param string $uniqueid Unique id of the table.
+     * @param int $workflowid Id of the workflow instance.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \moodle_exception
      */
     public function __construct($uniqueid, $workflowid) {
         parent::__construct($uniqueid);
@@ -58,6 +68,14 @@ class step_table extends \table_sql {
         $this->init();
     }
 
+    /**
+     * Take the data returned from the db_query and go through all the rows
+     * processing each col using either col_{columnname} method or other_cols
+     * method or if other_cols returns NULL then put the data straight into the
+     * table.
+     *
+     * After calling this function, don't forget to call close_recordset.
+     */
     public function build_table() {
         $triggers = trigger_manager::get_triggers_for_workflow($this->workflowid);
         foreach ($triggers as $trigger) {
@@ -75,6 +93,9 @@ class step_table extends \table_sql {
         return parent::build_table();
     }
 
+    /**
+     * Initialize the table.
+     */
     public function init() {
         $columns = ['type', 'instancename', 'subpluginname'];
         $headers = [
@@ -106,8 +127,9 @@ class step_table extends \table_sql {
 
     /**
      * Render the type column. This column displays Trigger or Step, depending of the type of the subplugin.
-     * @param $row
+     * @param object $row Row data.
      * @return string type of the subplugin
+     * @throws \coding_exception
      */
     public function col_type($row) {
         if ($row->type == 'step') {
@@ -118,8 +140,9 @@ class step_table extends \table_sql {
 
     /**
      * Render subpluginname column.
-     * @param $row
+     * @param object $row Row data.
      * @return string pluginname of the subplugin
+     * @throws \coding_exception
      */
     public function col_subpluginname($row) {
 
@@ -133,8 +156,10 @@ class step_table extends \table_sql {
 
     /**
      * Render sortindex column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for changing sortorder of the subplugin
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_sortindex($row) {
         global $OUTPUT;
@@ -185,8 +210,10 @@ class step_table extends \table_sql {
 
     /**
      * Render edit column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action button for editing of the subplugin
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_edit($row) {
 
@@ -203,8 +230,10 @@ class step_table extends \table_sql {
 
     /**
      * Render show column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action button for editing of the subplugin
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_show_action($row) {
 
@@ -221,8 +250,10 @@ class step_table extends \table_sql {
 
     /**
      * Render delete column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action button for deleting the subplugin
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_delete($row) {
 
@@ -244,6 +275,7 @@ class step_table extends \table_sql {
      * @param string $icon The key to the icon to use (e.g. 't/up')
      * @param string $alt The string description of the link used as the title and alt text
      * @return string The icon/link
+     * @throws \moodle_exception
      */
     private function format_icon_link($action, $subpluginid, $icon, $alt) {
         global $PAGE, $OUTPUT;
diff --git a/classes/table/workflow_definition_table.php b/classes/table/workflow_definition_table.php
index d3ad10c..631865c 100644
--- a/classes/table/workflow_definition_table.php
+++ b/classes/table/workflow_definition_table.php
@@ -34,8 +34,19 @@ defined('MOODLE_INTERNAL') || die;
 require_once($CFG->libdir . '/tablelib.php');
 require_once(__DIR__ . '/../../lib.php');
 
+/**
+ * Table listing all workflow definitions.
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class workflow_definition_table extends workflow_table {
 
+    /**
+     * Constructor for workflow_definition_table.
+     * @param int $uniqueid Unique id of this table.
+     */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
         global $PAGE;
@@ -47,6 +58,9 @@ class workflow_definition_table extends workflow_table {
         $this->init();
     }
 
+    /**
+     * Initialize the table.
+     */
     public function init() {
         $this->define_columns(['title', 'timeactive', 'tools']);
         $this->define_headers([
@@ -60,8 +74,10 @@ class workflow_definition_table extends workflow_table {
 
     /**
      * Render activate column.
-     * @param $row
+     * @param object $row Row data.
      * @return string activate time for workflows
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_timeactive($row) {
         global $OUTPUT, $PAGE;
@@ -82,8 +98,10 @@ class workflow_definition_table extends workflow_table {
 
     /**
      * Render tools column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for workflows
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_tools($row) {
         global $OUTPUT;
diff --git a/classes/table/workflow_table.php b/classes/table/workflow_table.php
index bbaa98d..6ad6527 100644
--- a/classes/table/workflow_table.php
+++ b/classes/table/workflow_table.php
@@ -34,8 +34,19 @@ defined('MOODLE_INTERNAL') || die;
 require_once($CFG->libdir . '/tablelib.php');
 require_once(__DIR__ . '/../../lib.php');
 
+/**
+ * Table listing all active automatically triggered workflows.
+ *
+ * @package tool_lifecycle
+ * @copyright  2018 Jan Dageförde WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 abstract class workflow_table extends \table_sql {
 
+    /**
+     * Constructor for workflow_table.
+     * @param int $uniqueid Unique id of this table.
+     */
     public function __construct($uniqueid) {
         parent::__construct($uniqueid);
         $this->set_attribute('class', $this->attributes['class'] . ' ' . $uniqueid);
@@ -43,7 +54,8 @@ abstract class workflow_table extends \table_sql {
 
     /**
      * Render title column.
-     * @param $row
+     * @param object $row Row data.
+     * @return string Rendered title.
      */
     public function col_title($row) {
         return $row->title . '<br><span class="workflow_displaytitle">' . $row->displaytitle . '</span>';
@@ -51,8 +63,10 @@ abstract class workflow_table extends \table_sql {
 
     /**
      * Render activate column.
-     * @param $row
+     * @param object $row Row data.
      * @return string activate time for workflows
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_timeactive($row) {
         global $OUTPUT, $PAGE;
@@ -68,8 +82,9 @@ abstract class workflow_table extends \table_sql {
 
     /**
      * Render deactivated column.
-     * @param $row
+     * @param object $row Row data.
      * @return string deactivate time for workflows
+     * @throws \coding_exception
      */
     public function col_timedeactive($row) {
         if ($row->timedeactive) {
@@ -80,7 +95,7 @@ abstract class workflow_table extends \table_sql {
 
     /**
      * Render the trigger column.
-     * @param $row
+     * @param object $row Row data.
      * @return string instancename of the trigger
      */
     public function col_trigger($row) {
@@ -97,8 +112,9 @@ abstract class workflow_table extends \table_sql {
 
     /**
      * Render the processes column. It shows the number of active processes for the workflow instance.
-     * @param $row
-     * @return string instancename of the trigger
+     * @param object $row Row data.
+     * @return string Number of processes.
+     * @throws \dml_exception
      */
     public function col_processes($row) {
         return process_manager::count_processes_by_workflow($row->id);
@@ -106,8 +122,10 @@ abstract class workflow_table extends \table_sql {
 
     /**
      * Render tools column.
-     * @param $row
+     * @param object $row Row data.
      * @return string action buttons for workflows
+     * @throws \coding_exception
+     * @throws \moodle_exception
      */
     public function col_tools($row) {
         global $OUTPUT;
@@ -131,6 +149,7 @@ abstract class workflow_table extends \table_sql {
      * @param string $icon The key to the icon to use (e.g. 't/up')
      * @param string $alt The string description of the link used as the title and alt text
      * @return string The icon/link
+     * @throws \moodle_exception
      */
     protected function format_icon_link($action, $workflowid, $icon, $alt) {
         global $OUTPUT;
diff --git a/classes/task/lifecycle_task.php b/classes/task/lifecycle_task.php
index 12092df..a1b5481 100644
--- a/classes/task/lifecycle_task.php
+++ b/classes/task/lifecycle_task.php
@@ -29,12 +29,28 @@ use tool_lifecycle\processor;
 
 defined('MOODLE_INTERNAL') || die;
 
+/**
+ * Scheduled task for working on lifecycle processes
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class lifecycle_task extends \core\task\scheduled_task {
 
+    /**
+     * Get a descriptive name for this task (shown to admins).
+     *
+     * @return string
+     * @throws \coding_exception
+     */
     public function get_name() {
         return get_string('lifecycle_task', 'tool_lifecycle');
     }
 
+    /**
+     * Do the job.
+     */
     public function execute() {
         $processor = new processor();
         $processor->call_trigger();
diff --git a/classes/view_controller.php b/classes/view_controller.php
index 02e09eb..28d636d 100644
--- a/classes/view_controller.php
+++ b/classes/view_controller.php
@@ -48,7 +48,9 @@ class view_controller {
      * Handles actions triggered in the view.php and displays the view.
      *
      * @param \renderer_base $renderer
-     *
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \invalid_parameter_exception
      */
     public function handle_view($renderer) {
         global $DB;
@@ -110,6 +112,11 @@ class view_controller {
      * @param string $action triggered action code.
      * @param int $processid id of the process the action was triggered for.
      * @param int $stepid id of the step the action was triggered for.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \invalid_parameter_exception
+     * @throws \moodle_exception
+     * @throws \required_capability_exception
      */
     public function handle_interaction($action, $processid, $stepid) {
         global $PAGE;
@@ -129,6 +136,10 @@ class view_controller {
      *
      * @param int $triggerid id of the trigger whose workflow was requested.
      * @param int $courseid id of the course the workflow was requested for.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \moodle_exception
+     * @throws \required_capability_exception
      */
     public function handle_trigger($triggerid, $courseid) {
         global $PAGE;
diff --git a/db/install.php b/db/install.php
deleted file mode 100644
index 34d36a2..0000000
--- a/db/install.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Install script for lifecycle plugin
- *
- * @package tool_lifecycle
- * @copyright  2017 Tobias Reischmann WWU
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-function xmldb_tool_lifecycle_install() {
-
-}
\ No newline at end of file
diff --git a/db/upgrade.php b/db/upgrade.php
index 56832ca..2d970f4 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -24,6 +24,17 @@
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Update script for tool_lifecycle.
+ * @param int $oldversion Version id of the previously installed version.
+ * @return bool
+ * @throws ddl_exception
+ * @throws ddl_field_missing_exception
+ * @throws ddl_table_missing_exception
+ * @throws dml_exception
+ * @throws downgrade_exception
+ * @throws upgrade_exception
+ */
 function xmldb_tool_lifecycle_upgrade($oldversion) {
 
     global $DB;
diff --git a/lib.php b/lib.php
index 4a38e8f..4e5cabd 100644
--- a/lib.php
+++ b/lib.php
@@ -15,6 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
+ * Lib functions for tool_lifecycle.
  * @package    tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -29,6 +30,8 @@ defined('MOODLE_INTERNAL') || die();
  * @param stdClass $course The course to object for the tool
  * @param context $context The context of the course
  * @return void|null return null if we don't want to display the node.
+ * @throws coding_exception
+ * @throws moodle_exception
  */
 function tool_lifecycle_extend_navigation_course($navigation, $course, $context) {
     global $PAGE;
diff --git a/renderer.php b/renderer.php
index b0f405c..2785700 100644
--- a/renderer.php
+++ b/renderer.php
@@ -23,12 +23,17 @@
  */
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Renderer for life cycle
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class tool_lifecycle_renderer extends plugin_renderer_base {
 
     /**
      * Write the page footer
-     *
-     * @return string
      */
     public function footer() {
         global $OUTPUT;
@@ -38,8 +43,7 @@ class tool_lifecycle_renderer extends plugin_renderer_base {
     /**
      * Write the page header
      *
-     * @param string optional page title.
-     * @return string
+     * @param string $title optional page title.
      */
     public function header($title = null) {
         global $OUTPUT, $PAGE;
@@ -55,6 +59,7 @@ class tool_lifecycle_renderer extends plugin_renderer_base {
      * Renders the workflow upload form including errors, which occured during upload.
      * @param \tool_lifecycle\form\form_upload_workflow $form
      * @param array $errors
+     * @throws coding_exception
      */
     public function render_workflow_upload_form($form, $errors = array()) {
         $this->header(get_string('adminsettings_edit_workflow_definition_heading', 'tool_lifecycle'));
diff --git a/step/createbackup/db/upgrade.php b/step/createbackup/db/upgrade.php
index f6f7217..2884072 100644
--- a/step/createbackup/db/upgrade.php
+++ b/step/createbackup/db/upgrade.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Update script for lifecycles subplugin deletecourse
+ * Update script for lifecycles subplugin createbackup
  *
- * @package tool_lifecycle_step
- * @subpackage createbackup
+ * @package lifecyclestep_createbackup
  * @copyright  2019 WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -28,6 +27,15 @@ use tool_lifecycle\manager\step_manager;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Update script for lifecycles subplugin createbackup.
+ * @param int $oldversion Version id of the previously installed version.
+ * @throws coding_exception
+ * @throws dml_exception
+ * @throws downgrade_exception
+ * @throws moodle_exception
+ * @throws upgrade_exception
+ */
 function xmldb_lifecyclestep_createbackup_upgrade($oldversion) {
 
     if ($oldversion < 2019052900) {
diff --git a/step/createbackup/lang/de/lifecyclestep_createbackup.php b/step/createbackup/lang/de/lifecyclestep_createbackup.php
index c2c09aa..f767e9f 100644
--- a/step/createbackup/lang/de/lifecyclestep_createbackup.php
+++ b/step/createbackup/lang/de/lifecyclestep_createbackup.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for create backup step
  *
- * @package tool_lifecycle_step
- * @subpackage createbackup
+ * @package lifecyclestep_createbackup
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/createbackup/lang/en/lifecyclestep_createbackup.php b/step/createbackup/lang/en/lifecyclestep_createbackup.php
index fc48302..c8dbbb4 100644
--- a/step/createbackup/lang/en/lifecyclestep_createbackup.php
+++ b/step/createbackup/lang/en/lifecyclestep_createbackup.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for create backup step
  *
- * @package tool_lifecycle_step
- * @subpackage createbackup
+ * @package lifecyclestep_createbackup
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/createbackup/lib.php b/step/createbackup/lib.php
index da7306d..2e9a9a8 100644
--- a/step/createbackup/lib.php
+++ b/step/createbackup/lib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype step
- * It has to be implemented by all subplugins.
+ * Step Subplugin for creating a course backup.
  *
- * @package tool_lifecycle_step
- * @subpackage createbackup
+ * @package lifecyclestep_createbackup
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -39,8 +37,16 @@ global $CFG;
 require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
 require_once($CFG->dirroot . '/backup/controller/backup_controller.class.php');
 
+/**
+ * Step Subplugin for creating a course backup.
+ *
+ * @package lifecyclestep_createbackup
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class createbackup extends libbase {
 
+    /** @var int $numberofbackups Backups created so far in this php call. */
     private static $numberofbackups = 0;
 
     /**
@@ -53,6 +59,8 @@ class createbackup extends libbase {
      * @param int $instanceid of the step instance.
      * @param mixed $course to be processed.
      * @return step_response
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function process_course($processid, $instanceid, $course) {
         if (self::$numberofbackups >= settings_manager::get_settings(
@@ -66,20 +74,43 @@ class createbackup extends libbase {
         return step_response::waiting();
     }
 
+    /**
+     * Simply call the process_course since it handles everything necessary for this plugin.
+     * @param int $processid
+     * @param int $instanceid
+     * @param mixed $course
+     * @return step_response
+     * @throws \coding_exception
+     * @throws \dml_exception
+     */
     public function process_waiting_course($processid, $instanceid, $course) {
         return $this->process_course($processid, $instanceid, $course);
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'createbackup';
     }
 
-
+    /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
+     * @return instance_setting[] containing settings keys and PARAM_TYPES
+     */
     public function instance_settings() {
         return array(
             new instance_setting('maximumbackupspercron', PARAM_INT),
         );
     }
+
+    /**
+     * This method can be overriden, to add form elements to the form_step_instance.
+     * It is called in definition().
+     * @param \MoodleQuickForm $mform
+     * @throws \coding_exception
+     */
     public function extend_add_instance_form_definition($mform) {
         $elementname = 'maximumbackupspercron';
         $mform->addElement('text', $elementname,
diff --git a/step/createbackup/version.php b/step/createbackup/version.php
index 53e977c..6a54622 100644
--- a/step/createbackup/version.php
+++ b/step/createbackup/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Create Backup Step
  *
- * @package tool_lifecycle_step
- * @subpackage createbackup
+ * @package lifecyclestep_createbackup
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/deletecourse/db/upgrade.php b/step/deletecourse/db/upgrade.php
index cb2b8b3..b6dd64a 100644
--- a/step/deletecourse/db/upgrade.php
+++ b/step/deletecourse/db/upgrade.php
@@ -17,8 +17,7 @@
 /**
  * Update script for lifecycles subplugin deletecourse
  *
- * @package tool_lifecycle_step
- * @subpackage deletecourse
+ * @package lifecyclestep_deletecourse
  * @copyright  2018 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -28,6 +27,19 @@ use tool_lifecycle\manager\step_manager;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Update script for lifecycles subplugin deletecourse
+ *
+ * @package lifecyclestep_deletecourse
+ * @copyright  2018 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @param int $oldversion Version id of the previously installed version.
+ * @throws coding_exception
+ * @throws dml_exception
+ * @throws downgrade_exception
+ * @throws moodle_exception
+ * @throws upgrade_exception
+ */
 function xmldb_lifecyclestep_deletecourse_upgrade($oldversion) {
 
     if ($oldversion < 2018122300) {
diff --git a/step/deletecourse/lang/de/lifecyclestep_deletecourse.php b/step/deletecourse/lang/de/lifecyclestep_deletecourse.php
index 487926c..7b38ae1 100644
--- a/step/deletecourse/lang/de/lifecyclestep_deletecourse.php
+++ b/step/deletecourse/lang/de/lifecyclestep_deletecourse.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for delete course step
  *
- * @package tool_lifecycle_step
- * @subpackage deletecourse
+ * @package lifecyclestep_deletecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/deletecourse/lang/en/lifecyclestep_deletecourse.php b/step/deletecourse/lang/en/lifecyclestep_deletecourse.php
index 458eaed..82ffeb4 100644
--- a/step/deletecourse/lang/en/lifecyclestep_deletecourse.php
+++ b/step/deletecourse/lang/en/lifecyclestep_deletecourse.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for delete course step
  *
- * @package tool_lifecycle_step
- * @subpackage deletecourse
+ * @package lifecyclestep_deletecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/deletecourse/lib.php b/step/deletecourse/lib.php
index 9520512..a11f014 100644
--- a/step/deletecourse/lib.php
+++ b/step/deletecourse/lib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype step
- * It has to be implemented by all subplugins.
+ * Step subplugin to delete a course.
  *
- * @package tool_lifecycle_step
- * @subpackage deletecourse
+ * @package    lifecyclestep_deletecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -33,8 +31,16 @@ defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/../lib.php');
 
+/**
+ * Step subplugin to delete a course.
+ *
+ * @package    lifecyclestep_deletecourse
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class deletecourse extends libbase {
 
+    /** @var int $numberofdeletions Deletions done so far in this php call. */
     private static $numberofdeletions = 0;
 
     /**
@@ -47,6 +53,8 @@ class deletecourse extends libbase {
      * @param int $instanceid of the step instance.
      * @param mixed $course to be processed.
      * @return step_response
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function process_course($processid, $instanceid, $course) {
         if (self::$numberofdeletions >= settings_manager::get_settings(
@@ -58,16 +66,30 @@ class deletecourse extends libbase {
         return step_response::proceed();
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'deletecourse';
     }
 
+    /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
+     * @return instance_setting[] containing settings keys and PARAM_TYPES
+     */
     public function instance_settings() {
         return array(
             new instance_setting('maximumdeletionspercron', PARAM_INT),
         );
     }
 
+    /**
+     * This method can be overriden, to add form elements to the form_step_instance.
+     * It is called in definition().
+     * @param \MoodleQuickForm $mform
+     * @throws \coding_exception
+     */
     public function extend_add_instance_form_definition($mform) {
         $elementname = 'maximumdeletionspercron';
         $mform->addElement('text', $elementname, get_string('deletecourse_maximumdeletionspercron', 'lifecyclestep_deletecourse'));
diff --git a/step/deletecourse/version.php b/step/deletecourse/version.php
index 05dc243..d22eb27 100644
--- a/step/deletecourse/version.php
+++ b/step/deletecourse/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Delete Course Step
  *
- * @package tool_lifecycle_step
- * @subpackage deletecourse
+ * @package    lifecyclestep_deletecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/duplicate/classes/form_duplicate.php b/step/duplicate/classes/form_duplicate.php
index 412de67..183328c 100644
--- a/step/duplicate/classes/form_duplicate.php
+++ b/step/duplicate/classes/form_duplicate.php
@@ -15,9 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Offers the possibility to enter a new coursename
+ * Offers the possibility to enter a new coursename.
  *
- * @package    tool_lifecycle
+ * @package    lifecyclestep_duplicate
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -31,17 +31,24 @@ defined('MOODLE_INTERNAL') || die();
 require_once($CFG->libdir . '/formslib.php');
 
 /**
- * Provides a form to modify a step instance
+ * Offers the possibility to enter a new coursename.
+ *
+ * @package    lifecyclestep_duplicate
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class form_duplicate extends \moodleform {
 
+    /** @var int $processid Id of the process. */
     private $processid;
+    /** @var int $stepid Id of the step instance. */
     private $stepid;
 
     /**
      * Constructor
-     * @param \moodle_url $url.
-     * @param int $processid if of the process
+     * @param \moodle_url $url Url of the current page.
+     * @param int $processid Id of the process.
+     * @param int $stepid Id of the step instance.
      */
     public function __construct($url, $processid, $stepid) {
         $this->processid = $processid;
diff --git a/step/duplicate/db/access.php b/step/duplicate/db/access.php
index 23efa53..85169b9 100644
--- a/step/duplicate/db/access.php
+++ b/step/duplicate/db/access.php
@@ -16,8 +16,7 @@
 
 /**
  * Capability definitions for the duplication step subplugin
- * @package    lifecycle_step
- * @subpackage duplication
+ * @package    lifecyclestep_duplicate
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/duplicate/interactionlib.php b/step/duplicate/interactionlib.php
index 71d09bb..169c8e2 100644
--- a/step/duplicate/interactionlib.php
+++ b/step/duplicate/interactionlib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the interactions of the subplugintype step
- * It has to be implemented by all subplugins that want to use the interaction view.
+ * Interaction lib for querying course details from the user.
  *
- * @package tool_lifecycle
- * @subpackage step
+ * @package    lifecyclestep_duplicate
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -37,9 +35,16 @@ defined('MOODLE_INTERNAL') || die();
 require_once(__DIR__ . '/../interactionlib.php');
 require_once(__DIR__ . '/lib.php');
 
-
+/**
+ * Interaction lib for querying course details from the user.
+ *
+ * @package    lifecyclestep_duplicate
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class interactionduplicate extends interactionlibbase {
 
+    /** @var string Action string for triggering the duplication interaction form. */
     const ACTION_DUPLICATE_FORM = 'duplicateform';
 
     /**
@@ -57,6 +62,8 @@ class interactionduplicate extends interactionlibbase {
      *  'alt' => a string text of the button
      * @param process $process process the action tools are requested for
      * @return array of action tools
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function get_action_tools($process) {
         $step = step_manager::get_step_instance_by_workflow_index($process->workflowid, $process->stepindex);
@@ -76,6 +83,8 @@ class interactionduplicate extends interactionlibbase {
      * Returns the status message for the given process.
      * @param process $process process the status message is requested for
      * @return string status message
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function get_status_message($process) {
         $step = step_manager::get_step_instance_by_workflow_index($process->workflowid, $process->stepindex);
@@ -97,6 +106,8 @@ class interactionduplicate extends interactionlibbase {
      *      - stillprocessing: the step still wants to process the course and is responsible for rendering the site.
      *      - noaction: the action is not defined for the step.
      *      - rollback: the step has finished and respective controller class should rollback the process.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function handle_interaction($process, $step, $action = 'default') {
         global $PAGE, $DB;
@@ -128,7 +139,7 @@ class interactionduplicate extends interactionlibbase {
 
     /**
      * Renders the duplication form including respective headers and footers.
-     * @param $mform \moodleform to be rendered.
+     * @param \moodleform $mform Form to be rendered.
      */
     private function render_form($mform) {
         global $PAGE;
@@ -143,8 +154,9 @@ class interactionduplicate extends interactionlibbase {
      * Returns the display name for the given action.
      * Used for the past actions table in view.php.
      * @param string $action Identifier of action
-     * @param string $userlink html-link with username as text that refers to the user profile.
+     * @param string $user Html-link with username as text that refers to the user profile.
      * @return string action display name
+     * @throws \coding_exception
      */
     public function get_action_string($action, $user) {
         return get_string('action_new_course_data', 'lifecyclestep_duplicate', $user);
diff --git a/step/duplicate/lang/de/lifecyclestep_duplicate.php b/step/duplicate/lang/de/lifecyclestep_duplicate.php
index f3d9b03..448883c 100644
--- a/step/duplicate/lang/de/lifecyclestep_duplicate.php
+++ b/step/duplicate/lang/de/lifecyclestep_duplicate.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for duplicate step
  *
- * @package tool_lifecycle_step
- * @subpackage duplicate
+ * @package    lifecyclestep_duplicate
  * @copyright  2018 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/duplicate/lang/en/lifecyclestep_duplicate.php b/step/duplicate/lang/en/lifecyclestep_duplicate.php
index 6637e89..cf90c5d 100644
--- a/step/duplicate/lang/en/lifecyclestep_duplicate.php
+++ b/step/duplicate/lang/en/lifecyclestep_duplicate.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for duplicate step
  *
- * @package tool_lifecycle_step
- * @subpackage duplicate
+ * @package    lifecyclestep_duplicate
  * @copyright  2018 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/duplicate/lib.php b/step/duplicate/lib.php
index 609278b..4a969b9 100644
--- a/step/duplicate/lib.php
+++ b/step/duplicate/lib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype step
- * It has to be implemented by all subplugins.
+ * Step subplugin for course duplication.
  *
- * @package tool_lifecycle_step
- * @subpackage email
+ * @package    lifecyclestep_duplicate
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -36,9 +34,18 @@ defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/../lib.php');
 
+/**
+ * Step subplugin for course duplication.
+ *
+ * @package    lifecyclestep_duplicate
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class duplicate extends libbase {
 
+    /** @var string Constant course fullname. */
     const PROC_DATA_COURSEFULLNAME = 'fullname';
+    /** @var string Constant course shortname. */
     const PROC_DATA_COURSESHORTNAME = 'shortname';
 
     /**
@@ -51,6 +58,7 @@ class duplicate extends libbase {
      * @param int $instanceid of the step instance.
      * @param mixed $course to be processed.
      * @return step_response
+     * @throws \dml_exception
      */
     public function process_course($processid, $instanceid, $course) {
         $fullname = process_data_manager::get_process_data($processid, $instanceid, self::PROC_DATA_COURSEFULLNAME);
@@ -85,15 +93,37 @@ class duplicate extends libbase {
      * @param int $instanceid of the step instance.
      * @param mixed $course to be processed.
      * @return step_response
+     * @throws \dml_exception
      */
     public function process_waiting_course($processid, $instanceid, $course) {
         return $this->process_course($processid, $instanceid, $course);
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'duplicate';
     }
 
+
+    /**
+     * Duplicates a course.
+     * @param int $courseid Id of the course.
+     * @param string $fullname Full name of the new course.
+     * @param string $shortname Short name of the new course.
+     * @param int $categoryid New category id.
+     * @param bool $visible New visibility state of the course.
+     * @param array $options Additional options for the new course.
+     * @throws \base_plan_exception
+     * @throws \base_setting_exception
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \moodle_exception
+     * @throws \required_capability_exception
+     * @throws \restore_controller_exception
+     */
     public function duplicate_course($courseid, $fullname, $shortname, $categoryid, $visible, $options) {
         global $USER, $DB, $CFG;
         require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
diff --git a/step/duplicate/version.php b/step/duplicate/version.php
index 6d97c94..41bdba1 100644
--- a/step/duplicate/version.php
+++ b/step/duplicate/version.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Life Cycle Email Step
+ * Life Cycle Duplicate Step
  *
- * @package tool_lifecycle_step
- * @subpackage email
+ * @package    lifecyclestep_duplicate
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/email/db/access.php b/step/email/db/access.php
index 94ddebb..7c33a54 100644
--- a/step/email/db/access.php
+++ b/step/email/db/access.php
@@ -16,8 +16,7 @@
 
 /**
  * Capability definitions for the email step subplugin
- * @package    lifecycle_step
- * @subpackage email
+ * @package lifecyclestep_email
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/email/interactionlib.php b/step/email/interactionlib.php
index e6e96ec..f438bd9 100644
--- a/step/email/interactionlib.php
+++ b/step/email/interactionlib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the interactions of the subplugintype step
- * It has to be implemented by all subplugins that want to use the interaction view.
+ * Implementation for the interactions of the email step.
  *
- * @package tool_lifecycle
- * @subpackage step
+ * @package lifecyclestep_email
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -39,9 +37,16 @@ defined('MOODLE_INTERNAL') || die();
 require_once(__DIR__ . '/../interactionlib.php');
 require_once(__DIR__ . '/lib.php');
 
-
+/**
+ * Implementation for the interactions of the email step.
+ *
+ * @package lifecyclestep_email
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class interactionemail extends interactionlibbase {
 
+    /** @var string Action string for triggering to keep a course. */
     const ACTION_KEEP = 'keep';
 
     /**
@@ -59,6 +64,7 @@ class interactionemail extends interactionlibbase {
      *  'alt' => a string text of the button
      * @param process $process process the action tools are requested for
      * @return array of action tools
+     * @throws \coding_exception
      */
     public function get_action_tools($process) {
         return array(
@@ -72,6 +78,7 @@ class interactionemail extends interactionlibbase {
      * Returns the status message for the given process.
      * @param process $process process the status message is requested for
      * @return string status message
+     * @throws \coding_exception
      */
     public function get_status_message($process) {
         return get_string('status_message_requiresattention', 'lifecyclestep_email');
@@ -97,7 +104,11 @@ class interactionemail extends interactionlibbase {
 
     /**
      * Returns the due date.
-     * @return null
+     * @param int $processid Id of the process.
+     * @param int $stepid Id of the step instance.
+     * @return string formatted date.
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function get_due_date($processid, $stepid) {
         $process = process_manager::get_process_by_id($processid);
@@ -123,8 +134,9 @@ class interactionemail extends interactionlibbase {
      * Returns the display name for the given action.
      * Used for the past actions table in view.php.
      * @param string $action Identifier of action
-     * @param string $userlink html-link with username as text that refers to the user profile.
+     * @param string $user html-link with username as text that refers to the user profile.
      * @return string action display name
+     * @throws \coding_exception
      */
     public function get_action_string($action, $user) {
         return get_string('action_prevented_deletion', 'lifecyclestep_email', $user);
diff --git a/step/email/lang/de/lifecyclestep_email.php b/step/email/lang/de/lifecyclestep_email.php
index bf53c04..2a6c2a2 100644
--- a/step/email/lang/de/lifecyclestep_email.php
+++ b/step/email/lang/de/lifecyclestep_email.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for email step
  *
- * @package tool_lifecycle_step
- * @subpackage email
+ * @package lifecyclestep_email
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/email/lang/en/lifecyclestep_email.php b/step/email/lang/en/lifecyclestep_email.php
index ac523c6..529f0a9 100644
--- a/step/email/lang/en/lifecyclestep_email.php
+++ b/step/email/lang/en/lifecyclestep_email.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for email step
  *
- * @package tool_lifecycle_step
- * @subpackage email
+ * @package lifecyclestep_email
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/email/lib.php b/step/email/lib.php
index 5a12017..7d9eb36 100644
--- a/step/email/lib.php
+++ b/step/email/lib.php
@@ -15,16 +15,14 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype step
- * It has to be implemented by all subplugins.
- *
- * @package tool_lifecycle_step
- * @subpackage email
+ * Step subplugin for sending out emails to the teacher.
+ * @package lifecyclestep_email
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 namespace tool_lifecycle\step;
 
+use core_user;
 use tool_lifecycle\manager\process_manager;
 use tool_lifecycle\manager\settings_manager;
 use tool_lifecycle\response\step_response;
@@ -38,9 +36,14 @@ require_once(__DIR__ . '/../lib.php');
 
 define('EMAIL_PROCDATA_KEY_KEEP', 'keep');
 
+/**
+ * Step subplugin for sending out emails to the teacher.
+ * @package lifecyclestep_email
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 class email extends libbase {
 
-
     /**
      * Processes the course and returns a repsonse.
      * The response tells either
@@ -51,6 +54,8 @@ class email extends libbase {
      * @param int $instanceid of the step instance.
      * @param mixed $course to be processed.
      * @return step_response
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function process_course($processid, $instanceid, $course) {
         global $DB;
@@ -76,6 +81,8 @@ class email extends libbase {
      * @param int $instanceid of the step instance.
      * @param mixed $course to be processed.
      * @return step_response
+     * @throws \coding_exception
+     * @throws \dml_exception
      */
     public function process_waiting_course($processid, $instanceid, $course) {
         // When time runs up and no one wants to keep the course, then proceed.
@@ -89,6 +96,9 @@ class email extends libbase {
         return step_response::waiting();
     }
 
+    /**
+     * Send emails to all teachers, but only one mail per teacher.
+     */
     public function post_processing_bulk_operation() {
         global $DB, $PAGE;
         $stepinstances = step_manager::get_step_instances_by_subpluginname($this->get_subpluginname());
@@ -127,8 +137,12 @@ class email extends libbase {
     /**
      * Replaces certain placeholders within the mail template.
      * @param string[] $strings array of mail templates.
-     * @param mixed $user user object
+     * @param core_user $user User object.
+     * @param int $stepid Id of the step instance.
+     * @param array[] $mailentries Array consisting of course entries from the database.
      * @return string[] array of mail text.
+     * @throws \dml_exception
+     * @throws \moodle_exception
      */
     private function replace_placeholders($strings, $user, $stepid, $mailentries) {
         global $CFG;
@@ -182,6 +196,7 @@ class email extends libbase {
      * Parses a course for the non html format.
      * @param int $courseid id of the course
      * @return string
+     * @throws \dml_exception
      */
     private function parse_course($courseid) {
         $course = get_course($courseid);
@@ -193,12 +208,17 @@ class email extends libbase {
      * Parses a course for the html format.
      * @param int $courseid id of the course
      * @return array column of a course
+     * @throws \dml_exception
      */
     private function parse_course_row_data($courseid) {
         $course = get_course($courseid);
         return array($course->fullname);
     }
 
+    /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
+     * @return instance_setting[] containing settings keys and PARAM_TYPES
+     */
     public function instance_settings() {
         return array(
             new instance_setting('responsetimeout', PARAM_INT),
@@ -208,10 +228,20 @@ class email extends libbase {
         );
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'email';
     }
 
+    /**
+     * This method can be overriden, to add form elements to the form_step_instance.
+     * It is called in definition().
+     * @param \MoodleQuickForm $mform
+     * @throws \coding_exception
+     */
     public function extend_add_instance_form_definition($mform) {
         $elementname = 'responsetimeout';
         $mform->addElement('duration', $elementname, get_string('email_responsetimeout', 'lifecyclestep_email'));
@@ -232,6 +262,12 @@ class email extends libbase {
         $mform->setType($elementname, PARAM_RAW);
     }
 
+    /**
+     * This method can be overriden, to set default values to the form_step_instance.
+     * It is called in definition_after_data().
+     * @param \MoodleQuickForm $mform
+     * @param array $settings array containing the settings from the db.
+     */
     public function extend_add_instance_form_definition_after_data($mform, $settings) {
         $mform->setDefault('contenthtml', array('text' => $settings['contenthtml'], 'format' => FORMAT_HTML));
     }
diff --git a/step/email/version.php b/step/email/version.php
index 1dd4f3c..4de3b26 100644
--- a/step/email/version.php
+++ b/step/email/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Email Step
  *
- * @package tool_lifecycle_step
- * @subpackage email
+ * @package lifecyclestep_email
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/step/interactionlib.php b/step/interactionlib.php
index 5b2aef7..038042e 100644
--- a/step/interactionlib.php
+++ b/step/interactionlib.php
@@ -15,9 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the interactions of the subplugintype step
- * It has to be implemented by all subplugins that want to use the interaction view.
+ * Interface for the interactions of the subplugintype step.
  *
+ * It has to be implemented by all subplugins that want to use the interaction view.
  * @package tool_lifecycle
  * @subpackage step
  * @copyright  2017 Tobias Reischmann WWU
@@ -26,12 +26,22 @@
 namespace tool_lifecycle\step;
 
 use core_user;
+use MongoDB\BSON\Timestamp;
 use tool_lifecycle\entity\process;
 use tool_lifecycle\entity\step_subplugin;
 use tool_lifecycle\response\step_interactive_response;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Interface for the interactions of the subplugintype step.
+ *
+ * It has to be implemented by all subplugins that want to use the interaction view.
+ * @package tool_lifecycle
+ * @subpackage step
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 abstract class interactionlibbase {
 
     /**
@@ -70,7 +80,7 @@ abstract class interactionlibbase {
      * Returns the display name for the given action.
      * Used for the past actions table in view.php.
      * @param string $action Identifier of action
-     * @param string $userlink html-link with username as text that refers to the user profile.
+     * @param string $user html-link with username as text that refers to the user profile.
      * @return string action display name
      */
     public abstract function get_action_string($action, $user);
@@ -90,7 +100,9 @@ abstract class interactionlibbase {
 
     /**
      * Returns the due date.
-     * @return null | timestamp
+     * @param int $processid Id of the process.
+     * @param int $stepid Id of the step instance.
+     * @return null | string formatted due date.
      */
     public function get_due_date($processid, $stepid) {
         return null;
diff --git a/step/lib.php b/step/lib.php
index 8687bfe..ae70a17 100644
--- a/step/lib.php
+++ b/step/lib.php
@@ -15,11 +15,10 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype step
- * It has to be implemented by all subplugins.
+ * Interface for the subplugintype step.
  *
+ * It has to be implemented by all subplugins.
  * @package tool_lifecycle
- * @subpackage step
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -30,9 +29,16 @@ use tool_lifecycle\response\step_response;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Interface for the subplugintype step.
+ *
+ * It has to be implemented by all subplugins.
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 abstract class libbase {
 
-
     /**
      * Processes the course and returns a repsonse.
      * The response tells either
@@ -93,6 +99,7 @@ abstract class libbase {
     public abstract function get_subpluginname();
 
     /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
      * @return instance_setting[] containing settings keys and PARAM_TYPES
      */
     public function instance_settings() {
@@ -120,7 +127,10 @@ abstract class libbase {
 
 /**
  * Class representing a local settings object for a subplugin instance.
- * @package tool_lifecycle\step
+ *
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class instance_setting {
 
diff --git a/tests/active_workflow_is_manual_test.php b/tests/active_workflow_is_manual_test.php
index 9737e7d..2799297 100644
--- a/tests/active_workflow_is_manual_test.php
+++ b/tests/active_workflow_is_manual_test.php
@@ -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/>.
 
+/**
+ * Tests the field is manual after activating workflows.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2018 WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/generator/lib.php');
@@ -32,13 +40,23 @@ use tool_lifecycle\entity\workflow;
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_workflow_is_manual_testcase extends \advanced_testcase {
+
+    /** Icon of the trigger. */
     const MANUAL_TRIGGER1_ICON = 't/up';
+    /** Action name of the trigger. */
     const MANUAL_TRIGGER1_DISPLAYNAME = 'Up';
+    /** Capability of the trigger. */
     const MANUAL_TRIGGER1_CAPABILITY = 'moodle/course:manageactivities';
 
+    /** @var workflow $manualworkflow Instance of the manual workflow */
     private $manualworkflow;
+    /** @var workflow $automaticworkflow Instance of the automatic workflow */
     private $automaticworkflow;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         global $USER;
         $this->resetAfterTest(true);
diff --git a/tests/active_workflow_sortindex_updown_test.php b/tests/active_workflow_sortindex_updown_test.php
index cbf2d51..85affab 100644
--- a/tests/active_workflow_sortindex_updown_test.php
+++ b/tests/active_workflow_sortindex_updown_test.php
@@ -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/>.
 
+/**
+ * Tests the different state changes of the workflow sortindex for up and down action.
+ *
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/generator/lib.php');
diff --git a/tests/backup_and_restore_workflow_test.php b/tests/backup_and_restore_workflow_test.php
index b05e4d2..b006cce 100644
--- a/tests/backup_and_restore_workflow_test.php
+++ b/tests/backup_and_restore_workflow_test.php
@@ -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/>.
 
+/**
+ * Tests the field is manual after activating workflows.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2018 WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/generator/lib.php');
@@ -41,8 +49,13 @@ class tool_lifecycle_backup_and_restore_workflow_testcase extends \advanced_test
     /** @var $workflow workflow */
     private $workflow;
 
+    /** @var workflow[] $existingworkflows Array of workflows created in this test. */
     private $existingworkflows = [];
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         $this->resetAfterTest(true);
         $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle');
diff --git a/tests/backup_manager_test.php b/tests/backup_manager_test.php
index b05c5fc..dadf053 100644
--- a/tests/backup_manager_test.php
+++ b/tests/backup_manager_test.php
@@ -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/>.
 
+/**
+ * Tests the beckup manager.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\manager\backup_manager;
@@ -22,15 +30,18 @@ use tool_lifecycle\manager\backup_manager;
  * Tests the beckup manager.
  * @package    tool_lifecycle
  * @category   test
- * @group      tool_lifecycle_backup
+ * @group      tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_backup_manager_testcase extends \advanced_testcase {
 
-    /** course */
+    /** @var array $course Instance of the course under test. */
     private $course;
 
+    /**
+     * Setup the testcase.
+     */
     public function setUp() {
         $this->resetAfterTest(false);
         $this->course = $this->getDataGenerator()->create_course();
diff --git a/tests/behat/behat_tool_lifecycle.php b/tests/behat/behat_tool_lifecycle.php
index a73b9d7..b742d30 100644
--- a/tests/behat/behat_tool_lifecycle.php
+++ b/tests/behat/behat_tool_lifecycle.php
@@ -43,9 +43,9 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I click on the tool "([^"]*)" in the "([^"]*)" row of the "([^"]*)" table$/
      *
-     * @param $tool string identifier of the tool
-     * @param $rowname string identifier of the row
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     public function click_on_the_tool_in_the_row_of_the_table($tool, $rowname, $tablename) {
@@ -60,9 +60,9 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I should see the tool "([^"]*)" in the "([^"]*)" row of the "([^"]*)" table$/
      *
-     * @param $tool string identifier of the tool
-     * @param $rowname string identifier of the row
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @return string the selector of the searched tool
      * @throws Exception
      */
@@ -88,8 +88,8 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I should see the tool "([^"]*)" in all rows of the "([^"]*)" table$/
      *
-     * @param $tool string identifier of the tool
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     public function i_should_see_the_tool_in_all_rows_of_the_table($tool, $tablename) {
@@ -118,7 +118,7 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I should not see the table "([^"]*)"$/
      *
-     * @param $tablename string identifier of the table
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     public function i_should_not_see_the_table($tablename) {
@@ -136,7 +136,8 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I should see the row "([^"]*)" in the "([^"]*)" table$/
      *
-     * @param $tablename string identifier of the table
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     public function i_should_see_the_row($rowname, $tablename) {
@@ -155,7 +156,8 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I should not see the row "([^"]*)" in the "([^"]*)" table$/
      *
-     * @param $tablename string identifier of the table
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     public function i_should_not_see_the_row($rowname, $tablename) {
@@ -174,9 +176,9 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I should not see the tool "([^"]*)" in the "([^"]*)" row of the "([^"]*)" table$/
      *
-     * @param $tool string identifier of the tool
-     * @param $rowname string identifier of the row
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     public function i_should_not_see_the_tool_in_the_row_of_the_table($tool, $rowname, $tablename) {
@@ -196,9 +198,9 @@ class behat_tool_lifecycle extends behat_base {
 
     /**
      * If Javascript is active, this function tries to click on an action dropdown, to reveal the underlying actions.
-     * @param $tool string identifier of the tool
-     * @param $rowname string identifier of the row
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     protected function open_or_close_action_menu($tool, $rowname, $tablename) {
@@ -216,7 +218,7 @@ class behat_tool_lifecycle extends behat_base {
 
     /**
      * Build the xpath to the table element with class tablename, throws exceptions if not present.
-     * @param $tablename string identifier of the table
+     * @param string $tablename Identifier of the table
      * @return string xpath of the table
      * @throws ExpectationException
      */
@@ -234,8 +236,8 @@ class behat_tool_lifecycle extends behat_base {
 
     /**
      * Build the xpath to the row element with class $rowname within class tablename, throws exceptions if not present.
-     * @param $rowname string identifier of the row
-     * @param $tablename string identifier of the table
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @return string xpath of the table
      * @throws ExpectationException
      */
@@ -257,9 +259,9 @@ class behat_tool_lifecycle extends behat_base {
 
     /**
      * Build the xpath to the tool element and throws exceptions if either the table or the row are not present.
-     * @param $tool string identifier of the tool
-     * @param $rowname string identifier of the row
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @return string xpath of the tool
      * @throws ExpectationException
      */
@@ -290,9 +292,9 @@ class behat_tool_lifecycle extends behat_base {
 
     /**
      * Build the xpath to the action menu and throws exceptions if either the table or the row are not present.
-     * @param $tool string identifier of the tool
-     * @param $rowname string identifier of the row
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $rowname Identifier of the row
+     * @param string $tablename Identifier of the table
      * @return string xpath of the tool
      * @throws ExpectationException
      */
@@ -324,8 +326,8 @@ class behat_tool_lifecycle extends behat_base {
      *
      * @When /^I should not see the tool "([^"]*)" in any row of the "([^"]*)" table$/
      *
-     * @param $tool string identifier of the tool
-     * @param $tablename string identifier of the table
+     * @param string $tool Identifier of the tool
+     * @param string $tablename Identifier of the table
      * @throws Exception
      */
     public function i_should_not_see_the_tool_in_any_row_of_the_table($tool, $tablename) {
diff --git a/tests/generator/lib.php b/tests/generator/lib.php
index 408733a..254c12d 100644
--- a/tests/generator/lib.php
+++ b/tests/generator/lib.php
@@ -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/>.
 
+/**
+ * tool_lifecycle test generator
+ *
+ * @package    tool_lifecycle
+ * @category   test
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\entity\process;
@@ -27,7 +35,7 @@ use tool_lifecycle\manager\workflow_manager;
 use tool_lifecycle\settings_type;
 
 /**
- * tool_lifecycle generator tests
+ * tool_lifecycle test generator
  *
  * @package    tool_lifecycle
  * @category   test
@@ -36,6 +44,7 @@ use tool_lifecycle\settings_type;
  */
 class tool_lifecycle_generator extends testing_module_generator {
 
+    /** @var array $defaultsteps Default steps configuration. */
     private static $defaultsteps = [
         "deletecourse" => [
             "maximumdeletionspercron" => 10
@@ -50,6 +59,8 @@ class tool_lifecycle_generator extends testing_module_generator {
             "maximumbackupspercron" => 10
         ],
     ];
+
+    /** @var array $defaulttrigger Default trigger configuration. */
     private static $defaulttrigger = [
         "startdatedelay" => [
             "delay" => 10000
@@ -102,6 +113,7 @@ class tool_lifecycle_generator extends testing_module_generator {
      * Creates an artificial workflow without steps, which is triggered manually.
      * @param \stdClass $triggersettings settings of the manual trigger
      * @return workflow
+     * @throws moodle_exception
      */
     public static function create_manual_workflow($triggersettings) {
         // Create Workflow.
@@ -123,9 +135,9 @@ class tool_lifecycle_generator extends testing_module_generator {
 
     /**
      * Creates a step for a given workflow and stores it in the DB
-     * @param $instancename
-     * @param $subpluginname
-     * @param $workflowid
+     * @param string $instancename Name of the subplugin instance.
+     * @param string $subpluginname Name of the subplugin type.
+     * @param int $workflowid Id of the workflow.
      * @return step_subplugin created step
      */
     public static function create_step($instancename, $subpluginname, $workflowid) {
@@ -136,10 +148,10 @@ class tool_lifecycle_generator extends testing_module_generator {
 
     /**
      * Creates a trigger for a given workflow and stores it in the DB
-     * @param $instancename
-     * @param $subpluginname
-     * @param $workflowid
-     * @return step_subplugin created step
+     * @param string $instancename Name of the subplugin instance.
+     * @param string $subpluginname Name of the subplugin type.
+     * @param int $workflowid Id of the workflow.
+     * @return trigger_subplugin created step
      */
     public static function create_trigger($instancename, $subpluginname, $workflowid) {
         $trigger = new trigger_subplugin($instancename, $subpluginname, $workflowid);
@@ -149,6 +161,9 @@ class tool_lifecycle_generator extends testing_module_generator {
 
     /**
      * Creates an artificial workflow with three steps.
+     * @return workflow
+     * @throws coding_exception
+     * @throws moodle_exception
      */
     public static function create_workflow_with_steps() {
         $workflow = self::create_workflow();
@@ -158,6 +173,13 @@ class tool_lifecycle_generator extends testing_module_generator {
         return $workflow;
     }
 
+    /**
+     * Create a process for a combination of course and workflow.
+     * @param int $courseid Id of the course.
+     * @param int $workflowid Id of the workflow.
+     * @return process
+     * @throws dml_exception
+     */
     public static function create_process($courseid, $workflowid) {
         global $DB;
 
diff --git a/tests/manual_trigger_tools_test.php b/tests/manual_trigger_tools_test.php
index a0ded7f..a23ebf4 100644
--- a/tests/manual_trigger_tools_test.php
+++ b/tests/manual_trigger_tools_test.php
@@ -14,9 +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/>.
 
+/**
+ * Tests assembly of manual trigger tools.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2018 Tobias Reischmann, Jan Dageforde WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\action;
+use tool_lifecycle\entity\workflow;
 use tool_lifecycle\manager\workflow_manager;
 use tool_lifecycle\manager\trigger_manager;
 use tool_lifecycle\local\data\manual_trigger_tool;
@@ -30,15 +39,29 @@ use tool_lifecycle\local\data\manual_trigger_tool;
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_manual_trigger_tools_testcase extends \advanced_testcase {
+    /** Icon of the manual trigger 1. */
     const MANUAL_TRIGGER1_ICON = 't/up';
+    /** Display name of the manual trigger 1. */
     const MANUAL_TRIGGER1_DISPLAYNAME = 'Up';
+    /** Capability of the manual trigger 1. */
     const MANUAL_TRIGGER1_CAPABILITY = 'moodle/course:manageactivities';
+
+    /** Icon of the manual trigger 2. */
     const MANUAL_TRIGGER2_ICON = 't/down';
+    /** Display name of the manual trigger 2. */
     const MANUAL_TRIGGER2_DISPLAYNAME = 'Down';
+    /** Capability of the manual trigger 2. */
     const MANUAL_TRIGGER2_CAPABILITY = 'moodle/course:view';
+
+    /** @var workflow $workflow1 Instance of the first workflow. */
     private $workflow1;
+    /** @var workflow $workflow1 Instance of the second workflow. */
     private $workflow2;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         global $USER;
         $this->resetAfterTest(true);
@@ -97,8 +120,8 @@ class tool_lifecycle_manual_trigger_tools_testcase extends \advanced_testcase {
 
     /**
      * Test if a specific manual_trigger_tool exist within an array.
-     * @param $expectedtool manual_trigger_tool searched trigger_tool.
-     * @param $tools manual_trigger_tool[] haystack.
+     * @param manual_trigger_tool $expectedtool searched trigger_tool.
+     * @param manual_trigger_tool[] $tools haystack.
      */
     private function assert_tool_exist($expectedtool, $tools) {
         $found = false;
diff --git a/tests/manually_triggered_process_test.php b/tests/manually_triggered_process_test.php
index 25aa922..96546cc 100644
--- a/tests/manually_triggered_process_test.php
+++ b/tests/manually_triggered_process_test.php
@@ -14,12 +14,22 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Manually triggers a process and tests if process courses proceeds the process as expected.
+ *
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2018 WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/generator/lib.php');
 require_once(__DIR__ . '/../lib.php');
 
 use tool_lifecycle\action;
+use tool_lifecycle\entity\trigger_subplugin;
 use tool_lifecycle\manager\settings_manager;
 use tool_lifecycle\manager\workflow_manager;
 use tool_lifecycle\manager\trigger_manager;
@@ -37,13 +47,24 @@ use tool_lifecycle\settings_type;
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_manually_triggered_process_testcase extends \advanced_testcase {
+    /** Icon of the manual trigger. */
     const MANUAL_TRIGGER1_ICON = 't/up';
+    /** Display name of the manual trigger. */
     const MANUAL_TRIGGER1_DISPLAYNAME = 'Up';
+    /** Capability of the manual trigger. */
     const MANUAL_TRIGGER1_CAPABILITY = 'moodle/course:manageactivities';
 
+
+    /** @var trigger_subplugin[] $trigger Instances of the triggers under test. */
     private $trigger;
+    /** @var array $course Instance of the course under test. */
     private $course;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     * @throws moodle_exception
+     */
     public function setUp() {
         global $USER;
 
diff --git a/tests/persistence/persist_process_data_test.php b/tests/persistence/persist_process_data_test.php
index dafd44e..676a76e 100644
--- a/tests/persistence/persist_process_data_test.php
+++ b/tests/persistence/persist_process_data_test.php
@@ -14,10 +14,19 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Tests creating storing and retrieving process data.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/../../lib.php');
 
+use tool_lifecycle\entity\process;
 use \tool_lifecycle\manager\process_manager;
 use \tool_lifecycle\manager\process_data_manager;
 use \tool_lifecycle\manager\step_manager;
@@ -32,12 +41,19 @@ use \tool_lifecycle\manager\step_manager;
  */
 class tool_lifecycle_persist_process_data_testcase extends \advanced_testcase {
 
-    /** process*/
+    /** @var process $process Instance of the process. */
     private $process;
 
+    /** Key of the process data to be stored and retrieved. */
     const KEY = 'key123';
+    /** Value of the process data to be stored and retrieved. */
     const VALUE = 'value123';
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     * @throws dml_exception
+     */
     public function setUp() {
         $this->resetAfterTest(true);
         $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle');
diff --git a/tests/persistence/persist_process_test.php b/tests/persistence/persist_process_test.php
index aa99b5a..f66d51e 100644
--- a/tests/persistence/persist_process_test.php
+++ b/tests/persistence/persist_process_test.php
@@ -14,10 +14,19 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Tests creating storing and retrieving a process object.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/../../lib.php');
 
+use tool_lifecycle\entity\workflow;
 use tool_lifecycle\manager\delayed_courses_manager;
 use \tool_lifecycle\manager\process_manager;
 
@@ -31,12 +40,16 @@ use \tool_lifecycle\manager\process_manager;
  */
 class tool_lifecycle_persist_process_testcase extends \advanced_testcase {
 
-    /** workflow */
+    /** @var workflow $workflow Instance of the workflow. */
     private $workflow;
 
-    /** course */
+    /** @var array $course Instance of the course. */
     private $course;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         $this->resetAfterTest(true);
         $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle');
@@ -73,7 +86,6 @@ class tool_lifecycle_persist_process_testcase extends \advanced_testcase {
      * Tests deletion of a process when rolledback.
      */
     public function test_process_rollback() {
-        global $CFG;
         $process = process_manager::create_process($this->course->id, $this->workflow->id);
         delayed_courses_manager::set_course_delayed($process->courseid, get_config('tool_lifecycle', 'duration'));
         process_manager::rollback_process($process);
diff --git a/tests/persistence/persist_step_test.php b/tests/persistence/persist_step_test.php
index 36e17ef..a6ffd24 100644
--- a/tests/persistence/persist_step_test.php
+++ b/tests/persistence/persist_step_test.php
@@ -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/>.
 
+/**
+ * Tests creating storing and retrieving a step object.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/../../lib.php');
@@ -32,14 +40,17 @@ use \tool_lifecycle\manager\step_manager;
  */
 class tool_lifecycle_persist_step_testcase extends \advanced_testcase {
 
-    /** workflow */
+    /** @var workflow $workflow Instance of the workflow. */
     private $workflow;
 
-    const INSTANCENAME = 'myinstance';
-    const STEPNAME = 'stepname';
+    /** @var tool_lifecycle_generator $generator Instance of the test generator. */
     private $generator;
 
-
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     * @throws moodle_exception
+     */
     public function setUp() {
         $this->resetAfterTest(true);
         $this->generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle');
diff --git a/tests/persistence/persist_workflow_test.php b/tests/persistence/persist_workflow_test.php
index 86cef59..7f86028 100644
--- a/tests/persistence/persist_workflow_test.php
+++ b/tests/persistence/persist_workflow_test.php
@@ -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/>.
 
+/**
+ * Tests creating storing and retrieving a workflow object.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/../../lib.php');
@@ -31,9 +39,12 @@ use \tool_lifecycle\manager\workflow_manager;
  */
 class tool_lifecycle_persist_workflow_testcase extends \advanced_testcase {
 
-    /** workflow */
+    /** @var workflow $workflow Instance of the workflow. */
     private $workflow;
 
+    /**
+     * Setup the testcase.
+     */
     public function setUp() {
         $this->resetAfterTest(true);
         $record = new stdClass();
diff --git a/tests/process_status_message_test.php b/tests/process_status_message_test.php
index 726fbd2..1b07f79 100644
--- a/tests/process_status_message_test.php
+++ b/tests/process_status_message_test.php
@@ -14,9 +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/>.
 
+/**
+ * Tests assembly of manual trigger tools.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2018 Tamara Gunkel, Jan Dageforde WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\action;
+use tool_lifecycle\entity\workflow;
 use tool_lifecycle\manager\workflow_manager;
 
 /**
@@ -28,13 +37,23 @@ use tool_lifecycle\manager\workflow_manager;
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_process_status_message_testcase extends \advanced_testcase {
+    /** Icon of the manual trigger. */
     const MANUAL_TRIGGER1_ICON = 't/up';
+    /** Display name of the manual trigger. */
     const MANUAL_TRIGGER1_DISPLAYNAME = 'Up';
+    /** Capability of the manual trigger. */
     const MANUAL_TRIGGER1_CAPABILITY = 'moodle/course:manageactivities';
+
+    /** @var workflow $workflow Workflow of this test. */
     private $workflow;
 
+    /** @var tool_lifecycle_generator $generator Instance of the test generator. */
     private $generator;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         global $USER;
 
diff --git a/tests/settings_manager_test.php b/tests/settings_manager_test.php
index abe2ac1..d2eb759 100644
--- a/tests/settings_manager_test.php
+++ b/tests/settings_manager_test.php
@@ -14,9 +14,19 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Tests the settings manager.
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\entity\step_subplugin;
+use tool_lifecycle\entity\trigger_subplugin;
+use tool_lifecycle\entity\workflow;
 use tool_lifecycle\manager\step_manager;
 use tool_lifecycle\manager\settings_manager;
 use tool_lifecycle\manager\subplugin_manager;
@@ -33,14 +43,22 @@ use tool_lifecycle\settings_type;
  */
 class tool_lifecycle_settings_manager_testcase extends \advanced_testcase {
 
-    /** step_subplugin */
+    /** @var step_subplugin $step Instance of the step plugin. */
     private $step;
+    /** @var trigger_subplugin $trigger Instance of the trigger plugin. */
     private $trigger;
+    /** @var workflow $workflow Instance of the workflow. */
     private $workflow;
 
+    /** @var string constant value for the email. */
     const EMAIL_VALUE = 'value';
+    /** @var int constant value for start delay. */
     const STARTDELAY_VALUE = 100;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         $this->resetAfterTest(false);
         $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle');
diff --git a/tests/workflow_actions_testcase.php b/tests/workflow_actions_testcase.php
index a6affc5..e3a81b6 100644
--- a/tests/workflow_actions_testcase.php
+++ b/tests/workflow_actions_testcase.php
@@ -14,11 +14,20 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Setup for workflow actions tests.
+ *
+ * @package    tool_lifecycle
+ * @category   test
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/generator/lib.php');
 require_once(__DIR__ . '/../lib.php');
 
+use tool_lifecycle\entity\workflow;
 use tool_lifecycle\manager\workflow_manager;
 
 /**
@@ -26,15 +35,21 @@ use tool_lifecycle\manager\workflow_manager;
  *
  * @package    tool_lifecycle
  * @category   test
- * @group      tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 abstract class workflow_actions_testcase extends \advanced_testcase {
+    /** @var workflow $workflow1 Instance of the first workflow. */
     protected $workflow1;
+    /** @var workflow $workflow2 Instance of the second workflow. */
     protected $workflow2;
+    /** @var workflow $workflow3 Instance of the third workflow. */
     protected $workflow3;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         global $USER;
         // We do not need a sesskey check in theses tests.
diff --git a/tests/workflow_activate_disable_duplicate_test.php b/tests/workflow_activate_disable_duplicate_test.php
index 401a053..f63f2e9 100644
--- a/tests/workflow_activate_disable_duplicate_test.php
+++ b/tests/workflow_activate_disable_duplicate_test.php
@@ -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/>.
 
+/**
+ * Tests activating, disabling and duplicating workflows
+ *
+ * @package    tool_lifecycle
+ * @category   test
+ * @group      tool_lifecycle
+ * @copyright  2018 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 require_once(__DIR__ . '/generator/lib.php');
diff --git a/trigger/categories/lang/de/lifecycletrigger_categories.php b/trigger/categories/lang/de/lifecycletrigger_categories.php
index 306f56c..4711e72 100644
--- a/trigger/categories/lang/de/lifecycletrigger_categories.php
+++ b/trigger/categories/lang/de/lifecycletrigger_categories.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Lang strings for categories delay trigger
+ * Lang strings for categories trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package lifecycletrigger_categories
  * @copyright  2018 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/categories/lang/en/lifecycletrigger_categories.php b/trigger/categories/lang/en/lifecycletrigger_categories.php
index 8236d9d..178e036 100644
--- a/trigger/categories/lang/en/lifecycletrigger_categories.php
+++ b/trigger/categories/lang/en/lifecycletrigger_categories.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Lang strings for categories delay trigger
+ * Lang strings for categories trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package lifecycletrigger_categories
  * @copyright  2018 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/categories/lib.php b/trigger/categories/lib.php
index 21fe0f4..902231a 100644
--- a/trigger/categories/lib.php
+++ b/trigger/categories/lib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype trigger
- * It has to be implemented by all subplugins.
+ * Trigger subplugin to include or exclude courses of certain categories.
  *
- * @package tool_lifecycle_trigger
- * @subpackage categories
+ * @package lifecycletrigger_categories
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -36,14 +34,16 @@ require_once(__DIR__ . '/../../lib.php');
 
 /**
  * Class which implements the basic methods necessary for a cleanyp courses trigger subplugin
- * @package tool_lifecycle_trigger
+ * @package lifecycletrigger_categories
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class categories extends base_automatic {
 
     /**
      * Checks the course and returns a repsonse, which tells if the course should be further processed.
-     * @param $course object to be processed.
-     * @param $triggerid int id of the trigger instance.
+     * @param object $course Course to be processed.
+     * @param int $triggerid Id of the trigger instance.
      * @return trigger_response
      */
     public function check_course($course, $triggerid) {
@@ -51,6 +51,14 @@ class categories extends base_automatic {
         return trigger_response::trigger();
     }
 
+    /**
+     * Return sql sniplet for including (or excluding) the courses belonging to specific categories
+     * and all their children.
+     * @param int $triggerid Id of the trigger.
+     * @return array A list containing the constructed sql fragment and an array of parameters.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     */
     public function get_course_recordset_where($triggerid) {
         global $DB, $CFG;
         $categories = settings_manager::get_settings($triggerid, settings_type::TRIGGER)['categories'];
@@ -81,10 +89,18 @@ class categories extends base_automatic {
         return array($where, $inparams);
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'categories';
     }
 
+    /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
+     * @return instance_setting[] containing settings keys and PARAM_TYPES
+     */
     public function instance_settings() {
         return array(
             new instance_setting('categories', PARAM_SEQUENCE),
@@ -92,6 +108,13 @@ class categories extends base_automatic {
         );
     }
 
+    /**
+     * This method can be overriden, to add form elements to the form_step_instance.
+     * It is called in definition().
+     * @param \MoodleQuickForm $mform
+     * @throws \coding_exception
+     * @throws \dml_exception
+     */
     public function extend_add_instance_form_definition($mform) {
         global $DB;
         $categories = $DB->get_records('course_categories');
diff --git a/trigger/categories/tests/generator/lib.php b/trigger/categories/tests/generator/lib.php
index 5d11fb2..6cc8b9f 100644
--- a/trigger/categories/tests/generator/lib.php
+++ b/trigger/categories/tests/generator/lib.php
@@ -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/>.
 
+/**
+ * lifecycletrigger_categories generator tests
+ *
+ * @package    lifecycletrigger_categories
+ * @category   test
+ * @copyright  2018 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\entity\trigger_subplugin;
@@ -35,7 +43,9 @@ class tool_lifecycle_trigger_categories_generator extends testing_module_generat
 
     /**
      * Creates a trigger startdatedelay for an artificial workflow without steps.
-     * @return trigger_subplugin the created startdatedelay trigger.
+     * @param array $data Data which is used to fill the triggers with certain settings.
+     * @return trigger_subplugin The created startdatedelay trigger.
+     * @throws moodle_exception
      */
     public static function create_trigger_with_workflow($data) {
         // Create Workflow.
diff --git a/trigger/categories/tests/trigger_test.php b/trigger/categories/tests/trigger_test.php
index 02e0e3d..b841b12 100644
--- a/trigger/categories/tests/trigger_test.php
+++ b/trigger/categories/tests/trigger_test.php
@@ -14,8 +14,17 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Trigger test for categories trigger.
+ *
+ * @package    lifecycletrigger_categories
+ * @group      lifecycletrigger
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\trigger;
 
+use tool_lifecycle\entity\trigger_subplugin;
 use tool_lifecycle\processor;
 use tool_lifecycle\response\trigger_response;
 
@@ -27,23 +36,30 @@ require_once(__DIR__ . '/generator/lib.php');
 /**
  * Trigger test for categories trigger.
  *
- * @package    tool_lifecycle_trigger
- * @category   categories
- * @group tool_lifecycle_trigger
+ * @package    lifecycletrigger_categories
+ * @group      lifecycletrigger
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_trigger_categories_testcase extends \advanced_testcase {
 
+    /** @var trigger_subplugin $excludetrigger Trigger instance that excludes a category. */
     private $excludetrigger;
+    /** @var trigger_subplugin $includetrigger Trigger instance that includes a category. */
     private $includetrigger;
 
+    /** @var \core_course_category $category A category. */
     private $category;
+    /** @var \core_course_category $category A child category. */
     private $childcategory;
 
-    /**@var processor Instance of the lifecycle processor */
+    /** @var processor $processor Instance of the lifecycle processor */
     private $processor;
 
+    /**
+     * Setup the testcase.
+     * @throws \moodle_exception
+     */
     public function setUp() {
         $this->resetAfterTest(true);
         $this->setAdminUser();
diff --git a/trigger/categories/version.php b/trigger/categories/version.php
index 33abaa7..ac5c1e5 100644
--- a/trigger/categories/version.php
+++ b/trigger/categories/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Categories Trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage categories
+ * @package lifecycletrigger_categories
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/delayedcourses/db/install.php b/trigger/delayedcourses/db/install.php
index 465ef53..fe8eb61 100644
--- a/trigger/delayedcourses/db/install.php
+++ b/trigger/delayedcourses/db/install.php
@@ -17,8 +17,8 @@
 /**
  * Install script for lifecycle subplugin
  *
- * @package tool_lifecycle_trigger
- * @subpackage delayedcourses
+ * @package lifecycletrigger_delayedcourses
+
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -26,6 +26,9 @@ use tool_lifecycle\manager\trigger_manager;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Register delayed courses as initial workflow.
+ */
 function xmldb_lifecycletrigger_delayedcourses_install() {
     trigger_manager::register_workflow('delayedcourses');
 }
\ No newline at end of file
diff --git a/trigger/delayedcourses/lang/de/lifecycletrigger_delayedcourses.php b/trigger/delayedcourses/lang/de/lifecycletrigger_delayedcourses.php
index 32cdc1c..1dac873 100644
--- a/trigger/delayedcourses/lang/de/lifecycletrigger_delayedcourses.php
+++ b/trigger/delayedcourses/lang/de/lifecycletrigger_delayedcourses.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Lang strings for site course trigger
+ * Lang strings for delayed course trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage delayedcourses
+ * @package lifecycletrigger_delayedcourses
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/delayedcourses/lang/en/lifecycletrigger_delayedcourses.php b/trigger/delayedcourses/lang/en/lifecycletrigger_delayedcourses.php
index 088c10d..4a5dcdc 100644
--- a/trigger/delayedcourses/lang/en/lifecycletrigger_delayedcourses.php
+++ b/trigger/delayedcourses/lang/en/lifecycletrigger_delayedcourses.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Lang strings for site course trigger
+ * Lang strings for delayed course trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage delayedcourses
+ * @package lifecycletrigger_delayedcourses
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/delayedcourses/lib.php b/trigger/delayedcourses/lib.php
index 29f5e9e..df77584 100644
--- a/trigger/delayedcourses/lib.php
+++ b/trigger/delayedcourses/lib.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype trigger
- * It has to be implemented by all subplugins.
+ * Trigger subplugin to exclude delayed courses.
  *
- * @package tool_lifecycle
+ * @package lifecycletrigger_delayedcourses
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -32,25 +31,37 @@ require_once(__DIR__ . '/../lib.php');
 
 /**
  * Class which implements the basic methods necessary for a life cycle trigger subplugin
- * @package tool_lifecycle\trigger
+ * @package lifecycletrigger_delayedcourses
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class delayedcourses extends base_automatic {
 
 
     /**
      * Checks the course and returns a repsonse, which tells if the course should be further processed.
-     * @param $course object to be processed.
-     * @param $triggerid int id of the trigger instance.
+     * @param object $course Course to be processed.
+     * @param int $triggerid Id of the trigger instance.
      * @return trigger_response
      */
     public function check_course($course, $triggerid) {
         return trigger_response::exclude();
     }
 
+    /**
+     * Return sql which excludes delayed courses.
+     * @param int $triggerid Id of the trigger.
+     * @return array A list containing the constructed sql fragment and an array of parameters.
+     */
     public function get_course_recordset_where($triggerid) {
         return delayed_courses_manager::get_course_delayed_wheresql();
     }
 
+
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'delayedcourses';
     }
diff --git a/trigger/delayedcourses/tests/generator/lib.php b/trigger/delayedcourses/tests/generator/lib.php
index 1133d8c..34c50e8 100644
--- a/trigger/delayedcourses/tests/generator/lib.php
+++ b/trigger/delayedcourses/tests/generator/lib.php
@@ -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/>.
 
+/**
+ * lifecycletrigger_delayedcourses generator tests
+ *
+ * @package    lifecycletrigger_delayedcourses
+ * @category   test
+ * @copyright  2018 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\entity\trigger_subplugin;
diff --git a/trigger/delayedcourses/tests/trigger_test.php b/trigger/delayedcourses/tests/trigger_test.php
index a8facbd..2ffaf2a 100644
--- a/trigger/delayedcourses/tests/trigger_test.php
+++ b/trigger/delayedcourses/tests/trigger_test.php
@@ -14,8 +14,17 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Trigger test for delayed courses trigger.
+ *
+ * @package    lifecycletrigger_delayedcourses
+ * @group      lifecycletrigger
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\trigger;
 
+use tool_lifecycle\entity\trigger_subplugin;
 use tool_lifecycle\entity\workflow;
 use tool_lifecycle\processor;
 use tool_lifecycle\manager\delayed_courses_manager;
@@ -29,23 +38,23 @@ require_once(__DIR__ . '/generator/lib.php');
 /**
  * Trigger test for delayed courses trigger.
  *
- * @package    tool_lifecycle_trigger
- * @category   delayedcourses
- * @group tool_lifecycle_trigger
+ * @package    lifecycletrigger_delayedcourses
+ * @group      lifecycletrigger
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_trigger_delayedcourses_testcase extends \advanced_testcase {
 
+    /** @var trigger_subplugin $triggerinstance Instance of the delayedcourses trigger. */
     private $triggerinstance;
 
-    /**@var processor Instance of the lifecycle processor */
+    /** @var processor Instance of the lifecycle processor */
     private $processor;
 
-    /**@var workflow Workflow delaying only processes for itself */
+    /** @var workflow Workflow delaying only processes for itself */
     private $workflow;
 
-    /**@var workflow Workflow delaying processes for all workflows */
+    /** @var workflow Workflow delaying processes for all workflows */
     private $workflowdealayingallworkflows;
 
     public function setUp() {
diff --git a/trigger/delayedcourses/version.php b/trigger/delayedcourses/version.php
index c9ff0a1..5b1fa5e 100644
--- a/trigger/delayedcourses/version.php
+++ b/trigger/delayedcourses/version.php
@@ -15,9 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Life Cycle Site Course Trigger
+ * Life Cycle Delayed Course Trigger
  *
- * @package tool_lifecycle_trigger
+ * @package lifecycletrigger_delayedcourses
  * @subpackage delayedcourses
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
diff --git a/trigger/lib.php b/trigger/lib.php
index ef711d6..1c68d0c 100644
--- a/trigger/lib.php
+++ b/trigger/lib.php
@@ -15,9 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype trigger
- * It has to be implemented by all subplugins.
+ * Interface for the subplugintype trigger.
  *
+ * It has to be implemented by all subplugins.
  * @package tool_lifecycle
  * @subpackage trigger
  * @copyright  2017 Tobias Reischmann WWU
@@ -31,8 +31,11 @@ defined('MOODLE_INTERNAL') || die();
 
 /**
  * This class bundles different functions necessary for every trigger of a workflow.
+ *
  * This class should not be extended directly. Please use base_manual or base_automatic.
- * @package tool_lifecycle\trigger
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 abstract class base {
 
@@ -43,6 +46,7 @@ abstract class base {
     public abstract function get_subpluginname();
 
     /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
      * @return instance_setting[] containing settings keys and PARAM_TYPES
      */
     public function instance_settings() {
@@ -68,8 +72,8 @@ abstract class base {
 
     /**
      * This method can be overriden, to add additional data validation to the instance form.
-     * @param $error
-     * @param $data
+     * @param array $error Array containing all errors.
+     * @param array $data Data passed from the moodle form to be validated
      */
     public function extend_add_instance_form_validation(&$error, $data) {
     }
@@ -95,6 +99,7 @@ abstract class base {
     /**
      * Returns the status message for the trigger.
      * @return string status message
+     * @throws \coding_exception
      */
     public function get_status_message() {
         return get_string("workflow_started", "tool_lifecycle");
@@ -104,19 +109,26 @@ abstract class base {
 
 /**
  * This class represents an automatic trigger.
+ *
  * It is used when workflow should be started based on a specific logic.
- * @package tool_lifecycle\trigger
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 abstract class base_automatic extends base {
 
     /**
      * Checks the course and returns a repsonse, which tells if the course should be further processed.
-     * @param $course object to be processed.
-     * @param $triggerid int id of the trigger instance.
+     * @param object $course Course to be processed.
+     * @param int $triggerid Id of the trigger instance.
      * @return trigger_response
      */
     public abstract function check_course($course, $triggerid);
 
+    /**
+     * Defines if the trigger subplugin is started manually or automatically.
+     * @return bool
+     */
     public function is_manual_trigger() {
         return false;
     }
@@ -126,7 +138,8 @@ abstract class base_automatic extends base {
      * The return value has to consist of an array with two values. The first one includes the where sql statement,
      * which will be concatenated using an 'AND' to the recordset query (e.g. '{course}.id = $courseid').
      * The second one is the set of parameters for the sql query, which will be merged with other param sets.
-     * @params $triggerid int id of the trigger.
+     * @param int $triggerid Id of the trigger.
+     * @return array A list containing the constructed sql fragment and an array of parameters.
      */
     public function get_course_recordset_where($triggerid) {
         return array('', array());
@@ -135,18 +148,28 @@ abstract class base_automatic extends base {
 
 /**
  * This class represents a manual trigger.
+ *
  * It is used to enable user to manually start processes for workflows.
- * @package tool_lifecycle\trigger
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 abstract class base_manual extends base {
 
+    /**
+     * Defines if the trigger subplugin is started manually or automatically.
+     * @return bool
+     */
     public function is_manual_trigger() {
         return true;
     }
 }
+
 /**
  * Class representing a local settings object for a subplugin instance.
- * @package tool_lifecycle\trigger
+ * @package tool_lifecycle
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class instance_setting {
 
diff --git a/trigger/manual/lang/de/lifecycletrigger_manual.php b/trigger/manual/lang/de/lifecycletrigger_manual.php
index 09d0a9d..efde6b1 100644
--- a/trigger/manual/lang/de/lifecycletrigger_manual.php
+++ b/trigger/manual/lang/de/lifecycletrigger_manual.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for manual trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage manual
+ * @package lifecycletrigger_manual
  * @copyright  2018 WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/manual/lang/en/lifecycletrigger_manual.php b/trigger/manual/lang/en/lifecycletrigger_manual.php
index cf11894..94b3c11 100644
--- a/trigger/manual/lang/en/lifecycletrigger_manual.php
+++ b/trigger/manual/lang/en/lifecycletrigger_manual.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for manual trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage manual
+ * @package lifecycletrigger_manual
  * @copyright  2018 WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/manual/lib.php b/trigger/manual/lib.php
index 836db66..b3bc945 100644
--- a/trigger/manual/lib.php
+++ b/trigger/manual/lib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype trigger
- * It has to be implemented by all subplugins.
+ * Trigger subplugin for manual triggers.
  *
- * @package tool_lifecycle_trigger
- * @subpackage manual
+ * @package lifecycletrigger_manual
  * @copyright  2018 WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -30,15 +28,22 @@ require_once(__DIR__ . '/../lib.php');
 
 /**
  * Class which implements the basic methods necessary for a life cycle trigger subplugin
- * @package tool_lifecycle_trigger
+ * @package lifecycletrigger_manual
+ * @copyright  2018 WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class manual extends base_manual {
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'manual';
     }
 
     /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
      * @return instance_setting[] containing settings keys and PARAM_TYPES
      */
     public function instance_settings() {
@@ -52,6 +57,7 @@ class manual extends base_manual {
      * This method can be overriden, to add form elements to the form_step_instance.
      * It is called in definition().
      * @param \MoodleQuickForm $mform
+     * @throws \coding_exception
      */
     public function extend_add_instance_form_definition($mform) {
         $elementname = 'icon';
@@ -84,8 +90,10 @@ class manual extends base_manual {
 
     /**
      * Make all fields required.
-     * @param $error
-     * @param $data
+     * @param array $error Array containing all errors.
+     * @param array $data Data passed from the moodle form to be validated.
+     * @return void the extended error array.
+     * @throws \coding_exception
      */
     public function extend_add_instance_form_validation(&$error, $data) {
         parent::extend_add_instance_form_validation($error, $data);
diff --git a/trigger/manual/version.php b/trigger/manual/version.php
index c6f0f0a..eba9484 100644
--- a/trigger/manual/version.php
+++ b/trigger/manual/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Manual Trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage manual
+ * @package lifecycletrigger_manual
  * @copyright  2018 WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/sitecourse/db/install.php b/trigger/sitecourse/db/install.php
index b251a39..6f5600a 100644
--- a/trigger/sitecourse/db/install.php
+++ b/trigger/sitecourse/db/install.php
@@ -17,8 +17,7 @@
 /**
  * Install script for lifecycle subplugin
  *
- * @package tool_lifecycle_trigger
- * @subpackage sitecourse
+ * @package    lifecycletrigger_sitecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -26,6 +25,9 @@ use tool_lifecycle\manager\trigger_manager;
 
 defined('MOODLE_INTERNAL') || die();
 
+/**
+ * Register site course trigger exclusion as initial workflow.
+ */
 function xmldb_lifecycletrigger_sitecourse_install() {
     trigger_manager::register_workflow('sitecourse');
 }
\ No newline at end of file
diff --git a/trigger/sitecourse/lang/de/lifecycletrigger_sitecourse.php b/trigger/sitecourse/lang/de/lifecycletrigger_sitecourse.php
index ac70fe6..acd54b6 100644
--- a/trigger/sitecourse/lang/de/lifecycletrigger_sitecourse.php
+++ b/trigger/sitecourse/lang/de/lifecycletrigger_sitecourse.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for site course trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package    lifecycletrigger_sitecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/sitecourse/lang/en/lifecycletrigger_sitecourse.php b/trigger/sitecourse/lang/en/lifecycletrigger_sitecourse.php
index e5496ca..330ef9f 100644
--- a/trigger/sitecourse/lang/en/lifecycletrigger_sitecourse.php
+++ b/trigger/sitecourse/lang/en/lifecycletrigger_sitecourse.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for site course trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package    lifecycletrigger_sitecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/sitecourse/lib.php b/trigger/sitecourse/lib.php
index d3bf4ef..3dea124 100644
--- a/trigger/sitecourse/lib.php
+++ b/trigger/sitecourse/lib.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype trigger
- * It has to be implemented by all subplugins.
+ * Trigger subplugin that excludes the sitecourse.
  *
- * @package tool_lifecycle
+ * @package lifecycletrigger_sitecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -31,14 +30,16 @@ require_once(__DIR__ . '/../lib.php');
 
 /**
  * Class which implements the basic methods necessary for a life cycle trigger subplugin
- * @package tool_lifecycle\trigger
+ * @package lifecycletrigger_sitecourse
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class sitecourse extends base_automatic {
 
     /**
      * Checks the course and returns a repsonse, which tells if the course should be further processed.
-     * @param $course object to be processed.
-     * @param $triggerid int id of the trigger instance.
+     * @param object $course Course to be processed.
+     * @param int $triggerid Id of the trigger instance.
      * @return trigger_response
      */
     public function check_course($course, $triggerid) {
@@ -48,12 +49,23 @@ class sitecourse extends base_automatic {
         return trigger_response::next();
     }
 
+    /**
+     * Sql that queries only the sitecourse.
+     * @param int $triggerid Id of the trigger.
+     * @return array A list containing the constructed sql fragment and an array of parameters.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     */
     public function get_course_recordset_where($triggerid) {
         global $DB;
         list($insql, $inparam) = $DB->get_in_or_equal(SITEID, SQL_PARAMS_NAMED);
         return array("{course}.id {$insql}", $inparam);
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'sitecourse';
     }
diff --git a/trigger/sitecourse/tests/generator/lib.php b/trigger/sitecourse/tests/generator/lib.php
index 584db79..94d01c2 100644
--- a/trigger/sitecourse/tests/generator/lib.php
+++ b/trigger/sitecourse/tests/generator/lib.php
@@ -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/>.
 
+/**
+ * lifecycletrigger_sitecourse generator tests
+ *
+ * @package    lifecycletrigger_sitecourse
+ * @category   test
+ * @copyright  2018 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\entity\trigger_subplugin;
diff --git a/trigger/sitecourse/tests/trigger_test.php b/trigger/sitecourse/tests/trigger_test.php
index 1fb30fa..66622f1 100644
--- a/trigger/sitecourse/tests/trigger_test.php
+++ b/trigger/sitecourse/tests/trigger_test.php
@@ -14,8 +14,17 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Trigger test for course site trigger.
+ *
+ * @package    lifecycletrigger_sitecourse
+ * @group      lifecycletrigger
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\trigger;
 
+use tool_lifecycle\entity\trigger_subplugin;
 use tool_lifecycle\response\trigger_response;
 
 defined('MOODLE_INTERNAL') || die();
@@ -26,16 +35,20 @@ require_once(__DIR__ . '/generator/lib.php');
 /**
  * Trigger test for course site trigger.
  *
- * @package    tool_lifecycle_trigger
- * @category   startdatedelay
- * @group tool_lifecycle_trigger
+ * @package    lifecycletrigger_sitecourse
+ * @group      lifecycletrigger
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_trigger_sitecourse_testcase extends \advanced_testcase {
 
+    /** @var trigger_subplugin $triggerinstance Instance of the trigger. */
     private $triggerinstance;
 
+    /**
+     * Setup the testcase.
+     * @throws coding_exception
+     */
     public function setUp() {
         $this->resetAfterTest(true);
         $this->setAdminUser();
diff --git a/trigger/sitecourse/version.php b/trigger/sitecourse/version.php
index d89e6c1..1e4fcac 100644
--- a/trigger/sitecourse/version.php
+++ b/trigger/sitecourse/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Site Course Trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage sitecourse
+ * @package lifecycletrigger_sitecourse
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/specificdate/lang/de/lifecycletrigger_specificdate.php b/trigger/specificdate/lang/de/lifecycletrigger_specificdate.php
index fc24f19..8e64a25 100644
--- a/trigger/specificdate/lang/de/lifecycletrigger_specificdate.php
+++ b/trigger/specificdate/lang/de/lifecycletrigger_specificdate.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Lang strings for categories delay trigger
+ * Lang strings for specific date trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package lifecycletrigger_specificdate
  * @copyright  2018 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/specificdate/lang/en/lifecycletrigger_specificdate.php b/trigger/specificdate/lang/en/lifecycletrigger_specificdate.php
index 1b4ffab..1529ac2 100644
--- a/trigger/specificdate/lang/en/lifecycletrigger_specificdate.php
+++ b/trigger/specificdate/lang/en/lifecycletrigger_specificdate.php
@@ -15,10 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Lang strings for categories delay trigger
+ * Lang strings for specific date trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package lifecycletrigger_specificdate
  * @copyright  2018 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/specificdate/lib.php b/trigger/specificdate/lib.php
index 6c362fa..2782a49 100644
--- a/trigger/specificdate/lib.php
+++ b/trigger/specificdate/lib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype trigger
- * It has to be implemented by all subplugins.
+ * Trigger subplugin which triggers on specific dates only.
  *
- * @package tool_lifecycle_trigger
- * @subpackage specificdate
+ * @package lifecycletrigger_specificdate
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -37,14 +35,16 @@ require_once(__DIR__ . '/../../lib.php');
 
 /**
  * Class which implements the basic methods necessary for a cleanyp courses trigger subplugin
- * @package tool_lifecycle_trigger
+ * @package lifecycletrigger_specificdate
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class specificdate extends base_automatic {
 
     /**
      * Checks the course and returns a repsonse, which tells if the course should be further processed.
-     * @param $course object to be processed.
-     * @param $triggerid int id of the trigger instance.
+     * @param object $course Course to be processed.
+     * @param int $triggerid Id of the trigger instance.
      * @return trigger_response
      */
     public function check_course($course, $triggerid) {
@@ -52,6 +52,16 @@ class specificdate extends base_automatic {
         return trigger_response::trigger();
     }
 
+    /**
+     * Returns true or false, depending on if the current date is one of the specified days,
+     * at which the trigger should run.
+     * @param int $triggerid Id of the trigger.
+     * @return array A list containing the constructed sql fragment and an array of parameters.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     * @throws \moodle_exception
+     * @throws \Exception
+     */
     public function get_course_recordset_where($triggerid) {
         $settings = settings_manager::get_settings($triggerid, settings_type::TRIGGER);
         $lastrun = getdate($settings['timelastrun']);
@@ -93,7 +103,9 @@ class specificdate extends base_automatic {
 
     /**
      * Parses the dates settings to actual date objects.
-     * @param $datesraw string
+     * @param string $datesraw Raw data from the form representing dates.
+     * @return array
+     * @throws \moodle_exception
      */
     private function parse_dates($datesraw) {
         $dates = preg_split('/\r\n|\r|\n/', $datesraw);
@@ -111,10 +123,18 @@ class specificdate extends base_automatic {
         return $result;
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'specificdate';
     }
 
+    /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
+     * @return instance_setting[] containing settings keys and PARAM_TYPES
+     */
     public function instance_settings() {
         return array(
             new instance_setting('dates', PARAM_TEXT),
@@ -122,15 +142,27 @@ class specificdate extends base_automatic {
         );
     }
 
+    /**
+     * This method can be overriden, to add form elements to the form_step_instance.
+     * It is called in definition().
+     * @param \MoodleQuickForm $mform
+     * @throws \coding_exception
+     */
     public function extend_add_instance_form_definition($mform) {
         $mform->addElement('textarea', 'dates', get_string('dates', 'lifecycletrigger_specificdate'),
             get_string('dates_desc', 'lifecycletrigger_specificdate'));
-        $mform->setType('categories', PARAM_TEXT);
+        $mform->setType('dates', PARAM_TEXT);
         $mform->addElement('hidden', 'timelastrun');
         $mform->setDefault('timelastrun', time());
         $mform->setType('timelastrun', PARAM_INT);
     }
 
+    /**
+     * Validate parsable dates.
+     * @param array $error Array containing all errors.
+     * @param array $data Data passed from the moodle form to be validated.
+     * @throws \coding_exception
+     */
     public function extend_add_instance_form_validation(&$error, $data) {
         $dates = preg_split('/\r\n|\r|\n/', $data['dates']);
         foreach ($dates as $date) {
diff --git a/trigger/specificdate/version.php b/trigger/specificdate/version.php
index 145de45..a7f69e7 100644
--- a/trigger/specificdate/version.php
+++ b/trigger/specificdate/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Specific Date Trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage specificdate
+ * @package lifecycletrigger_specificdate
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/startdatedelay/lang/de/lifecycletrigger_startdatedelay.php b/trigger/startdatedelay/lang/de/lifecycletrigger_startdatedelay.php
index 153e735..7f92b7c 100644
--- a/trigger/startdatedelay/lang/de/lifecycletrigger_startdatedelay.php
+++ b/trigger/startdatedelay/lang/de/lifecycletrigger_startdatedelay.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for start date delay trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package    lifecycletrigger_startdatedelay
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/startdatedelay/lang/en/lifecycletrigger_startdatedelay.php b/trigger/startdatedelay/lang/en/lifecycletrigger_startdatedelay.php
index a5344f0..93d29d5 100644
--- a/trigger/startdatedelay/lang/en/lifecycletrigger_startdatedelay.php
+++ b/trigger/startdatedelay/lang/en/lifecycletrigger_startdatedelay.php
@@ -17,8 +17,7 @@
 /**
  * Lang strings for start date delay trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package    lifecycletrigger_startdatedelay
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/trigger/startdatedelay/lib.php b/trigger/startdatedelay/lib.php
index cfa9e6b..4cfac5a 100644
--- a/trigger/startdatedelay/lib.php
+++ b/trigger/startdatedelay/lib.php
@@ -15,11 +15,9 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Interface for the subplugintype trigger
- * It has to be implemented by all subplugins.
+ * Subplugin for the start date delay.
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package lifecycletrigger_startdatedelay
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -35,15 +33,16 @@ require_once(__DIR__ . '/../../lib.php');
 
 /**
  * Class which implements the basic methods necessary for a cleanyp courses trigger subplugin
- * @package tool_lifecycle_trigger
+ * @package lifecycletrigger_startdatedelay
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class startdatedelay extends base_automatic {
 
-
     /**
      * Checks the course and returns a repsonse, which tells if the course should be further processed.
-     * @param $course object to be processed.
-     * @param $triggerid int id of the trigger instance.
+     * @param object $course Course to be processed.
+     * @param int $triggerid Id of the trigger instance.
      * @return trigger_response
      */
     public function check_course($course, $triggerid) {
@@ -51,6 +50,13 @@ class startdatedelay extends base_automatic {
         return trigger_response::trigger();
     }
 
+    /**
+     * Add sql comparing the current date to the start date of a course in combination with the specified delay.
+     * @param int $triggerid Id of the trigger.
+     * @return array A list containing the constructed sql fragment and an array of parameters.
+     * @throws \coding_exception
+     * @throws \dml_exception
+     */
     public function get_course_recordset_where($triggerid) {
         $delay = settings_manager::get_settings($triggerid, settings_type::TRIGGER)['delay'];
         $where = "{course}.startdate < :startdatedelay";
@@ -60,21 +66,39 @@ class startdatedelay extends base_automatic {
         return array($where, $params);
     }
 
+    /**
+     * The return value should be equivalent with the name of the subplugin folder.
+     * @return string technical name of the subplugin
+     */
     public function get_subpluginname() {
         return 'startdatedelay';
     }
 
+    /**
+     * Defines which settings each instance of the subplugin offers for the user to define.
+     * @return instance_setting[] containing settings keys and PARAM_TYPES
+     */
     public function instance_settings() {
         return array(
             new instance_setting('delay', PARAM_INT)
         );
     }
 
+    /**
+     * At the delay since the start date of a course.
+     * @param \MoodleQuickForm $mform
+     * @throws \coding_exception
+     */
     public function extend_add_instance_form_definition($mform) {
         $mform->addElement('duration', 'delay', get_string('delay', 'lifecycletrigger_startdatedelay'));
         $mform->addHelpButton('delay', 'delay', 'lifecycletrigger_startdatedelay');
     }
 
+    /**
+     * Reset the delay at the add instance form initializiation.
+     * @param \MoodleQuickForm $mform
+     * @param array $settings array containing the settings from the db.
+     */
     public function extend_add_instance_form_definition_after_data($mform, $settings) {
         if (is_array($settings) && array_key_exists('delay', $settings)) {
             $default = $settings['delay'];
diff --git a/trigger/startdatedelay/tests/generator/lib.php b/trigger/startdatedelay/tests/generator/lib.php
index dd3bada..aa4bde4 100644
--- a/trigger/startdatedelay/tests/generator/lib.php
+++ b/trigger/startdatedelay/tests/generator/lib.php
@@ -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/>.
 
+/**
+ * lifecycletrigger_startdatedelay generator tests
+ *
+ * @package    lifecycletrigger_startdatedelay
+ * @category   test
+ * @copyright  2018 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lifecycle\entity\trigger_subplugin;
@@ -36,6 +44,7 @@ class tool_lifecycle_trigger_startdatedelay_generator extends testing_module_gen
     /**
      * Creates a trigger startdatedelay for an artificial workflow without steps.
      * @return trigger_subplugin the created startdatedelay trigger.
+     * @throws moodle_exception
      */
     public static function create_trigger_with_workflow() {
         // Create Workflow.
diff --git a/trigger/startdatedelay/tests/trigger_test.php b/trigger/startdatedelay/tests/trigger_test.php
index 91d5646..434aa27 100644
--- a/trigger/startdatedelay/tests/trigger_test.php
+++ b/trigger/startdatedelay/tests/trigger_test.php
@@ -14,8 +14,17 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
+/**
+ * Trigger test for start date delay trigger.
+ *
+ * @package    lifecycletrigger_startdatedelay
+ * @group      lifecycletrigger
+ * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 namespace tool_lifecycle\trigger;
 
+use tool_lifecycle\entity\trigger_subplugin;
 use tool_lifecycle\processor;
 
 defined('MOODLE_INTERNAL') || die();
@@ -26,17 +35,17 @@ require_once(__DIR__ . '/generator/lib.php');
 /**
  * Trigger test for start date delay trigger.
  *
- * @package    tool_lifecycle_trigger
- * @category   startdatedelay
- * @group tool_lifecycle_trigger
+ * @package    lifecycletrigger_startdatedelay
+ * @group      lifecycletrigger
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class tool_lifecycle_trigger_startdatedelay_testcase extends \advanced_testcase {
 
+    /** @var $triggerinstance trigger_subplugin Instance of the trigger. */
     private $triggerinstance;
 
-    /**@var processor Instance of the lifecycle processor */
+    /** @var $processor processor Instance of the lifecycle processor. */
     private $processor;
 
     public function setUp() {
diff --git a/trigger/startdatedelay/version.php b/trigger/startdatedelay/version.php
index 9bd6252..c59c13c 100644
--- a/trigger/startdatedelay/version.php
+++ b/trigger/startdatedelay/version.php
@@ -17,8 +17,7 @@
 /**
  * Life Cycle Startdate Trigger
  *
- * @package tool_lifecycle_trigger
- * @subpackage startdatedelay
+ * @package lifecycletrigger_startdatedelay
  * @copyright  2017 Tobias Reischmann WWU
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
diff --git a/version.php b/version.php
index e42e34f..f39d537 100644
--- a/version.php
+++ b/version.php
@@ -19,6 +19,7 @@
  *
  * @package    tool_lifecycle
  * @copyright  2017 Tobias Reischmann WWU
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
 defined('MOODLE_INTERNAL') || die;
-- 
GitLab