Skip to content
Snippets Groups Projects
Verified Commit a0b37ee9 authored by Marco Schlicht's avatar Marco Schlicht :speech_balloon:
Browse files

moved static config into it's own file

parent 6b86cff0
No related branches found
No related tags found
No related merge requests found
<?php
/**
* The Moodle Webservice API Wrapper of the Rwth Aachen University
*
* PHP Version 7.0
*
* RwthMoodleApiLib
* Copyright (C) 2017 Marco Schlicht PIT RWTH Aachen
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category RwthMoodleApiLib
* @package RwthMoodleApiLib
* @author Marco Schlicht <marcoschlicht@onlinehome.de>
* @copyright 2017 Marco Schlicht PIT RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @link https://git.rwth-aachen.de/moodle/rwth_moodle_api
**/
namespace RwthMoodleApiLib;
/**
* Config File
*
* @category Config
* @package RwthMoodleApiLib
* @author Marco Schlicht <marcoschlicht@onlinehome.de>
* @copyright 2017 Marco Schlicht PIT RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @link https://git.rwth-aachen.de/moodle/rwth_moodle_api
**/
namespace RwthMoodleApiLib;
class Config
{
public static $moodle_url = "https://d-mo01.devlef.campus.rwth-aachen.de/moodlems/";
}
?>
......@@ -56,7 +56,7 @@ class Injector implements InjectorInterface
/**
* Constructor
**/
public function __construct()
public function __construct($url=Null)
{
//observers
$informationalObserver = new Logging\ConsoleLogger(6);
......@@ -75,7 +75,10 @@ class Injector implements InjectorInterface
//http client
//needs an / at the end
//TODO throw error if not or rebuild the uri
$this->httpClient = new Http\Client($this->loggingManager, ["base_uri" => "http://localhost/moodle/"]);
if (is_null($url)) {
$url = RwthMoodleApiLib\Config::$moodle_url;
}
$this->httpClient = new Http\Client($this->loggingManager, ["base_uri" => $url]);
//rwth moodle api
$this->rwthMoodleApiLib = new RwthMoodleApiLib\RwthMoodleApiLib($this->loggingManager, $this->httpClient);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment