@@ -27,17 +27,17 @@ class Reader
27
27
{
28
28
const TYPE_NATIVE = 'native ' ;
29
29
const TYPE_EXIFTOOL = 'exiftool ' ;
30
-
30
+
31
31
/**
32
32
* The current adapter
33
33
*
34
34
* @var \PHPExif\Reader\AdapterInterface
35
35
*/
36
36
protected $ adapter ;
37
-
37
+
38
38
/**
39
39
* Reader constructor
40
- *
40
+ *
41
41
* @param \PHPExif\Reader\AdapterInterface $adapter
42
42
*/
43
43
public function __construct (AdapterInterface $ adapter = null )
@@ -46,23 +46,23 @@ public function __construct(AdapterInterface $adapter = null)
46
46
$ this ->setAdapter ($ adapter );
47
47
}
48
48
}
49
-
49
+
50
50
/**
51
51
* Setter for the reader adapter
52
- *
52
+ *
53
53
* @param \PHPExif\Reader\AdapterInterface $adapter
54
54
* @return \PHPExif\Reader Current instance for chaining
55
55
*/
56
56
public function setAdapter (AdapterInterface $ adapter )
57
57
{
58
58
$ this ->adapter = $ adapter ;
59
-
59
+
60
60
return $ this ;
61
61
}
62
-
62
+
63
63
/**
64
64
* Getter for the reader adapter
65
- *
65
+ *
66
66
* @return \PHPExif\Reader\AdapterInterface
67
67
* @throws NoAdapterException When no adapter is set
68
68
*/
@@ -71,36 +71,38 @@ public function getAdapter()
71
71
if (empty ($ this ->adapter )) {
72
72
throw new NoAdapterException ('No adapter set in the reader ' );
73
73
}
74
-
74
+
75
75
return $ this ->adapter ;
76
76
}
77
-
77
+
78
78
/**
79
79
* Factory for the reader
80
- *
80
+ *
81
81
* @param string $type
82
82
* @return \PHPExif\Reader
83
83
* @throws \InvalidArgumentException When given type is invalid
84
84
*/
85
85
public static function factory ($ type )
86
86
{
87
87
$ classname = get_called_class ();
88
-
88
+
89
+ $ adapter = null ;
89
90
switch ($ type ) {
90
91
case self ::TYPE_NATIVE :
91
92
$ adapter = new Reader \Adapter \Native ();
92
- return new $ classname ( $ adapter ) ;
93
+ break ;
93
94
case self ::TYPE_EXIFTOOL :
94
95
$ adapter = new Reader \Adapter \Exiftool ();
95
- return new $ classname ( $ adapter ) ;
96
+ break ;
96
97
default :
97
98
throw new \InvalidArgumentException (
98
99
sprintf ('Unknown type "%1$s" ' , $ type )
99
100
);
100
101
break ;
101
102
}
103
+ return new $ classname ($ adapter );
102
104
}
103
-
105
+
104
106
/**
105
107
* Reads & parses the EXIF data from given file
106
108
*
0 commit comments