Skip to content

Commit 2577b62

Browse files
committed
feat: adicionar documentação de métodos e construtores em várias classes
1 parent b3dcef5 commit 2577b62

25 files changed

+373
-8
lines changed

src/Cache/CacheInterface.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ public function get(string $key, $default = null);
1717
* @param mixed $value
1818
*/
1919
public function set(string $key, $value, ?int $ttl = null): bool;
20+
21+
/**
22+
* Delete a cache entry by key
23+
*/
2024
public function delete(string $key): bool;
25+
26+
/**
27+
* Clear all cache entries
28+
*/
2129
public function clear(): bool;
30+
31+
/**
32+
* Check if a cache entry exists
33+
*/
2234
public function has(string $key): bool;
2335
}

src/Cache/FileCache.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public function set(string $key, $value, ?int $ttl = null): bool
6666
return file_put_contents($file, serialize($data)) !== false;
6767
}
6868

69+
/**
70+
* Delete a cache entry by key
71+
*/
6972
public function delete(string $key): bool
7073
{
7174
$file = $this->getFilePath($key);
@@ -77,6 +80,9 @@ public function delete(string $key): bool
7780
return true;
7881
}
7982

83+
/**
84+
* Clear all cache entries
85+
*/
8086
public function clear(): bool
8187
{
8288
$files = glob($this->cacheDir . '/*');
@@ -92,6 +98,9 @@ public function clear(): bool
9298
return true;
9399
}
94100

101+
/**
102+
* Check if a cache entry exists
103+
*/
95104
public function has(string $key): bool
96105
{
97106
return $this->get($key) !== null;

src/Cache/MemoryCache.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,27 @@ public function set(string $key, $value, ?int $ttl = null): bool
4444
return true;
4545
}
4646

47+
/**
48+
* Delete a cache entry by key
49+
*/
4750
public function delete(string $key): bool
4851
{
4952
unset($this->cache[$key]);
5053
return true;
5154
}
5255

56+
/**
57+
* Clear all cache entries
58+
*/
5359
public function clear(): bool
5460
{
5561
$this->cache = [];
5662
return true;
5763
}
5864

65+
/**
66+
* Check if a cache entry exists
67+
*/
5968
public function has(string $key): bool
6069
{
6170
return isset($this->cache[$key]);

src/Database/Database.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class Database
1010
private \PDO $pdo;
1111
private array $config;
1212

13+
/**
14+
* __construct method
15+
*/
1316
public function __construct(array $config)
1417
{
1518
$this->config = $config;

src/Events/Event.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class Event
1111
private array $data;
1212
private bool $propagationStopped = false;
1313

14+
/**
15+
* __construct method
16+
*/
1417
public function __construct(string $name, array $data = [])
1518
{
1619
$this->name = $name;

src/Http/Optimization/ArrayView.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class ArrayView implements \ArrayAccess, \Iterator, \Countable
1717
private array $keys;
1818
private int $position = 0;
1919

20+
/**
21+
* __construct method
22+
*/
2023
public function __construct(
2124
array &$source,
2225
int $offset,
@@ -29,11 +32,17 @@ public function __construct(
2932
$this->keys = array_slice(array_keys($source), $this->offset, $this->length);
3033
}
3134

35+
/**
36+
* OffsetExists method
37+
*/
3238
public function offsetExists($offset): bool
3339
{
3440
return isset($this->keys[$offset]);
3541
}
3642

43+
/**
44+
* OffsetGet method
45+
*/
3746
public function offsetGet($offset): mixed
3847
{
3948
if (!$this->offsetExists($offset)) {
@@ -43,6 +52,9 @@ public function offsetGet($offset): mixed
4352
return $this->source[$realKey];
4453
}
4554

55+
/**
56+
* OffsetSet method
57+
*/
4658
public function offsetSet($offset, $value): void
4759
{
4860
if ($this->offsetExists($offset)) {
@@ -51,6 +63,9 @@ public function offsetSet($offset, $value): void
5163
}
5264
}
5365

66+
/**
67+
* OffsetUnset method
68+
*/
5469
public function offsetUnset($offset): void
5570
{
5671
if ($this->offsetExists($offset)) {
@@ -61,32 +76,50 @@ public function offsetUnset($offset): void
6176
}
6277
}
6378

79+
/**
80+
* Current method
81+
*/
6482
public function current(): mixed
6583
{
6684
$key = $this->keys[$this->position];
6785
return $this->source[$key];
6886
}
6987

88+
/**
89+
* Key method
90+
*/
7091
public function key(): mixed
7192
{
7293
return $this->keys[$this->position];
7394
}
7495

96+
/**
97+
* Next method
98+
*/
7599
public function next(): void
76100
{
77101
$this->position++;
78102
}
79103

104+
/**
105+
* Rewind method
106+
*/
80107
public function rewind(): void
81108
{
82109
$this->position = 0;
83110
}
84111

112+
/**
113+
* Valid method
114+
*/
85115
public function valid(): bool
86116
{
87117
return $this->position < count($this->keys);
88118
}
89119

120+
/**
121+
* Count method
122+
*/
90123
public function count(): int
91124
{
92125
return count($this->keys);

src/Http/Optimization/MemoryMapping.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class MemoryMapping
1919
private int $cacheSize = 0;
2020
private const MAX_CACHE_SIZE = 1024 * 1024; // 1MB cache per mapping
2121

22+
/**
23+
* __construct method
24+
*/
2225
public function __construct(
2326
string $filePath,
2427
int $offset = 0,

src/Http/Optimization/StreamView.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public function __construct(
2929
$this->length = $length ?? ($fileSize - $offset);
3030
}
3131

32+
/**
33+
* Read method
34+
*/
3235
public function read(?int $bytes = null): string|false
3336
{
3437
if (!$this->handle) {
@@ -76,6 +79,9 @@ public function stream($destination, int $chunkSize = 8192): int
7679
return $totalBytes;
7780
}
7881

82+
/**
83+
* __destruct method
84+
*/
7985
public function __destruct()
8086
{
8187
if ($this->handle) {

src/Http/Psr7/Response.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ class Response extends Message implements ResponseInterface
8080
511 => 'Network Authentication Required',
8181
];
8282

83+
/**
84+
* __construct method
85+
*/
8386
public function __construct(
8487
int $statusCode = 200,
8588
array $headers = [],

0 commit comments

Comments
 (0)