summaryrefslogtreecommitdiff
path: root/includes/ZipDirectoryReader.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/ZipDirectoryReader.php')
-rw-r--r--includes/ZipDirectoryReader.php40
1 files changed, 20 insertions, 20 deletions
diff --git a/includes/ZipDirectoryReader.php b/includes/ZipDirectoryReader.php
index 0e84583f..646180d2 100644
--- a/includes/ZipDirectoryReader.php
+++ b/includes/ZipDirectoryReader.php
@@ -34,10 +34,10 @@ class ZipDirectoryReader {
*
* Because this class is aimed at verification, an error is raised on
* suspicious or ambiguous input, instead of emulating some standard
- * behaviour.
+ * behavior.
*
- * @param $fileName string The archive file name
- * @param $callback Array The callback function. It will be called for each file
+ * @param string $fileName The archive file name
+ * @param array $callback The callback function. It will be called for each file
* with a single associative array each time, with members:
*
* - name: The file name. Directories conventionally have a trailing
@@ -47,7 +47,7 @@ class ZipDirectoryReader {
*
* - size: The uncompressed file size
*
- * @param $options Array An associative array of read options, with the option
+ * @param array $options An associative array of read options, with the option
* name in the key. This may currently contain:
*
* - zip64: If this is set to true, then we will emulate a
@@ -181,7 +181,7 @@ class ZipDirectoryReader {
* Throw an error, and log a debug message
*/
function error( $code, $debugMessage ) {
- wfDebug( __CLASS__.": Fatal error: $debugMessage\n" );
+ wfDebug( __CLASS__ . ": Fatal error: $debugMessage\n" );
throw new ZipDirectoryReaderError( $code );
}
@@ -220,7 +220,7 @@ class ZipDirectoryReader {
if ( $structSize + $this->eocdr['file comment length'] != strlen( $block ) - $sigPos ) {
$this->error( 'zip-bad', 'trailing bytes after the end of the file comment' );
}
- if ( $this->eocdr['disk'] !== 0
+ if ( $this->eocdr['disk'] !== 0
|| $this->eocdr['CD start disk'] !== 0 )
{
$this->error( 'zip-unsupported', 'more than one disk (in EOCDR)' );
@@ -262,7 +262,7 @@ class ZipDirectoryReader {
* may replace the regular "end of central directory record" in ZIP64 files.
*/
function readZip64EndOfCentralDirectoryRecord() {
- if ( $this->eocdr64Locator['eocdr64 start disk'] != 0
+ if ( $this->eocdr64Locator['eocdr64 start disk'] != 0
|| $this->eocdr64Locator['number of disks'] != 0 )
{
$this->error( 'zip-unsupported', 'more than one disk (in EOCDR64 locator)' );
@@ -286,7 +286,7 @@ class ZipDirectoryReader {
if ( $data['signature'] !== "PK\x06\x06" ) {
$this->error( 'zip-bad', 'wrong signature on Zip64 end of central directory record' );
}
- if ( $data['disk'] !== 0
+ if ( $data['disk'] !== 0
|| $data['CD start disk'] !== 0 )
{
$this->error( 'zip-unsupported', 'more than one disk (in EOCDR64)' );
@@ -327,7 +327,7 @@ class ZipDirectoryReader {
$offset = $this->eocdr['CD offset'];
$numEntries = $this->eocdr['CD entries total'];
$endPos = $this->eocdr['position'];
- if ( $size == 0xffffffff
+ if ( $size == 0xffffffff
|| $offset == 0xffffffff
|| $numEntries == 0xffff )
{
@@ -395,7 +395,7 @@ class ZipDirectoryReader {
$data += $this->unpack( $block, $variableInfo, $pos );
$pos += $this->getStructSize( $variableInfo );
- if ( $this->zip64 && (
+ if ( $this->zip64 && (
$data['compressed size'] == 0xffffffff
|| $data['uncompressed size'] == 0xffffffff
|| $data['local header offset'] == 0xffffffff ) )
@@ -494,8 +494,8 @@ class ZipDirectoryReader {
* Get the file contents from a given offset. If there are not enough bytes
* in the file to satisfy the request, an exception will be thrown.
*
- * @param $start int The byte offset of the start of the block.
- * @param $length int The number of bytes to return. If omitted, the remainder
+ * @param int $start The byte offset of the start of the block.
+ * @param int $length The number of bytes to return. If omitted, the remainder
* of the file will be returned.
*
* @return string
@@ -538,7 +538,7 @@ class ZipDirectoryReader {
* of length self::SEGSIZE. The result is cached. This is a helper function
* for getBlock().
*
- * If there are not enough bytes in the file to satsify the request, the
+ * If there are not enough bytes in the file to satisfy the request, the
* return value will be truncated. If a request is made for a segment beyond
* the end of the file, an empty string will be returned.
* @return string
@@ -570,7 +570,7 @@ class ZipDirectoryReader {
$size = 0;
foreach ( $struct as $type ) {
if ( is_array( $type ) ) {
- list( $typeName, $fieldSize ) = $type;
+ list( , $fieldSize ) = $type;
$size += $fieldSize;
} else {
$size += $type;
@@ -583,9 +583,9 @@ class ZipDirectoryReader {
* Unpack a binary structure. This is like the built-in unpack() function
* except nicer.
*
- * @param $string string The binary data input
+ * @param string $string The binary data input
*
- * @param $struct array An associative array giving structure members and their
+ * @param array $struct An associative array giving structure members and their
* types. In the key is the field name. The value may be either an
* integer, in which case the field is a little-endian unsigned integer
* encoded in the given number of bytes, or an array, in which case the
@@ -594,8 +594,9 @@ class ZipDirectoryReader {
* - "string": The second array element gives the length of string.
* Not null terminated.
*
- * @param $offset int The offset into the string at which to start unpacking.
+ * @param int $offset The offset into the string at which to start unpacking.
*
+ * @throws MWException
* @return array Unpacked associative array. Note that large integers in the input
* may be represented as floating point numbers in the return value, so
* the use of weak comparison is advised.
@@ -617,12 +618,11 @@ class ZipDirectoryReader {
$pos += $fieldSize;
break;
default:
- throw new MWException( __METHOD__.": invalid type \"$typeName\"" );
+ throw new MWException( __METHOD__ . ": invalid type \"$typeName\"" );
}
} else {
// Unsigned little-endian integer
$length = intval( $type );
- $bytes = substr( $string, $pos, $length );
// Calculate the value. Use an algorithm which automatically
// upgrades the value to floating point if necessary.
@@ -651,7 +651,7 @@ class ZipDirectoryReader {
* boolean.
*
* @param $value integer
- * @param $bitIndex int The index of the bit, where 0 is the LSB.
+ * @param int $bitIndex The index of the bit, where 0 is the LSB.
* @return bool
*/
function testBit( $value, $bitIndex ) {