@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * Build a new instance |
| 78 | 78 | * |
| 79 | 79 | * @param array $options An array of options for the password isntance |
| 80 | - * @param Generator $generator The random generator to use for seeds |
|
| 80 | + * @param \PasswordLib\Random\Generator $generator The random generator to use for seeds |
|
| 81 | 81 | * |
| 82 | 82 | * @return void |
| 83 | 83 | */ |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | /** |
| 125 | 125 | * Set the random number generator to use |
| 126 | 126 | * |
| 127 | - * @param Generator $generator The random generator to use for seeds |
|
| 127 | + * @param \PasswordLib\Random\Generator $generator The random generator to use for seeds |
|
| 128 | 128 | * |
| 129 | 129 | * @return void |
| 130 | 130 | */ |
@@ -74,6 +74,9 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | + /** |
|
| 78 | + * @param string $file |
|
| 79 | + */ |
|
| 77 | 80 | function getMetrics($file) { |
| 78 | 81 | $this->filename = $file; |
| 79 | 82 | $this->fh = fopen($file,'rb') or die('Can\'t open file ' . $file); |
@@ -116,6 +119,10 @@ discard block |
||
| 116 | 119 | } |
| 117 | 120 | |
| 118 | 121 | |
| 122 | + /** |
|
| 123 | + * @param integer[] $x |
|
| 124 | + * @param integer[] $y |
|
| 125 | + */ |
|
| 119 | 126 | function sub32($x, $y) { |
| 120 | 127 | $xlo = $x[1]; |
| 121 | 128 | $xhi = $x[0]; |
@@ -154,11 +161,17 @@ discard block |
||
| 154 | 161 | fseek($this->fh,$this->_pos); |
| 155 | 162 | } |
| 156 | 163 | |
| 164 | + /** |
|
| 165 | + * @param integer $delta |
|
| 166 | + */ |
|
| 157 | 167 | function skip($delta) { |
| 158 | 168 | $this->_pos = $this->_pos + $delta; |
| 159 | 169 | fseek($this->fh,$this->_pos); |
| 160 | 170 | } |
| 161 | 171 | |
| 172 | + /** |
|
| 173 | + * @param string $tag |
|
| 174 | + */ |
|
| 162 | 175 | function seek_table($tag, $offset_in_table = 0) { |
| 163 | 176 | $tpos = $this->get_table_pos($tag); |
| 164 | 177 | $this->_pos = $tpos[0] + $offset_in_table; |
@@ -222,10 +235,17 @@ discard block |
||
| 222 | 235 | return pack("n",$val); |
| 223 | 236 | } |
| 224 | 237 | |
| 238 | + /** |
|
| 239 | + * @param string $value |
|
| 240 | + */ |
|
| 225 | 241 | function splice($stream, $offset, $value) { |
| 226 | 242 | return substr($stream,0,$offset) . $value . substr($stream,$offset+strlen($value)); |
| 227 | 243 | } |
| 228 | 244 | |
| 245 | + /** |
|
| 246 | + * @param string|null $stream |
|
| 247 | + * @param integer $offset |
|
| 248 | + */ |
|
| 229 | 249 | function _set_ushort($stream, $offset, $value) { |
| 230 | 250 | $up = pack("n", $value); |
| 231 | 251 | return $this->splice($stream, $offset, $up); |
@@ -247,6 +267,9 @@ discard block |
||
| 247 | 267 | return (fread($this->fh,$length)); |
| 248 | 268 | } |
| 249 | 269 | |
| 270 | + /** |
|
| 271 | + * @param string $tag |
|
| 272 | + */ |
|
| 250 | 273 | function get_table($tag) { |
| 251 | 274 | list($pos, $length) = $this->get_table_pos($tag); |
| 252 | 275 | if ($length == 0) { die('Truetype font ('.$this->filename.'): error reading table: '.$tag); } |
@@ -254,6 +277,10 @@ discard block |
||
| 254 | 277 | return (fread($this->fh,$length)); |
| 255 | 278 | } |
| 256 | 279 | |
| 280 | + /** |
|
| 281 | + * @param string $tag |
|
| 282 | + * @param null|string $data |
|
| 283 | + */ |
|
| 257 | 284 | function add($tag, $data) { |
| 258 | 285 | if ($tag == 'head') { |
| 259 | 286 | $data = $this->splice($data, 8, "\0\0\0\0"); |
@@ -491,6 +518,9 @@ discard block |
||
| 491 | 518 | ///////////////////////////////////////////////////////////////////////////////////////// |
| 492 | 519 | |
| 493 | 520 | |
| 521 | + /** |
|
| 522 | + * @return string |
|
| 523 | + */ |
|
| 494 | 524 | function makeSubset($file, &$subset) { |
| 495 | 525 | $this->filename = $file; |
| 496 | 526 | $this->fh = fopen($file ,'rb') or die('Can\'t open file ' . $file); |
@@ -884,6 +914,11 @@ discard block |
||
| 884 | 914 | |
| 885 | 915 | ////////////////////////////////////////////////////////////////////////////////// |
| 886 | 916 | |
| 917 | + /** |
|
| 918 | + * @param integer $numberOfHMetrics |
|
| 919 | + * @param integer $numGlyphs |
|
| 920 | + * @param integer $scale |
|
| 921 | + */ |
|
| 887 | 922 | function getHMTX($numberOfHMetrics, $numGlyphs, &$glyphToChar, $scale) { |
| 888 | 923 | $start = $this->seek_table("hmtx"); |
| 889 | 924 | $aw = 0; |
@@ -949,6 +984,9 @@ discard block |
||
| 949 | 984 | $this->charWidths[1] = chr($nCharWidths & 0xFF); |
| 950 | 985 | } |
| 951 | 986 | |
| 987 | + /** |
|
| 988 | + * @param integer $numberOfHMetrics |
|
| 989 | + */ |
|
| 952 | 990 | function getHMetric($numberOfHMetrics, $gid) { |
| 953 | 991 | $start = $this->seek_table("hmtx"); |
| 954 | 992 | if ($gid < $numberOfHMetrics) { |
@@ -964,6 +1002,10 @@ discard block |
||
| 964 | 1002 | return $hm; |
| 965 | 1003 | } |
| 966 | 1004 | |
| 1005 | + /** |
|
| 1006 | + * @param integer $indexToLocFormat |
|
| 1007 | + * @param integer $numGlyphs |
|
| 1008 | + */ |
|
| 967 | 1009 | function getLOCA($indexToLocFormat, $numGlyphs) { |
| 968 | 1010 | $start = $this->seek_table('loca'); |
| 969 | 1011 | $this->glyphPos = array(); |
@@ -987,6 +1029,10 @@ discard block |
||
| 987 | 1029 | |
| 988 | 1030 | |
| 989 | 1031 | // CMAP Format 4 |
| 1032 | + |
|
| 1033 | + /** |
|
| 1034 | + * @param integer $unicode_cmap_offset |
|
| 1035 | + */ |
|
| 990 | 1036 | function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph ) { |
| 991 | 1037 | $this->maxUniChar = 0; |
| 992 | 1038 | $this->seek($unicode_cmap_offset + 2); |
@@ -1032,6 +1078,10 @@ discard block |
||
| 1032 | 1078 | |
| 1033 | 1079 | |
| 1034 | 1080 | // Put the TTF file together |
| 1081 | + |
|
| 1082 | + /** |
|
| 1083 | + * @param string $stm |
|
| 1084 | + */ |
|
| 1035 | 1085 | function endTTFile(&$stm) { |
| 1036 | 1086 | $stm = ''; |
| 1037 | 1087 | $numTables = count($this->otables); |
@@ -120,6 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Compute key depending on object number where the encrypted data is stored |
| 123 | + * @param integer $n |
|
| 123 | 124 | */ |
| 124 | 125 | function _objectkey($n) |
| 125 | 126 | { |
@@ -168,6 +169,8 @@ discard block |
||
| 168 | 169 | |
| 169 | 170 | /** |
| 170 | 171 | * Compute O value |
| 172 | + * @param string $user_pass |
|
| 173 | + * @param string $owner_pass |
|
| 171 | 174 | */ |
| 172 | 175 | function _Ovalue($user_pass, $owner_pass) |
| 173 | 176 | { |
@@ -186,6 +189,8 @@ discard block |
||
| 186 | 189 | |
| 187 | 190 | /** |
| 188 | 191 | * Compute encryption key |
| 192 | + * @param string $user_pass |
|
| 193 | + * @param integer $protection |
|
| 189 | 194 | */ |
| 190 | 195 | function _generateencryptionkey($user_pass, $owner_pass, $protection) |
| 191 | 196 | { |
@@ -170,6 +170,10 @@ discard block |
||
| 170 | 170 | $this->PDFVersion = '1.3'; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | +/** |
|
| 174 | + * @param double $left |
|
| 175 | + * @param double $top |
|
| 176 | + */ |
|
| 173 | 177 | function SetMargins($left, $top, $right=null) |
| 174 | 178 | { |
| 175 | 179 | // Set left, top and right margins |
@@ -200,6 +204,9 @@ discard block |
||
| 200 | 204 | $this->rMargin = $margin; |
| 201 | 205 | } |
| 202 | 206 | |
| 207 | +/** |
|
| 208 | + * @param boolean $auto |
|
| 209 | + */ |
|
| 203 | 210 | function SetAutoPageBreak($auto, $margin=0) |
| 204 | 211 | { |
| 205 | 212 | // Set auto page break mode and triggering margin |
@@ -208,6 +215,9 @@ discard block |
||
| 208 | 215 | $this->PageBreakTrigger = $this->h-$margin; |
| 209 | 216 | } |
| 210 | 217 | |
| 218 | +/** |
|
| 219 | + * @param string $zoom |
|
| 220 | + */ |
|
| 211 | 221 | function SetDisplayMode($zoom, $layout='default') |
| 212 | 222 | { |
| 213 | 223 | // Set display mode in viewer |
@@ -221,6 +231,9 @@ discard block |
||
| 221 | 231 | $this->Error('Incorrect layout display mode: '.$layout); |
| 222 | 232 | } |
| 223 | 233 | |
| 234 | +/** |
|
| 235 | + * @param boolean $compress |
|
| 236 | + */ |
|
| 224 | 237 | function SetCompression($compress) |
| 225 | 238 | { |
| 226 | 239 | // Set page compression |
@@ -473,6 +486,9 @@ discard block |
||
| 473 | 486 | $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); |
| 474 | 487 | } |
| 475 | 488 | |
| 489 | +/** |
|
| 490 | + * @param string $family |
|
| 491 | + */ |
|
| 476 | 492 | function AddFont($family, $style='', $file='', $uni=false) |
| 477 | 493 | { |
| 478 | 494 | // Add a TrueType, OpenType or Type1 font |
@@ -584,6 +600,9 @@ discard block |
||
| 584 | 600 | } |
| 585 | 601 | } |
| 586 | 602 | |
| 603 | +/** |
|
| 604 | + * @param string $family |
|
| 605 | + */ |
|
| 587 | 606 | function SetFont($family, $style='', $size=0) |
| 588 | 607 | { |
| 589 | 608 | // Select a font; size given in points |
@@ -665,6 +684,10 @@ discard block |
||
| 665 | 684 | $this->links[$link] = array($page, $y); |
| 666 | 685 | } |
| 667 | 686 | |
| 687 | +/** |
|
| 688 | + * @param double $y |
|
| 689 | + * @param string $link |
|
| 690 | + */ |
|
| 668 | 691 | function Link($x, $y, $w, $h, $link) |
| 669 | 692 | { |
| 670 | 693 | // Put a link on the page |
@@ -1072,6 +1095,9 @@ discard block |
||
| 1072 | 1095 | } |
| 1073 | 1096 | } |
| 1074 | 1097 | |
| 1098 | +/** |
|
| 1099 | + * @param integer $h |
|
| 1100 | + */ |
|
| 1075 | 1101 | function Ln($h=null) |
| 1076 | 1102 | { |
| 1077 | 1103 | // Line feed; default value is last cell height |
@@ -1305,6 +1331,10 @@ discard block |
||
| 1305 | 1331 | } |
| 1306 | 1332 | } |
| 1307 | 1333 | |
| 1334 | +/** |
|
| 1335 | + * @param string $orientation |
|
| 1336 | + * @param string $size |
|
| 1337 | + */ |
|
| 1308 | 1338 | function _beginpage($orientation, $size) |
| 1309 | 1339 | { |
| 1310 | 1340 | $this->page++; |
@@ -1350,6 +1380,9 @@ discard block |
||
| 1350 | 1380 | $this->state = 1; |
| 1351 | 1381 | } |
| 1352 | 1382 | |
| 1383 | +/** |
|
| 1384 | + * @param string $font |
|
| 1385 | + */ |
|
| 1353 | 1386 | function _loadfont($font) |
| 1354 | 1387 | { |
| 1355 | 1388 | // Load a font definition file from the font directory |
@@ -1437,6 +1470,9 @@ discard block |
||
| 1437 | 1470 | return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); |
| 1438 | 1471 | } |
| 1439 | 1472 | |
| 1473 | +/** |
|
| 1474 | + * @param string $file |
|
| 1475 | + */ |
|
| 1440 | 1476 | function _parsepng($file) |
| 1441 | 1477 | { |
| 1442 | 1478 | // Extract info from a PNG file |
@@ -1973,6 +2009,9 @@ discard block |
||
| 1973 | 2009 | } |
| 1974 | 2010 | } |
| 1975 | 2011 | |
| 2012 | +/** |
|
| 2013 | + * @param integer $maxUni |
|
| 2014 | + */ |
|
| 1976 | 2015 | function _putTTfontwidths(&$font, $maxUni) { |
| 1977 | 2016 | if (file_exists($font['unifilename'].'.cw127.php')) { |
| 1978 | 2017 | include($font['unifilename'].'.cw127.php') ; |
@@ -98,7 +98,6 @@ discard block |
||
| 98 | 98 | * it into 3 64 bit parts, and then does the following |
| 99 | 99 | * DES ENCRYPT(key1) -> DES DECRYPT(key2) -> DES ENCRYPT(key3) |
| 100 | 100 | * |
| 101 | - * @param string $data A plain text string |
|
| 102 | 101 | * @return boolean Returns true |
| 103 | 102 | */ |
| 104 | 103 | public function encrypt(&$text) |
@@ -128,7 +127,6 @@ discard block |
||
| 128 | 127 | * it into 3 64 bit parts, and then does the following |
| 129 | 128 | * DES DECRYPT(key1) -> DES ENCRYPT(key2) -> DES DECRYPT(key3) |
| 130 | 129 | * |
| 131 | - * @param string $encrypted A DES encrypted string |
|
| 132 | 130 | * @return boolean Returns true |
| 133 | 131 | */ |
| 134 | 132 | public function decrypt(&$text) |
@@ -229,6 +227,7 @@ discard block |
||
| 229 | 227 | * to make a 24 byte key |
| 230 | 228 | * |
| 231 | 229 | * @param string $key The 8 or 16 byte key to expand |
| 230 | + * @param integer $len |
|
| 232 | 231 | * @return string If the key given is 8 or 16 bytes it returns the |
| 233 | 232 | * expanded 24 byte key, else it returns the original key unexpanded |
| 234 | 233 | */ |
@@ -247,7 +247,7 @@ |
||
| 247 | 247 | * NOTE: Please read the comments in the $this->gamma() function. This |
| 248 | 248 | * function calls the $this->gamma() function which does not do anything. |
| 249 | 249 | * |
| 250 | - * @param array $d A 3 element 32 bit integer array |
|
| 250 | + * @param integer[] $d A 3 element 32 bit integer array |
|
| 251 | 251 | * @return void |
| 252 | 252 | */ |
| 253 | 253 | private function rho(&$d) |
@@ -73,7 +73,6 @@ discard block |
||
| 73 | 73 | /** |
| 74 | 74 | * Encrypt plain text data using ARC4 |
| 75 | 75 | * |
| 76 | - * @param string $data A plain text string, 8 bytes long |
|
| 77 | 76 | * @return boolean Returns true |
| 78 | 77 | */ |
| 79 | 78 | public function encrypt(&$text) |
@@ -86,7 +85,6 @@ discard block |
||
| 86 | 85 | /** |
| 87 | 86 | * Decrypt a ARC4 encrypted string |
| 88 | 87 | * |
| 89 | - * @param string $encrypted A ARC4 encrypted string, 8 bytes long |
|
| 90 | 88 | * @return boolean Returns true |
| 91 | 89 | */ |
| 92 | 90 | public function decrypt(&$text) |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * Cast 128 F1 function |
| 263 | 263 | * |
| 264 | 264 | * @param $r integer The right half of the data being encrypted in cast_128() |
| 265 | - * @param $i integer The round number (1-16) in cast_128() |
|
| 265 | + * @param integer $i integer The round number (1-16) in cast_128() |
|
| 266 | 266 | * @return integer The value after the F1 transformation |
| 267 | 267 | */ |
| 268 | 268 | private function f1($r, $i) |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * Cast 128 F2 function |
| 285 | 285 | * |
| 286 | 286 | * @param $r integer The right half of the data being encrypted in cast_128() |
| 287 | - * @param $i integer The round number (1-16) in cast_128() |
|
| 287 | + * @param integer $i integer The round number (1-16) in cast_128() |
|
| 288 | 288 | * @return integer The value after the F2 transformation |
| 289 | 289 | */ |
| 290 | 290 | private function f2($r, $i) |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * Cast 128 F3 function |
| 307 | 307 | * |
| 308 | 308 | * @param $r integer The right half of the data being encrypted in cast_128() |
| 309 | - * @param $i integer The round number (1-16) in cast_128() |
|
| 309 | + * @param integer $i integer The round number (1-16) in cast_128() |
|
| 310 | 310 | * @return integer The value after the F3 transformation |
| 311 | 311 | */ |
| 312 | 312 | private function f3($r, $i) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | /** |
| 238 | 238 | * CAST-256 F2 function |
| 239 | 239 | * |
| 240 | - * @param $d integer The the data input |
|
| 240 | + * @param integer $d integer The the data input |
|
| 241 | 241 | * @param $m integer The 32 bit masking key |
| 242 | 242 | * @param $r integer The round number |
| 243 | 243 | * @return integer The value after the F2 calculation |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | /** |
| 259 | 259 | * CAST-256 F3 function |
| 260 | 260 | * |
| 261 | - * @param $d integer The the data input |
|
| 261 | + * @param integer $d integer The the data input |
|
| 262 | 262 | * @param $m integer The 32 bit masking key |
| 263 | 263 | * @param $r integer The round number |
| 264 | 264 | * @return integer The value after the F3 calculation |