fabi0

Untitled

May 26th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * To change this license header, choose License Headers in Project Properties.
  5.  * To change this template file, choose Tools | Templates
  6.  * and open the template in the editor.
  7.  */
  8.  
  9. /**
  10.  * Description of Settings
  11.  *
  12.  * @author fabi0
  13.  */
  14.  
  15. namespace Models;
  16.  
  17. class Settings {
  18.  
  19.     private $_data = array();
  20.  
  21.     public function __construct($databaseInstance) {
  22.         $sql = 'SELECT * FROM `settings` WHERE id=1 LIMIT 1';
  23.         $databaseInstance->query($sql);
  24.         foreach ((array) $databaseInstance->getResult()[0] as $key => $value) {
  25.             $this->_data[$key] = $value;
  26.         }
  27.     }
  28.  
  29.     public function get($property) {
  30.         return $this->_data[$property];
  31.     }
  32.  
  33.     public function getAll() {
  34.         return $this->_data;
  35.     }
  36.  
  37.     /**
  38.      *
  39.      * @param array $values
  40.      */
  41.     public function get_array(array $values) {
  42.         foreach ($values as $value) {
  43.             $settings[$value] = $this->_data[$value];
  44.         }
  45.         return $settings;
  46.     }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment