GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#4)
by Tom Van
03:17
created

MapperFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 50
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMapper() 0 11 1
B getExifMapper() 0 24 2
1
<?php
2
/**
3
 * Factory for wiring all the different mappers
4
 *
5
 * @link        http://github.com/PHPExif/php-exif-native for the canonical source repository
6
 * @copyright   Copyright (c) 2016 Tom Van Herreweghe <[email protected]>
7
 * @license     http://github.com/PHPExif/php-exif-native/blob/master/LICENSE MIT License
8
 * @category    PHPExif
9
 * @package     Native
10
 */
11
12
namespace PHPExif\Adapter\Native\Reader;
13
14
use PHPExif\Adapter\Native\Reader\Mapper\ExifMapper;
15
16
/**
17
 * MapperFactory
18
 *
19
 * Registers all available mappers
20
 *
21
 * @category    PHPExif
22
 * @package     Native
23
 */
24
class MapperFactory
25
{
26
    /**
27
     * Returns a Mapper instance complete with all sub-mappers
28
     * registered
29
     *
30
     * @return Mapper
31
     */
32
    public static function getMapper()
33
    {
34
        $exifMapper = self::getExifMapper();
35
36
        $mapper = new Mapper();
37
        $mapper->registerFieldMapper(
38
            $exifMapper
39
        );
40
41
        return $mapper;
42
    }
43
44
    /**
45
     * Returns the mapper for Exif data
46
     *
47
     * @return ExifMapper
48
     */
49
    private static function getExifMapper()
50
    {
51
        $exifMapper = new ExifMapper();
52
53
        // find all classes
54
        $reflClass = new \ReflectionClass(ExifMapper::class);
55
        $namespace = $reflClass->getNamespaceName();
56
        $namespace .= '\\Exif';
57
58
        $path = realpath(__DIR__ . '/Mapper/Exif');
59
60
        foreach (glob($path . '/*Mapper.php') as $classPath) {
61
            $className = str_replace('.php', '', array_reverse(
62
                explode(DIRECTORY_SEPARATOR, $classPath)
63
            )[0]);
64
            $fqcn = $namespace . '\\' . $className;
65
66
            $fieldMapper = new $fqcn();
67
68
            $exifMapper->registerFieldMapper($fieldMapper);
69
        }
70
71
        return $exifMapper;
72
    }
73
}
74