Skip to content

Commit 4b8ba47

Browse files
committed
Update phpdocs
1 parent 496a00a commit 4b8ba47

File tree

4 files changed

+76
-3
lines changed

4 files changed

+76
-3
lines changed

src/DebugBar/Storage/FileStorage.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public function __construct($dirname)
2525
$this->dirname = rtrim($dirname, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
2626
}
2727

28+
/**
29+
* {@inheritdoc}
30+
*/
2831
public function save($id, $data)
2932
{
3033
if (!file_exists($this->dirname)) {
@@ -33,11 +36,17 @@ public function save($id, $data)
3336
file_put_contents($this->makeFilename($id), json_encode($data));
3437
}
3538

39+
/**
40+
* {@inheritdoc}
41+
*/
3642
public function get($id)
3743
{
3844
return json_decode(file_get_contents($this->makeFilename($id)), true);
3945
}
4046

47+
/**
48+
* {@inheritdoc}
49+
*/
4150
public function find(array $filters = array(), $max = 20, $offset = 0)
4251
{
4352
//Loop through all .json files and remember the modified time and id.
@@ -81,6 +90,10 @@ public function find(array $filters = array(), $max = 20, $offset = 0)
8190

8291
/**
8392
* Filter the metadata for matches.
93+
*
94+
* @param array $meta
95+
* @param array $filters
96+
* @return bool
8497
*/
8598
protected function filter($meta, $filters)
8699
{
@@ -92,6 +105,9 @@ protected function filter($meta, $filters)
92105
return true;
93106
}
94107

108+
/**
109+
* {@inheritdoc}
110+
*/
95111
public function clear()
96112
{
97113
foreach (new \DirectoryIterator($this->dirname) as $file) {
@@ -101,6 +117,10 @@ public function clear()
101117
}
102118
}
103119

120+
/**
121+
* @param string $id
122+
* @return string
123+
*/
104124
public function makeFilename($id)
105125
{
106126
return $this->dirname . basename($id). ".json";

src/DebugBar/Storage/MemcachedStorage.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public function __construct(Memcached $memcached, $keyNamespace = 'phpdebugbar')
3030
$this->keyNamespace = $keyNamespace;
3131
}
3232

33+
/**
34+
* {@inheritdoc}
35+
*/
3336
public function save($id, $data)
3437
{
3538
$key = $this->createKey($id);
@@ -39,11 +42,17 @@ public function save($id, $data)
3942
}
4043
}
4144

45+
/**
46+
* {@inheritdoc}
47+
*/
4248
public function get($id)
4349
{
4450
return $this->memcached->get($this->createKey($id));
4551
}
4652

53+
/**
54+
* {@inheritdoc}
55+
*/
4756
public function find(array $filters = array(), $max = 20, $offset = 0)
4857
{
4958
if (!($keys = $this->memcached->get($this->keyNamespace))) {
@@ -64,6 +73,10 @@ public function find(array $filters = array(), $max = 20, $offset = 0)
6473

6574
/**
6675
* Filter the metadata for matches.
76+
*
77+
* @param array $meta
78+
* @param array $filters
79+
* @return bool
6780
*/
6881
protected function filter($meta, $filters)
6982
{
@@ -75,6 +88,9 @@ protected function filter($meta, $filters)
7588
return true;
7689
}
7790

91+
/**
92+
* {@inheritdoc}
93+
*/
7894
public function clear()
7995
{
8096
if (!($keys = $this->memcached->get($this->keyNamespace))) {
@@ -84,6 +100,10 @@ public function clear()
84100
$this->memcached->deleteMulti(explode('|', $keys));
85101
}
86102

103+
/**
104+
* @param string $id
105+
* @return string
106+
*/
87107
protected function createKey($id)
88108
{
89109
return md5("{$this->keyNamespace}.$id");

src/DebugBar/Storage/PdoStorage.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ class PdoStorage implements StorageInterface
2424
protected $sqlQueries = array(
2525
'save' => "INSERT INTO %tablename% (id, data, meta_utime, meta_datetime, meta_uri, meta_ip, meta_method) VALUES (?, ?, ?, ?, ?, ?, ?)",
2626
'get' => "SELECT data FROM %tablename% WHERE id = ?",
27-
'find' => "SELECT data FROM %tablename% %where% ORDER BY meta_datetime LIMIT %limit% OFFSET %offset%",
27+
'find' => "SELECT data FROM %tablename% %where% ORDER BY meta_datetime DESC LIMIT %limit% OFFSET %offset%",
2828
'clear' => "DELETE FROM %tablename%"
2929
);
3030

3131
/**
32-
* @param string $dirname Directories where to store files
32+
* @param \PDO $pdo The PDO instance
33+
* @param string $tableName
3334
* @param array $sqlQueries
3435
*/
3536
public function __construct(PDO $pdo, $tableName = 'phpdebugbar', array $sqlQueries = array())
@@ -49,6 +50,9 @@ public function setSqlQueries(array $queries)
4950
$this->sqlQueries = array_merge($this->sqlQueries, $queries);
5051
}
5152

53+
/**
54+
* {@inheritdoc}
55+
*/
5256
public function save($id, $data)
5357
{
5458
$sql = $this->getSqlQuery('save');
@@ -57,6 +61,9 @@ public function save($id, $data)
5761
$stmt->execute(array($id, serialize($data), $meta['utime'], $meta['datetime'], $meta['uri'], $meta['ip'], $meta['method']));
5862
}
5963

64+
/**
65+
* {@inheritdoc}
66+
*/
6067
public function get($id)
6168
{
6269
$sql = $this->getSqlQuery('get');
@@ -68,6 +75,9 @@ public function get($id)
6875
return null;
6976
}
7077

78+
/**
79+
* {@inheritdoc}
80+
*/
7181
public function find(array $filters = array(), $max = 20, $offset = 0)
7282
{
7383
$where = array();
@@ -100,11 +110,21 @@ public function find(array $filters = array(), $max = 20, $offset = 0)
100110
return $results;
101111
}
102112

113+
/**
114+
* {@inheritdoc}
115+
*/
103116
public function clear()
104117
{
105118
$this->pdo->exec($this->getSqlQuery('clear'));
106119
}
107120

121+
/**
122+
* Get a SQL Query for a task, with the variables replaced
123+
*
124+
* @param string $name
125+
* @param array $vars
126+
* @return string
127+
*/
108128
protected function getSqlQuery($name, array $vars = array())
109129
{
110130
$sql = $this->sqlQueries[$name];

src/DebugBar/Storage/RedisStorage.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,34 @@ class RedisStorage implements StorageInterface
2222
protected $hash;
2323

2424
/**
25-
* @param string $dirname Directories where to store files
25+
* @param \Predis\Client $redis Redis Client
26+
* @param string $hash
2627
*/
2728
public function __construct(Client $redis, $hash = 'phpdebugbar')
2829
{
2930
$this->redis = $redis;
3031
$this->hash = $hash;
3132
}
3233

34+
/**
35+
* {@inheritdoc}
36+
*/
3337
public function save($id, $data)
3438
{
3539
$this->redis->hset($this->hash, $id, serialize($data));
3640
}
3741

42+
/**
43+
* {@inheritdoc}
44+
*/
3845
public function get($id)
3946
{
4047
return unserialize($this->redis->hget($this->hash, $id));
4148
}
4249

50+
/**
51+
* {@inheritdoc}
52+
*/
4353
public function find(array $filters = array(), $max = 20, $offset = 0)
4454
{
4555
$results = array();
@@ -67,6 +77,9 @@ protected function filter($meta, $filters)
6777
return true;
6878
}
6979

80+
/**
81+
* {@inheritdoc}
82+
*/
7083
public function clear()
7184
{
7285
$this->redis->del($this->hash);

0 commit comments

Comments
 (0)