aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/config/ConfigManager.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-03-09 19:45:52 +0100
committerGitHub <noreply@github.com>2017-03-09 19:45:52 +0100
commit16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4 (patch)
treed744155a1b68a203d4483195202d3d8562d02cf0 /application/config/ConfigManager.php
parent9c5daad19c850d852f2e78ca571ad199362c0ffe (diff)
parent5ba55f0cf287c583019bbb731ad98e04a14da972 (diff)
downloadShaarli-16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4.tar.gz
Shaarli-16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4.tar.zst
Shaarli-16a2ef6b5a28da9e3252d95c3217bb9b8c1e3ae4.zip
Merge pull request #794 from ArthurHoaro/hotfix/namespace
Move config exception to dedicated classes with proper namespace
Diffstat (limited to 'application/config/ConfigManager.php')
-rw-r--r--application/config/ConfigManager.php36
1 files changed, 3 insertions, 33 deletions
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php
index 679a75b3..f2097410 100644
--- a/application/config/ConfigManager.php
+++ b/application/config/ConfigManager.php
@@ -1,6 +1,9 @@
1<?php 1<?php
2namespace Shaarli\Config; 2namespace Shaarli\Config;
3 3
4use Shaarli\Config\Exception\MissingFieldConfigException;
5use Shaarli\Config\Exception\UnauthorizedConfigException;
6
4/** 7/**
5 * Class ConfigManager 8 * Class ConfigManager
6 * 9 *
@@ -358,36 +361,3 @@ class ConfigManager
358 $this->configIO = $configIO; 361 $this->configIO = $configIO;
359 } 362 }
360} 363}
361
362/**
363 * Exception used if a mandatory field is missing in given configuration.
364 */
365class MissingFieldConfigException extends \Exception
366{
367 public $field;
368
369 /**
370 * Construct exception.
371 *
372 * @param string $field field name missing.
373 */
374 public function __construct($field)
375 {
376 $this->field = $field;
377 $this->message = 'Configuration value is required for '. $this->field;
378 }
379}
380
381/**
382 * Exception used if an unauthorized attempt to edit configuration has been made.
383 */
384class UnauthorizedConfigException extends \Exception
385{
386 /**
387 * Construct exception.
388 */
389 public function __construct()
390 {
391 $this->message = 'You are not authorized to alter config.';
392 }
393}