assessable_uploaded::get_objectid_mapping()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
17
/**
18
 * The assignsubmission_edulegit assessable uploaded event.
19
 *
20
 * @package   assignsubmission_edulegit
21
 * @author    Alex Crosby <[email protected]>
22
 * @copyright @2024 EduLegit.com
23
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
26
namespace assignsubmission_edulegit\event;
27
28
defined('MOODLE_INTERNAL') || die();
29
30
/**
31
 * The assignsubmission_edulegit assessable uploaded event class.
32
 *
33
 * @package   assignsubmission_edulegit
34
 * @author    Alex Crosby <[email protected]>
35
 * @copyright @2024 EduLegit.com
36
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 */
38
class assessable_uploaded extends \core\event\assessable_uploaded {
0 ignored issues
show
Bug introduced by
The type core\event\assessable_uploaded was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
39
40
    /**
41
     * Returns description of what happened.
42
     *
43
     * @return string
44
     */
45
    public function get_description(): string {
46
        return "The user with id '$this->userid' has saved an EduLegit submission with id '$this->objectid' " .
47
                "in the assignment activity with course module id '$this->contextinstanceid'.";
48
    }
49
50
    /**
51
     * Return localised event name.
52
     *
53
     * @return string
54
     */
55
    public static function get_name(): string {
56
        return get_string('eventassessableuploaded', 'assignsubmission_edulegit');
0 ignored issues
show
Bug introduced by
The function get_string was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

56
        return /** @scrutinizer ignore-call */ get_string('eventassessableuploaded', 'assignsubmission_edulegit');
Loading history...
57
    }
58
59
    /**
60
     * Get URL related to the action.
61
     *
62
     * @return \moodle_url
63
     */
64
    public function get_url(): \moodle_url {
0 ignored issues
show
Bug introduced by
The type moodle_url was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
65
        return new \moodle_url('/mod/assign/view.php', ['id' => $this->contextinstanceid]);
66
    }
67
68
    /**
69
     * Init method.
70
     *
71
     * @return void
72
     */
73
    protected function init(): void {
74
        parent::init();
75
        $this->data['objecttable'] = 'assign_submission';
0 ignored issues
show
Bug Best Practice introduced by
The property data does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
76
    }
77
78
    /**
79
     * Get objectid mapping.
80
     *
81
     * @return array
82
     */
83
    public static function get_objectid_mapping(): array {
84
        return ['db' => 'assign_submission', 'restore' => 'submission'];
85
    }
86
}
87