예제 #1
0
 /**
  * Get list of developer tokens (refresh tokens)
  * 
  * @param   string  $rtrn     Data to return
  * @param   array   $filters  Filters to apply
  * @param   boolean $clear    Reset internal cache?
  * @return  mixed
  */
 public function refreshTokens($rtrn = 'list', $filters = array(), $clear = false)
 {
     $tbl = new Tables\Api\RefreshToken($this->_db);
     switch (strtolower($rtrn)) {
         case 'count':
             if (!isset($this->_cache['refreshtokens.count'])) {
                 $this->_cache['refreshtokens.count'] = (int) $tbl->count($filters);
             }
             return $this->_cache['refreshtokens.count'];
             break;
         case 'list':
         case 'results':
         default:
             if (!$this->_cache['refreshtokens.list'] instanceof ItemList) {
                 if ($results = $tbl->find($filters)) {
                     foreach ($results as $key => $result) {
                         $results[$key] = new Api\RefreshToken($result);
                     }
                 }
                 $this->_cache['refreshtokens.list'] = new ItemList($results);
             }
             return $this->_cache['refreshtokens.list'];
             break;
     }
 }
예제 #2
0
 /**
  * Get a list of application refresh tokens
  * 
  * @return  object  List of RefreshToken objects
  */
 public function refreshTokens()
 {
     $tbl = new Tables\Api\RefreshToken($this->_db);
     $filters = array('application_id' => $this->get('id'));
     if ($results = $tbl->find($filters)) {
         foreach ($results as $key => $result) {
             $results[$key] = new RefreshToken($result);
         }
     }
     return new ItemList($results);
 }