Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • Hawk\App
  • Hawk\ButtonInput
  • Hawk\Cache
  • Hawk\CheckboxInput
  • Hawk\ColorInput
  • Hawk\Conf
  • Hawk\Controller
  • Hawk\Crypto
  • Hawk\DatabaseSessionHandler
  • Hawk\DatetimeInput
  • Hawk\DB
  • Hawk\DBExample
  • Hawk\DeleteInput
  • Hawk\Dialogbox
  • Hawk\EmailInput
  • Hawk\ErrorHandler
  • Hawk\Event
  • Hawk\FileInput
  • Hawk\FileSystem
  • Hawk\FloatInput
  • Hawk\Form
  • Hawk\FormFieldset
  • Hawk\FormInput
  • Hawk\GenericModel
  • Hawk\GifImage
  • Hawk\HawkApi
  • Hawk\HawkUpdater
  • Hawk\HiddenInput
  • Hawk\HtmlInput
  • Hawk\HTTPRequest
  • Hawk\Icon
  • Hawk\Image
  • Hawk\IntegerInput
  • Hawk\ItemList
  • Hawk\ItemListField
  • Hawk\JpegImage
  • Hawk\Lang
  • Hawk\Language
  • Hawk\LeftSidebarTab
  • Hawk\Less
  • Hawk\Logger
  • Hawk\Mail
  • Hawk\MenuItem
  • Hawk\Model
  • Hawk\NoSidebarTab
  • Hawk\NumberInput
  • Hawk\ObjectInput
  • Hawk\Option
  • Hawk\Panel
  • Hawk\PasswordInput
  • Hawk\Permission
  • Hawk\Plugin
  • Hawk\PluginInstaller
  • Hawk\PngImage
  • Hawk\ProfileQuestion
  • Hawk\ProfileQuestionValue
  • Hawk\RadioInput
  • Hawk\Request
  • Hawk\Response
  • Hawk\RightSidebarTab
  • Hawk\Role
  • Hawk\RolePermission
  • Hawk\Route
  • Hawk\Router
  • Hawk\SelectInput
  • Hawk\Session
  • Hawk\Singleton
  • Hawk\SubmitInput
  • Hawk\Tabs
  • Hawk\TextareaInput
  • Hawk\TextInput
  • Hawk\Theme
  • Hawk\TimeInput
  • Hawk\Upload
  • Hawk\User
  • Hawk\View
  • Hawk\View\Plugins\Accordion
  • Hawk\View\Plugins\Button
  • Hawk\View\Plugins\Form
  • Hawk\View\Plugins\Icon
  • Hawk\View\Plugins\Import
  • Hawk\View\Plugins\Panel
  • Hawk\View\Plugins\Tabs
  • Hawk\View\Plugins\Text
  • Hawk\View\Plugins\Uri
  • Hawk\View\Plugins\Widget
  • Hawk\ViewPlugin
  • Hawk\Widget
  • Hawk\WysiwygInput

Traits

  • Hawk\Utils

Exceptions

  • Hawk\AppStopException
  • Hawk\DBExampleException
  • Hawk\DBException
  • Hawk\FileSystemException
  • Hawk\HawkApiException
  • Hawk\ImageException
  • Hawk\MailException
  • Hawk\UploadException
  • Hawk\ViewException
 1 <?php
 2 /**
 3  * Conf.php
 4  *
 5  * @author  Elvyrra SAS
 6  * @license http://rem.mit-license.org/ MIT
 7  */
 8 
 9 namespace Hawk;
10 
11 /**
12  * This class is used to get and set the application base configuration
13  *
14  * @package Core
15  */
16 final class Conf extends Singleton{
17     /**
18      * The application configuration cache
19      *
20      * @var array
21      */
22     private $conf;
23 
24 
25     /**
26      * The configuration instance
27      *
28      * @var Conf
29      */
30     protected static $instance;
31 
32 
33     /**
34      * Get a configuration value
35      *
36      * @param string $option The name of the configuration parameter to get
37      *
38      * @return mixed The configuration value
39      */
40     public function get($option = ''){
41         if(!isset($this->conf)) {
42             return null;
43         }
44 
45         if(empty($option)) {
46             return $this->conf;
47         }
48         else{
49             $fields = explode('.', $option);
50             $tmp = $this->conf;
51             foreach($fields as $field){
52                 if(isset($tmp[$field])) {
53                     $tmp = $tmp[$field];
54                 }
55                 else{
56                     return null;
57                 }
58             }
59             return $tmp;
60         }
61     }
62 
63 
64     /**
65      * Set a configuration parameter
66      *
67      * @param string $option The name of the parameter to set
68      * @param mixed  $value  The value to set
69      */
70     public function set($option, $value = null){
71         if($value == null) {
72             $this->conf = $option;
73         }
74         else{
75             $fields = explode('.', $option);
76             $tmp = &$this->conf;
77             foreach($fields as $field){
78                 $tmp = &$tmp[$field];
79             }
80             $tmp = $value;
81         }
82     }
83 
84 
85     /**
86      * Check if a configuration parameter exists
87      *
88      * @param string $option The parameter name to find
89      *
90      * @return boolean True if the parameter exists in the application configuration, false else
91      */
92     public function has($option){
93         $value = $this->get($option);
94         return $value !== null;
95     }
96 
97 }
Hawk - PHP documentation API documentation generated by ApiGen