Commit 9689b0be authored by justinrandell's avatar justinrandell

Fully qualify path to PHP's Exception in our namespaced code.

parent a3156a15
......@@ -33,11 +33,11 @@ public function __construct($name) {
protected function readWithSignature() {
$content = file_get_contents($this->getFilePath());
if ($content === FALSE) {
throw new Exception('Read file is invalid.');
throw new \Exception('Read file is invalid.');
}
$signature = file_get_contents($this->getFilePath() . '.sig');
if ($signature === FALSE) {
throw new Exception('Signature file is invalid.');
throw new \Exception('Signature file is invalid.');
}
return array('data' => $content, 'signature' => $signature);
}
......@@ -111,10 +111,10 @@ public function verify($contentOnSuccess = FALSE) {
public function write($data) {
$signature = config_sign_data($data);
if (!file_put_contents($this->getFilePath(), $data)) {
throw new Exception('Failed to write configuration file.');
throw new \Exception('Failed to write configuration file.');
}
if (!file_put_contents($this->getFilePath() . '.sig', $signature)) {
throw new Exception('Failed to write signature file.');
throw new \Exception('Failed to write signature file.');
}
}
......@@ -128,7 +128,7 @@ public function read() {
if ($this->exists()) {
$verification = $this->verify(TRUE);
if ($verification === FALSE) {
throw new Exception('Invalid signature in file header.');
throw new \Exception('Invalid signature in file header.');
}
return $verification;
}
......@@ -142,4 +142,5 @@ public function delete() {
@drupal_unlink($this->getFilePath());
@drupal_unlink($this->getFilePath() . '.sig');
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment