Skip to content

Commit

Permalink
Update code using new php 8.0 features
Browse files Browse the repository at this point in the history
  • Loading branch information
diderich committed Aug 24, 2022
1 parent 4f623e5 commit a8928bd
Show file tree
Hide file tree
Showing 11 changed files with 622 additions and 742 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
@@ -1,10 +1,13 @@
# CHANGELOG.md

Current version: `v1.1.1`
Current version: `v1.2.0`

Notable changes to **Metadata** - A PHP class for reading and writing *Photo Metadata* from JPEG files in a transparent
way:

## v1.2.0 - 2022-08-03
Updated code to use new features of php 8.0 and make it more consistent with coding recommendations.

## v1.1.1 - 2022-07-29
Corrected bug decoding XMP data. Added display of image data (i.e., EXIF data) to the test example.

Expand Down
3 changes: 2 additions & 1 deletion SECURITY.md
Expand Up @@ -5,7 +5,8 @@ See `README.md` for more details.

| Version | Supported |
| ------- | ------------------ |
| 1.1.x | :white_check_mark: |
| 1.2.0 | :white_check_mark: |
| 1.1.x | :x: |

# Reporting a Vulnerability

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Expand Up @@ -19,7 +19,10 @@
},
"require": {
"php": ">=8.0",
"ext-date": "*",
"ext-dom": "*",
"ext-xml": "*"
"ext-gd": "*",
"ext-gettext": "*",
"ext-mbstring": "*",
}
}
552 changes: 255 additions & 297 deletions src/Metadata.php

Large diffs are not rendered by default.

35 changes: 16 additions & 19 deletions src/Metadata/Exception.php
Expand Up @@ -3,7 +3,7 @@
* Exception.php - Metadata error handling
*
* @package Holiday\Metadata
* @version 1.1
* @version 1.2
* @author Claude Diderich (cdiderich@cdsp.photo)
* @copyright (c) 2022 by Claude Diderich
* @license https://opensource.org/licenses/mit MIT
Expand All @@ -15,26 +15,23 @@
class Exception extends \Exception {

/** Error costants */
const INTERNAL_ERROR = 0;
const NOT_IMPLEMENTED = 1;
public const INTERNAL_ERROR = 0;
public const NOT_IMPLEMENTED = 1;

/** - File specific errors */
const FILE_ERROR = 10;
const FILE_NOT_FOUND = 11;
const FILE_TYPE_ERROR = 12;
const FILE_CORRUPT = 13;
const FILE_COPY_ERROR = 14;
public const FILE_ERROR = 10;
public const FILE_NOT_FOUND = 11;
public const FILE_TYPE_ERROR = 12;
public const FILE_CORRUPT = 13;
public const FILE_COPY_ERROR = 14;

/** - Data specitic errors */
const DATA_NOT_FOUND = 21;
const DATA_FORMAT_ERROR = 22;
const INVALID_FIELD_ID = 23;
const INVALID_FIELD_WRITE = 24;
const INVALID_FIELD_DATA = 25;
const INVALID_LANG = 26;

/** Internal variables */
protected mixed $data;
public const DATA_NOT_FOUND = 21;
public const DATA_FORMAT_ERROR = 22;
public const INVALID_FIELD_ID = 23;
public const INVALID_FIELD_WRITE = 24;
public const INVALID_FIELD_DATA = 25;
public const INVALID_LANG = 26;

/**
* Constructor
Expand All @@ -44,9 +41,9 @@ class Exception extends \Exception {
* @param mixed $data Exception specific data
* @param \Throwable $previous Previously thrown exception
*/
public function __construct(string $message = '', int $code = 0, mixed $data = null, ?\Throwable $previous = null)
public function __construct(string $message = '', int $code = 0, protected mixed $data = null,
?\Throwable $previous = null)
{
$this->data = $data;
parent::__construct($message, $code, $previous);
}

Expand Down

0 comments on commit a8928bd

Please sign in to comment.