11<?php
22/**
3- * Cvd handler (last modified: 2022.02.12 ).
3+ * Cvd handler (last modified: 2026.03.18 ).
44 * @link https://github.com/phpMussel/SigTool/blob/master/Cvd.php
55 *
66 * Adapted from phpMussel's TarHandler class.
@@ -53,22 +53,22 @@ public function __construct(string $File)
5353 {
5454 /** Attempt to open the file. */
5555 if (
56- !is_readable ($ File ) ||
57- !is_file ($ File ) ||
58- !is_resource (($ Handle = fopen ($ File , 'rb ' )))
56+ !\ is_readable ($ File ) ||
57+ !\ is_file ($ File ) ||
58+ !\ is_resource (($ Handle = \ fopen ($ File , 'rb ' )))
5959 ) {
6060 $ this ->ErrorState = 2 ;
6161 return ;
6262 }
6363
6464 /** Attempt to read the file. */
65- while (!feof ($ Handle )) {
66- $ this ->Data .= fread ($ Handle , 131072 );
65+ while (!\ feof ($ Handle )) {
66+ $ this ->Data .= \ fread ($ Handle , 131072 );
6767 }
68- fclose ($ Handle );
68+ \ fclose ($ Handle );
6969
7070 /** Set total size. */
71- $ this ->TotalSize = strlen ($ this ->Data );
71+ $ this ->TotalSize = \ strlen ($ this ->Data );
7272
7373 /** Guard. */
7474 if ($ this ->TotalSize <= 512 ) {
@@ -77,13 +77,13 @@ public function __construct(string $File)
7777 }
7878
7979 /** Attempt to decompress the cvd data. */
80- $ this ->Data = gzdecode (substr ($ this ->Data , 512 ));
80+ $ this ->Data = \ gzdecode (\ substr ($ this ->Data , 512 ));
8181
8282 /** Pad the cvd data. */
83- $ this ->Data .= str_repeat ("\0" , 512 - (strlen ($ this ->Data ) % 512 ));
83+ $ this ->Data .= \ str_repeat ("\0" , 512 - (\ strlen ($ this ->Data ) % 512 ));
8484
8585 /** Adjust total size. */
86- if (($ this ->TotalSize = strlen ($ this ->Data )) < 1 ) {
86+ if (($ this ->TotalSize = \ strlen ($ this ->Data )) < 1 ) {
8787 $ this ->ErrorState = 2 ;
8888 return ;
8989 }
@@ -104,7 +104,7 @@ public function EntryRead(int $Bytes = -1): string
104104 if ($ Bytes < 0 || $ Bytes > $ Actual ) {
105105 $ Bytes = $ Actual ;
106106 }
107- return substr ($ this ->Data , $ this ->Offset + 512 , $ Bytes );
107+ return \ substr ($ this ->Data , $ this ->Offset + 512 , $ Bytes );
108108 }
109109
110110 /**
@@ -114,7 +114,7 @@ public function EntryRead(int $Bytes = -1): string
114114 */
115115 public function EntryActualSize (): int
116116 {
117- return octdec (preg_replace ('/\D/ ' , '' , substr ($ this ->Data , $ this ->Offset + 124 , 12 ))) ?: 0 ;
117+ return \ octdec (\ preg_replace ('/\D/ ' , '' , \ substr ($ this ->Data , $ this ->Offset + 124 , 12 ))) ?: 0 ;
118118 }
119119
120120 /**
@@ -125,7 +125,7 @@ public function EntryActualSize(): int
125125 public function EntryIsDirectory (): bool
126126 {
127127 $ Name = $ this ->EntryName ();
128- $ Separator = substr ($ Name , -1 , 1 );
128+ $ Separator = \ substr ($ Name , -1 , 1 );
129129 return (($ Separator === "\\" || $ Separator === '/ ' ) && $ this ->EntryActualSize () === 0 );
130130 }
131131
@@ -137,7 +137,7 @@ public function EntryIsDirectory(): bool
137137 */
138138 public function EntryName (): string
139139 {
140- return preg_replace ('/[^\x20-\xff]/ ' , '' , substr ($ this ->Data , $ this ->Offset , 100 ));
140+ return \ preg_replace ('/[^\x20-\xff]/ ' , '' , \ substr ($ this ->Data , $ this ->Offset , 100 ));
141141 }
142142
143143 /**
0 commit comments