original_string: public function select($name = null, $default = null)
      {
          if (!$this->db->isInitialized()) {
              return isset($name) ? $default : array();
          }
  
          $conditions = array();
  
          $sql = 'SELECT * FROM settings';
  
          if (isset($name)) {
              $conditions[] = $name;
              $sql .= ' WHERE id=? LIMIT 0,1';
          }
  
          $settings = array();
  
          foreach ($this->db->fetchAll($sql, $conditions) as $result) {
  
              if (!empty($result['serialized'])) {
                  $result['value'] = unserialize($result['value']);
              }
  
              $settings[$result['id']] = $result['value'];
          }
  
          return isset($name) ? reset($settings) : $settings;
      }
code: public function select($name = null, $default = null)
      {
          if (!$this->db->isInitialized()) {
              return isset($name) ? $default : array();
          }
  
          $conditions = array();
  
          $sql = 'SELECT * FROM settings';
  
          if (isset($name)) {
              $conditions[] = $name;
              $sql .= ' WHERE id=? LIMIT 0,1';
          }
  
          $settings = array();
  
          foreach ($this->db->fetchAll($sql, $conditions) as $result) {
  
              if (!empty($result['serialized'])) {
                  $result['value'] = unserialize($result['value']);
              }
  
              $settings[$result['id']] = $result['value'];
          }
  
          return isset($name) ? reset($settings) : $settings;
      }
code_tokens: public function select ( $ name = null , $ default = null ) { if ( ! $ this -> db -> isInitialized ( ) ) { return isset ( $ name ) ? $ default : array ( ) ; } $ conditions = array ( ) ; $ sql = 'SELECT * FROM settings' ; if ( isset ( $ name ) ) { $ conditions [ ] = $ name ; $ sql .= ' WHERE id=? LIMIT 0,1' ; } $ settings = array ( ) ; foreach ( $ this -> db -> fetchAll ( $ sql , $ conditions ) as $ result ) { if ( ! empty ( $ result [ 'serialized' ] ) ) { $ result [ 'value' ] = unserialize ( $ result [ 'value' ] ) ; } $ settings [ $ result [ 'id' ] ] = $ result [ 'value' ] ; } return isset ( $ name ) ? reset ( $ settings ) : $ settings ; }
docstring: Select all or a single setting from the database
  @param null|string $name
  @param mixed $default
  @return mixed
docstring_tokens: Select all or a single setting from the database