Skip to content

Commit

Permalink
ran php syntax fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
matsubo committed Jun 3, 2013
1 parent e9f3745 commit b736d39
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor
composer.lock
composer.phar
clover.xml
build
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"require-dev": {
"devster/ubench": "1.1.*-dev",
"phpunit/phpunit": "3.7.*@stable",
"satooshi/php-coveralls": "dev-master"
"satooshi/php-coveralls": "dev-master",
"fabpot/php-cs-fixer": "0.3.*@dev",
"sebastian/diff": "1.0.*@dev"
},
"autoload": {
"psr-0": {"Matsubo": "src/"}
Expand Down
8 changes: 0 additions & 8 deletions sample/usecase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

use Matsubo\Redis\Ranking;


$redis = new \Redis();
$redis->connect('127.0.0.1', 6379);

$ranking = new Ranking($key = 'usecase', $redis);


// Add score
$ranking->setUserScore('kanako', 1);
$ranking->setUserScore('ayaka', 50);
Expand All @@ -20,13 +18,11 @@
var_dump($ranking->getScore('ayaka')); // float(50)
var_dump($ranking->getScore('shiori')); // float(100)


// get rank
var_dump($ranking->getRank('kanako')); // int(0)
var_dump($ranking->getRank('ayaka')); // int(1)
var_dump($ranking->getRank('shiori')); // int(2)


/*
* Show top 2
array(3) {
Expand All @@ -37,9 +33,5 @@
*/
var_dump($ranking->getRange(0, 1, true));


// Cleanup
$redis->del($key);



19 changes: 9 additions & 10 deletions src/Matsubo/Redis/Ranking.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public function incrementScore($user_id, $score_diff)
/**
* getRange
*
* @param int $start
* @param int $end
* @param int $start
* @param int $end
* @param bool $withscores
* @access public
* @return array
Expand All @@ -98,8 +98,8 @@ public function getRange($start = 0, $end = -1, $withscores = false)
/**
* getRevRange
*
* @param int $start
* @param int $end
* @param int $start
* @param int $end
* @param bool $withscores
* @access public
* @return array
Expand All @@ -111,11 +111,11 @@ public function getRevRange($start = 0, $end = -1, $withscores = false)
/**
* getRangeByScores
*
* @param int $start
* @param int $end
* @param int $start
* @param int $end
* @param bool $withscores
* @param int $offset
* @param int $count
* @param int $offset
* @param int $count
* @access public
* @return array
*/
Expand Down Expand Up @@ -153,6 +153,7 @@ public function deleteAllUser()
$this->redis->zDelete($this->namespace, $user_id);
$deleted_user_id[] = $user_id;
}

return $deleted_user_id;
}
/**
Expand All @@ -166,5 +167,3 @@ public function countUsers()
return $this->redis->zSize($this->namespace);
}
}


1 change: 0 additions & 1 deletion tests/RankingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function userProvider()
return $data;
}


/**
* setUp
*
Expand Down

0 comments on commit b736d39

Please sign in to comment.