Exemplo n.º 1
0
 public static function settings($key)
 {
     if (static::$_settings === null) {
         $settings = ['channel' => '#general', 'username' => 'cakephp', 'icon_emoji' => ':ghost:'];
         static::$_settings = array_merge($settings, Configure::read('Slack'));
     }
     return static::$_settings[$key];
 }
Exemplo n.º 2
0
 public static function get($key = null)
 {
     if (null === static::$_settings) {
         static::$_settings = [];
         foreach (static::find() as $entry) {
             static::$_settings[$entry->key] = $entry->value;
         }
     }
     if ($key) {
         return isset(static::$_settings[$key]) ? static::$_settings[$key] : (isset(static::$defaults[$key]) ? static::$defaults[$key] : null);
     } else {
         $ret = [];
         foreach (static::$defaults as $key => $_) {
             $ret[$key] = static::get($key);
         }
         return $ret;
     }
 }