Merge "Add oldRev parameter to DiffRevisionTools hook"
[lhc/web/wiklou.git] / includes / media / Exif.php
index bc55000..844aef2 100644 (file)
@@ -66,77 +66,46 @@ class Exif {
        /** A fake value for things we don't want or don't support. */
        const IGNORE = -1;
 
-       //@{
-       /* @var array
-        * @private
+       /** @var array Exif tags grouped by category, the tagname itself is the key
+        *    and the type is the value, in the case of more than one possible value
+        *    type they are separated by commas.
         */
+       private $mExifTags;
 
-       /**
-        * Exif tags grouped by category, the tagname itself is the key and the type
-        * is the value, in the case of more than one possible value type they are
-        * separated by commas.
-        */
-       var $mExifTags;
-
-       /**
-        * The raw Exif data returned by exif_read_data()
-        */
-       var $mRawExifData;
+       /** @var array The raw Exif data returned by exif_read_data() */
+       private $mRawExifData;
 
-       /**
-        * A Filtered version of $mRawExifData that has been pruned of invalid
-        * tags and tags that contain content they shouldn't contain according
-        * to the Exif specification
+       /** @var array A Filtered version of $mRawExifData that has been pruned
+        *    of invalid tags and tags that contain content they shouldn't contain
+        *    according to the Exif specification
         */
-       var $mFilteredExifData;
+       private $mFilteredExifData;
 
-       /**
-        * Filtered and formatted Exif data, see FormatMetadata::getFormattedData()
-        */
-       var $mFormattedExifData;
+       /** @var string The file being processed */
+       private $file;
 
-       //@}
+       /** @var string The basename of the file being processed */
+       private $basename;
 
-       //@{
-       /* @var string
-        * @private
-        */
+       /** @var string The private log to log to, e.g. 'exif' */
+       private $log = false;
 
-       /**
-        * The file being processed
-        */
-       var $file;
-
-       /**
-        * The basename of the file being processed
-        */
-       var $basename;
-
-       /**
-        * The private log to log to, e.g. 'exif'
-        */
-       var $log = false;
-
-       /**
-        * The byte order of the file. Needed because php's
-        * extension doesn't fully process some obscure props.
+       /** @var string The byte order of the file. Needed because php's extension
+        *    doesn't fully process some obscure props.
         */
        private $byteOrder;
 
-       //@}
-
        /**
         * Constructor
         *
-        * @param string $file filename.
+        * @param string $file Filename.
         * @param string $byteOrder Type of byte ordering either 'BE' (Big Endian)
         *   or 'LE' (Little Endian). Default ''.
         * @throws MWException
         * @todo FIXME: The following are broke:
-        * SubjectArea. Need to test the more obscure tags.
-        *
-        * DigitalZoomRatio = 0/0 is rejected. need to determine if that's valid.
-        * possibly should treat 0/0 = 0. need to read exif spec on that.
+        *   SubjectArea. Need to test the more obscure tags.
+        *   DigitalZoomRatio = 0/0 is rejected. need to determine if that's valid.
+        *   Possibly should treat 0/0 = 0. need to read exif spec on that.
         */
        function __construct( $file, $byteOrder = '' ) {
                /**
@@ -194,7 +163,7 @@ class Exif {
 
                        # Exif IFD Attribute Information (p30-31)
                        'EXIF' => array(
-                               # TODO: NOTE: Nonexistence of this field is taken to mean nonconformance
+                               # @todo NOTE: Nonexistence of this field is taken to mean nonconformance
                                # to the Exif 2.1 AND 2.2 standards
                                'ExifVersion' => Exif::UNDEFINED, # Exif version
                                'FlashPixVersion' => Exif::UNDEFINED, # Supported Flashpix version #p32
@@ -337,7 +306,7 @@ class Exif {
                 * when somebody uploads a file called something.jpeg
                 * containing random gibberish.
                 */
-               $this->mRawExifData = $data ? $data : array();
+               $this->mRawExifData = $data ?: array();
                $this->makeFilteredData();
                $this->collapseData();
                $this->debugFile( __FUNCTION__, false );
@@ -537,7 +506,7 @@ class Exif {
         * Convert an Exif::UNDEFINED from a raw binary string
         * to its value. This is sometimes needed depending on
         * the type of UNDEFINED field
-        * @param string $prop name of property
+        * @param string $prop Name of property
         */
        private function exifPropToOrd( $prop ) {
                if ( isset( $this->mFilteredExifData[$prop] ) ) {
@@ -548,7 +517,7 @@ class Exif {
        /**
         * Convert gps in exif form to a single floating point number
         * for example 10 degress 20`40`` S -> -10.34444
-        * @param string $prop a gps coordinate exif tag name (like GPSLongitude)
+        * @param string $prop A GPS coordinate exif tag name (like GPSLongitude)
         */
        private function exifGPStoNumber( $prop ) {
                $loc =& $this->mFilteredExifData[$prop];
@@ -581,18 +550,6 @@ class Exif {
                }
        }
 
-       /**
-        * Use FormatMetadata to create formatted values for display to user
-        * (is this ever used?)
-        *
-        * @deprecated since 1.18
-        */
-       function makeFormattedData() {
-               wfDeprecated( __METHOD__, '1.18' );
-               $this->mFormattedExifData = FormatMetadata::getFormattedData(
-                       $this->mFilteredExifData );
-       }
-
        /**#@-*/
 
        /**#@+
@@ -613,23 +570,6 @@ class Exif {
                return $this->mFilteredExifData;
        }
 
-       /**
-        * Get $this->mFormattedExifData
-        *
-        * This returns the data for display to user.
-        * Its unclear if this is ever used.
-        *
-        * @deprecated since 1.18
-        */
-       function getFormattedData() {
-               wfDeprecated( __METHOD__, '1.18' );
-               if ( !$this->mFormattedExifData ) {
-                       $this->makeFormattedData();
-               }
-
-               return $this->mFormattedExifData;
-       }
-
        /**#@-*/
 
        /**
@@ -651,9 +591,7 @@ class Exif {
        /**#@+
         * Validates if a tag value is of the type it should be according to the Exif spec
         *
-        * @private
-        *
-        * @param $in Mixed: the input value to check
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isByte( $in ) {
@@ -669,7 +607,7 @@ class Exif {
        }
 
        /**
-        * @param $in
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isASCII( $in ) {
@@ -693,7 +631,7 @@ class Exif {
        }
 
        /**
-        * @param $in
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isShort( $in ) {
@@ -709,7 +647,7 @@ class Exif {
        }
 
        /**
-        * @param $in
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isLong( $in ) {
@@ -725,7 +663,7 @@ class Exif {
        }
 
        /**
-        * @param $in
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isRational( $in ) {
@@ -744,7 +682,7 @@ class Exif {
        }
 
        /**
-        * @param $in
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isUndefined( $in ) {
@@ -754,7 +692,7 @@ class Exif {
        }
 
        /**
-        * @param $in
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isSlong( $in ) {
@@ -770,7 +708,7 @@ class Exif {
        }
 
        /**
-        * @param $in
+        * @param mixed $in The input value to check
         * @return bool
         */
        private function isSrational( $in ) {
@@ -793,11 +731,10 @@ class Exif {
        /**
         * Validates if a tag has a legal value according to the Exif spec
         *
-        * @private
         * @param string $section section where tag is located.
         * @param string $tag the tag to check.
-        * @param $val Mixed: the value of the tag.
-        * @param $recursive Boolean: true if called recursively for array types.
+        * @param mixed $val The value of the tag.
+        * @param bool $recursive True if called recursively for array types.
         * @return bool
         */
        private function validate( $section, $tag, $val, $recursive = false ) {
@@ -877,11 +814,9 @@ class Exif {
        /**
         * Convenience function for debugging output
         *
-        * @private
-        *
-        * @param $in Mixed:
-        * @param $fname String:
-        * @param $action Mixed: , default NULL.
+        * @param mixed $in Arrays will be processed with print_r().
+        * @param string $fname Function name to log.
+        * @param string|bool|null $action Default null.
         */
        private function debug( $in, $fname, $action = null ) {
                if ( !$this->log ) {
@@ -907,10 +842,8 @@ class Exif {
        /**
         * Convenience function for debugging output
         *
-        * @private
-        *
         * @param string $fname the name of the function calling this function
-        * @param $io Boolean: Specify whether we're beginning or ending
+        * @param bool $io Specify whether we're beginning or ending
         */
        private function debugFile( $fname, $io ) {
                if ( !$this->log ) {