Skip to content

Commit 3d8ce53

Browse files
authored
Merge pull request #133 from utopia-php/telemetry-device
fix(telemetry): func_get_args doesn't forward arguments by reference, uses by-value instead
2 parents 9a2556c + a3a3773 commit 3d8ce53

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

src/Storage/Device/Telemetry.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function setTelemetry(Adapter $telemetry): void
1818
$this->underlying->setTelemetry($telemetry);
1919
}
2020

21-
private function measure(string $method, array $args): mixed
21+
private function measure(string $method, &...$args): mixed
2222
{
2323
$start = microtime(true);
2424
try {
@@ -56,91 +56,91 @@ public function getRoot(): string
5656

5757
public function getPath(string $filename, string $prefix = null): string
5858
{
59-
return $this->measure(__FUNCTION__, func_get_args());
59+
return $this->measure(__FUNCTION__, $filename, $prefix);
6060
}
6161

6262
public function upload(string $source, string $path, int $chunk = 1, int $chunks = 1, array &$metadata = []): int
6363
{
64-
return $this->measure(__FUNCTION__, func_get_args());
64+
return $this->measure(__FUNCTION__, $source, $path, $chunk, $chunks, $metadata);
6565
}
6666

6767
public function uploadData(string $data, string $path, string $contentType, int $chunk = 1, int $chunks = 1, array &$metadata = []): int
6868
{
69-
return $this->measure(__FUNCTION__, func_get_args());
69+
return $this->measure(__FUNCTION__, $data, $path, $contentType, $chunk, $chunks, $metadata);
7070
}
7171

7272
public function abort(string $path, string $extra = ''): bool
7373
{
74-
return $this->measure(__FUNCTION__, func_get_args());
74+
return $this->measure(__FUNCTION__, $path, $extra);
7575
}
7676

7777
public function read(string $path, int $offset = 0, int $length = null): string
7878
{
79-
return $this->measure(__FUNCTION__, func_get_args());
79+
return $this->measure(__FUNCTION__, $path, $offset, $length);
8080
}
8181

8282
public function transfer(string $path, string $destination, Device $device): bool
8383
{
84-
return $this->measure(__FUNCTION__, func_get_args());
84+
return $this->measure(__FUNCTION__, $path, $destination, $device);
8585
}
8686

8787
public function write(string $path, string $data, string $contentType): bool
8888
{
89-
return $this->measure(__FUNCTION__, func_get_args());
89+
return $this->measure(__FUNCTION__, $path, $data, $contentType);
9090
}
9191

9292
public function delete(string $path, bool $recursive = false): bool
9393
{
94-
return $this->measure(__FUNCTION__, func_get_args());
94+
return $this->measure(__FUNCTION__, $path, $recursive);
9595
}
9696

9797
public function deletePath(string $path): bool
9898
{
99-
return $this->measure(__FUNCTION__, func_get_args());
99+
return $this->measure(__FUNCTION__, $path);
100100
}
101101

102102
public function exists(string $path): bool
103103
{
104-
return $this->measure(__FUNCTION__, func_get_args());
104+
return $this->measure(__FUNCTION__, $path);
105105
}
106106

107107
public function getFileSize(string $path): int
108108
{
109-
return $this->measure(__FUNCTION__, func_get_args());
109+
return $this->measure(__FUNCTION__, $path);
110110
}
111111

112112
public function getFileMimeType(string $path): string
113113
{
114-
return $this->measure(__FUNCTION__, func_get_args());
114+
return $this->measure(__FUNCTION__, $path);
115115
}
116116

117117
public function getFileHash(string $path): string
118118
{
119-
return $this->measure(__FUNCTION__, func_get_args());
119+
return $this->measure(__FUNCTION__, $path);
120120
}
121121

122122
public function createDirectory(string $path): bool
123123
{
124-
return $this->measure(__FUNCTION__, func_get_args());
124+
return $this->measure(__FUNCTION__, $path);
125125
}
126126

127127
public function getDirectorySize(string $path): int
128128
{
129-
return $this->measure(__FUNCTION__, func_get_args());
129+
return $this->measure(__FUNCTION__, $path);
130130
}
131131

132132
public function getPartitionFreeSpace(): float
133133
{
134-
return $this->measure(__FUNCTION__, func_get_args());
134+
return $this->measure(__FUNCTION__);
135135
}
136136

137137
public function getPartitionTotalSpace(): float
138138
{
139-
return $this->measure(__FUNCTION__, func_get_args());
139+
return $this->measure(__FUNCTION__);
140140
}
141141

142142
public function getFiles(string $dir, int $max = self::MAX_PAGE_SIZE, string $continuationToken = ''): array
143143
{
144-
return $this->measure(__FUNCTION__, func_get_args());
144+
return $this->measure(__FUNCTION__, $dir, $max, $continuationToken);
145145
}
146146
}

0 commit comments

Comments
 (0)