Skip to content

Commit c5d9001

Browse files
committed
Add missing documentation
Signed-off-by: Michal Čihař <[email protected]>
1 parent 02f3e5d commit c5d9001

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Util.php

+22
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
class Util {
2525
private static $little_endian = null;
2626

27+
/**
28+
* Reads data
29+
*
30+
* @param string $type type for unpack()
31+
* @param string $data Data to process
32+
*
33+
* @return mixed
34+
*/
2735
public static function loadData($type, $data) {
2836
if (!$data) {
2937
return $data;
@@ -32,6 +40,13 @@ public static function loadData($type, $data) {
3240
return current($tmp);
3341
}
3442

43+
/**
44+
* Changes endianity
45+
*
46+
* @param string $value Binary value
47+
*
48+
* @return string
49+
*/
3550
public static function swap($binValue) {
3651
$result = $binValue{strlen($binValue) - 1};
3752
for ($i = strlen($binValue) - 2; $i >= 0; $i--) {
@@ -41,6 +56,13 @@ public static function swap($binValue) {
4156
return $result;
4257
}
4358

59+
/**
60+
* Encodes double value to correct endianity
61+
*
62+
* @param double $value Value to pack
63+
*
64+
* @return string
65+
*/
4466
public static function packDouble($value) {
4567
$bin = pack("d", (double) $value);
4668

0 commit comments

Comments
 (0)