original_string: protected function _getQuestionAttribute($qid, $attribute, $default = null)
      {
          if (! is_array($this->_attributes)) {
              $this->_attributes = [];            
              $attributesTable  = $this->_getQuestionAttributesTableName();
              $questionsTable   = $this->_getQuestionsTableName();
              $surveyTable      = $this->_getSurveysTableName();
  
              $sql = 'SELECT a.qid, a.attribute, a.value FROM ' . $attributesTable . ' AS a
                  LEFT JOIN ' . $questionsTable . ' AS q ON q.qid = a.qid
                  LEFT JOIN ' . $surveyTable . ' AS s ON s.sid = q.sid AND q.language = s.language
                  WHERE s.sid = ?';
  
              $attributes = $this->lsDb->fetchAll($sql, $this->sourceSurveyId);
              
              if (false === $attributes) {
                  // If DB lookup failed, return the default
                  return $default;
              }
              
              foreach ($attributes as $attrib) {
                  $this->_attributes[$attrib['qid']][$attrib['attribute']] = $attrib['value'];
              }
          }
  
          if (isset($this->_attributes[$qid][$attribute]) && strlen(trim($this->_attributes[$qid][$attribute]))) {
              return $this->_attributes[$qid][$attribute];
          } else {
              return $default;
          }
      }
code: protected function _getQuestionAttribute($qid, $attribute, $default = null)
      {
          if (! is_array($this->_attributes)) {
              $this->_attributes = [];            
              $attributesTable  = $this->_getQuestionAttributesTableName();
              $questionsTable   = $this->_getQuestionsTableName();
              $surveyTable      = $this->_getSurveysTableName();
  
              $sql = 'SELECT a.qid, a.attribute, a.value FROM ' . $attributesTable . ' AS a
                  LEFT JOIN ' . $questionsTable . ' AS q ON q.qid = a.qid
                  LEFT JOIN ' . $surveyTable . ' AS s ON s.sid = q.sid AND q.language = s.language
                  WHERE s.sid = ?';
  
              $attributes = $this->lsDb->fetchAll($sql, $this->sourceSurveyId);
              
              if (false === $attributes) {
                  // If DB lookup failed, return the default
                  return $default;
              }
              
              foreach ($attributes as $attrib) {
                  $this->_attributes[$attrib['qid']][$attrib['attribute']] = $attrib['value'];
              }
          }
  
          if (isset($this->_attributes[$qid][$attribute]) && strlen(trim($this->_attributes[$qid][$attribute]))) {
              return $this->_attributes[$qid][$attribute];
          } else {
              return $default;
          }
      }
code_tokens: protected function _getQuestionAttribute ( $ qid , $ attribute , $ default = null ) { if ( ! is_array ( $ this -> _attributes ) ) { $ this -> _attributes = [ ] ; $ attributesTable = $ this -> _getQuestionAttributesTableName ( ) ; $ questionsTable = $ this -> _getQuestionsTableName ( ) ; $ surveyTable = $ this -> _getSurveysTableName ( ) ; $ sql = 'SELECT a.qid, a.attribute, a.value FROM ' . $ attributesTable . ' AS a
                  LEFT JOIN ' . $ questionsTable . ' AS q ON q.qid = a.qid
                  LEFT JOIN ' . $ surveyTable . ' AS s ON s.sid = q.sid AND q.language = s.language
                  WHERE s.sid = ?' ; $ attributes = $ this -> lsDb -> fetchAll ( $ sql , $ this -> sourceSurveyId ) ; if ( false === $ attributes ) { // If DB lookup failed, return the default return $ default ; } foreach ( $ attributes as $ attrib ) { $ this -> _attributes [ $ attrib [ 'qid' ] ] [ $ attrib [ 'attribute' ] ] = $ attrib [ 'value' ] ; } } if ( isset ( $ this -> _attributes [ $ qid ] [ $ attribute ] ) && strlen ( trim ( $ this -> _attributes [ $ qid ] [ $ attribute ] ) ) ) { return $ this -> _attributes [ $ qid ] [ $ attribute ] ; } else { return $ default ; } }
docstring: Return a certain question attribute or the default value if it does not exist.
  
  @param string $qid
  @param string $attribute
  @param mxied $default
  @return mixed
docstring_tokens: Return a certain question attribute or the default value if it does not exist .