File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+
4
+ namespace doganoo \PHPUtil \Exception ;
5
+
6
+
7
+ class InvalidPropertyStructureException extends \Exception {
8
+
9
+ }
Original file line number Diff line number Diff line change 26
26
namespace doganoo \PHPUtil \System ;
27
27
28
28
use doganoo \PHPUtil \Exception \FileNotFoundException ;
29
+ use doganoo \PHPUtil \Exception \InvalidPropertyStructureException ;
29
30
use doganoo \PHPUtil \Exception \NoPathException ;
30
31
31
32
/**
@@ -66,6 +67,7 @@ public function read(string $index): string {
66
67
* @return array
67
68
* @throws FileNotFoundException
68
69
* @throws NoPathException
70
+ * @throws InvalidPropertyStructureException
69
71
*/
70
72
private function getProperties (): array {
71
73
if (self ::$ path === null ) {
@@ -74,8 +76,10 @@ private function getProperties(): array {
74
76
if (!\is_file (self ::$ path )) {
75
77
throw new FileNotFoundException ();
76
78
}
77
- $ result = parse_ini_file (self ::$ path );
78
-
79
- return $ result ;
79
+ $ ini = parse_ini_file (self ::$ path );
80
+ if (false === $ ini ) {
81
+ throw new InvalidPropertyStructureException ();
82
+ }
83
+ return $ ini ;
80
84
}
81
85
}
You can’t perform that action at this time.
0 commit comments