Skip to content

Commit

Permalink
QA: Inline impl into segmentFor()
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Dec 22, 2024
1 parent 5330211 commit 858602e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/php/img/io/MetaDataReader.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ class MetaDataReader {
"\xfc" => 'JPG12', "\xfd" => 'JPG13', "\xfe" => 'COM',
];

protected $impl= [
'SOF0' => SOFNSegment::class, // image width and height
'APP1' => APP1Segment::class, // Exif, XMP
'APP13' => APP13Segment::class, // IPTC
'COM' => CommentSegment::class
];

/**
* Returns a segment
Expand All @@ -59,8 +53,15 @@ class MetaDataReader {
* @return img.io.Segment
*/
protected function segmentFor($marker, $data) {
static $impl= [
'SOF0' => SOFNSegment::class, // image width and height
'APP1' => APP1Segment::class, // Exif, XMP
'APP13' => APP13Segment::class, // IPTC
'COM' => CommentSegment::class
];

if ($seg= self::$seg[$marker] ?? null) {
if ($class= $this->impl[$seg] ?? null) {
if ($class= $impl[$seg] ?? null) {
return $class::read($seg, $data);
} else {
return new Segment($seg, $data);
Expand Down

0 comments on commit 858602e

Please sign in to comment.