edulegit_core::get_manager()   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 core class.
19
 *
20
 * This class serves as the core handler for managing configuration, repository, and submission manager interactions
21
 * within the assignsubmission_edulegit plugin.
22
 *
23
 * @package   assignsubmission_edulegit
24
 * @author    Alex Crosby <[email protected]>
25
 * @copyright @2024 EduLegit.com
26
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
29
namespace assignsubmission_edulegit;
30
31
/**
32
 * Class edulegit_core
33
 *
34
 * Core class to manage the primary plugin components including configuration, repository, and submission management.
35
 */
36
class edulegit_core {
37
38
    /**
39
     * Holds the configuration for the plugin.
40
     *
41
     * @var \assignsubmission_edulegit\edulegit_config
42
     */
43
    private \assignsubmission_edulegit\edulegit_config $config;
44
45
    /**
46
     * Repository to manage submission records.
47
     *
48
     * @var \assignsubmission_edulegit\edulegit_submission_repository
49
     */
50
    private \assignsubmission_edulegit\edulegit_submission_repository $repository;
51
52
    /**
53
     * Manager to handle submission-related operations.
54
     *
55
     * @var \assignsubmission_edulegit\edulegit_submission_manager
56
     */
57
    private \assignsubmission_edulegit\edulegit_submission_manager $manager;
58
59
    /**
60
     * Initializes the core components: config, repository, and submission manager.
61
     *
62
     * @param \stdClass $config Configuration object containing plugin settings.
63
     */
64
    public function __construct(\stdClass $config) {
65
        $this->config = new \assignsubmission_edulegit\edulegit_config($config);
66
        $this->repository = new \assignsubmission_edulegit\edulegit_submission_repository();
67
        $client = new edulegit_client($this->config->get_global('api_token'));
68
        $this->manager = new \assignsubmission_edulegit\edulegit_submission_manager($this->config, $client, $this->repository);
69
    }
70
71
    /**
72
     * Get the plugin configuration instance.
73
     *
74
     * Provides access to the configuration settings specific to this plugin.
75
     *
76
     * @return edulegit_config The plugin configuration object.
77
     */
78
    public function get_config(): edulegit_config {
79
        return $this->config;
80
    }
81
82
    /**
83
     * Get the submission repository instance.
84
     *
85
     * @return edulegit_submission_repository The submission repository object.
86
     */
87
    public function get_repository(): edulegit_submission_repository {
88
        return $this->repository;
89
    }
90
91
    /**
92
     * Get the submission manager instance.
93
     *
94
     * @return edulegit_submission_manager The submission manager object.
95
     */
96
    public function get_manager(): edulegit_submission_manager {
97
        return $this->manager;
98
    }
99
100
}
101