Browse Source

documentation and code style fixes

tags/2.0.0-beta
Carsten Brandt 12 years ago
parent
commit
38a1938847
  1. 2
      framework/caching/ApcCache.php
  2. 2
      framework/caching/Cache.php
  3. 2
      framework/caching/DbCache.php
  4. 2
      framework/caching/DummyCache.php
  5. 2
      framework/caching/FileCache.php
  6. 2
      framework/caching/MemCache.php
  7. 6
      framework/caching/RedisCache.php
  8. 2
      framework/caching/WinCache.php
  9. 2
      framework/caching/XCache.php
  10. 2
      framework/caching/ZendDataCache.php
  11. 5
      framework/db/redis/Connection.php
  12. 1
      tests/unit/framework/caching/CacheTest.php

2
framework/caching/ApcCache.php

@ -24,7 +24,7 @@ class ApcCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

2
framework/caching/Cache.php

@ -247,7 +247,7 @@ abstract class Cache extends Component implements \ArrayAccess
* This method should be implemented by child classes to retrieve the data * This method should be implemented by child classes to retrieve the data
* from specific cache storage. * from specific cache storage.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
abstract protected function getValue($key); abstract protected function getValue($key);

2
framework/caching/DbCache.php

@ -92,7 +92,7 @@ class DbCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

2
framework/caching/DummyCache.php

@ -24,7 +24,7 @@ class DummyCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

2
framework/caching/FileCache.php

@ -61,7 +61,7 @@ class FileCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

2
framework/caching/MemCache.php

@ -145,7 +145,7 @@ class MemCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

6
framework/caching/RedisCache.php

@ -49,11 +49,11 @@ class RedisCache extends Cache
*/ */
public $hostname = 'localhost'; public $hostname = 'localhost';
/** /**
* @var int the to use for connecting to the redis server. Default port is 6379. * @var int the port to use for connecting to the redis server. Default port is 6379.
*/ */
public $port = 6379; public $port = 6379;
/** /**
* @var string the password to use to identify with the redis server. If not set, no AUTH command will be sent. * @var string the password to use to authenticate with the redis server. If not set, no AUTH command will be sent.
*/ */
public $password; public $password;
/** /**
@ -102,7 +102,7 @@ class RedisCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

2
framework/caching/WinCache.php

@ -24,7 +24,7 @@ class WinCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

2
framework/caching/XCache.php

@ -25,7 +25,7 @@ class XCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

2
framework/caching/ZendDataCache.php

@ -24,7 +24,7 @@ class ZendDataCache extends Cache
* Retrieves a value from cache with a specified key. * Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class. * This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value * @param string $key a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired. * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/ */
protected function getValue($key) protected function getValue($key)
{ {

5
framework/db/redis/Connection.php

@ -379,14 +379,13 @@ class Connection extends Component
case '-': // Error reply case '-': // Error reply
throw new Exception("Redis error: " . $line . "\nRedis command was: " . $command); throw new Exception("Redis error: " . $line . "\nRedis command was: " . $command);
case ':': // Integer reply case ':': // Integer reply
// no cast to integer as it is in the range of a signed 64 bit integer // no cast to int as it is in the range of a signed 64 bit integer
return $line; return $line;
case '$': // Bulk replies case '$': // Bulk replies
if ($line == '-1') { if ($line == '-1') {
return null; return null;
} }
$data = fread($this->_socket, $line + 2); if(($data = fread($this->_socket, $line + 2))===false) {
if($data===false) {
throw new Exception("Failed to read from socket.\nRedis command was: " . $command); throw new Exception("Failed to read from socket.\nRedis command was: " . $command);
} }
return substr($data, 0, -2); return substr($data, 0, -2);

1
tests/unit/framework/caching/CacheTest.php

@ -117,6 +117,7 @@ abstract class CacheTest extends TestCase
$this->assertEquals(42, $cache->get('number_test')); $this->assertEquals(42, $cache->get('number_test'));
// should store data if it's not there yet // should store data if it's not there yet
$this->assertFalse($cache->get('add_test'));
$this->assertTrue($cache->add('add_test', 13)); $this->assertTrue($cache->add('add_test', 13));
$this->assertEquals(13, $cache->get('add_test')); $this->assertEquals(13, $cache->get('add_test'));
} }

Loading…
Cancel
Save