MDL-50887 antivirus: Add config getter to base class.
Improving architecture to make it testable.
This commit is contained in:
@@ -51,6 +51,21 @@ abstract class scanner {
|
||||
$this->config = get_config($ref->getNamespaceName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Config get method.
|
||||
*
|
||||
* @param string $property config property to get.
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \coding_exception
|
||||
*/
|
||||
public function get_config($property) {
|
||||
if (property_exists($this->config, $property)) {
|
||||
return $this->config->$property;
|
||||
}
|
||||
throw new \coding_exception('Config property "' . $property . '" doesn\'t exist');
|
||||
}
|
||||
|
||||
/**
|
||||
* Are the antivirus settings configured?
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user