Exemple #1
0
 static function find($search_id)
 {
     $found_token = null;
     $all_tokens = Token::getAll();
     foreach ($all_tokens as $token) {
         if ($token->getId() == $search_id) {
             $found_token = $token;
         }
     }
     return $found_token;
 }
Exemple #2
0
 function testDelete()
 {
     $patron_id = 1;
     $menu_id = 2;
     $sender_id = 3;
     $test_token = new Token($patron_id, $menu_id, $sender_id);
     $test_token->save();
     $patron_id2 = 4;
     $menu_id2 = 5;
     $sender_id2 = 6;
     $test_token2 = new Token($patron_id2, $menu_id2, $sender_id2);
     $test_token2->save();
     $test_token->delete();
     $result = Token::getAll();
     $this->assertEquals([$test_token2], $result);
 }
Exemple #3
0
<?php

require 'config.php';
//Configuration
require 'HTTP/Request2.php';
/* Autoloading class.php **/
spl_autoload_register(function ($class) {
    include 'lib/' . strtolower($class) . '.php';
});
$tokens = Token::getAll();
foreach ($tokens as $row) {
    echo $row['service'] . '::' . $row['userid'] . "\n";
    $className = ucfirst($row['service']);
    $className::update($row['userid']);
    if ($row['service'] == 'github') {
        //perform a gitscore update as well
        //since we don't store a token for it
        Gitscore::update($row['userid']);
        echo 'gitscore::' . $row['userid'] . "\n";
    }
}