File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -395,6 +395,10 @@ public function getDomain($first_level = false)
395
395
*/
396
396
public function getDirectory ($ key )
397
397
{
398
+ if ($ key === count ($ this ->info ['path ' ])) {
399
+ return $ this ->info ['file ' ];
400
+ }
401
+
398
402
return isset ($ this ->info ['path ' ][$ key ]) ? $ this ->info ['path ' ][$ key ] : null ;
399
403
}
400
404
Original file line number Diff line number Diff line change @@ -99,4 +99,14 @@ public function testUrlParser()
99
99
$ this ->assertEquals ($ expected_url , $ parsed_url ->getUrl ());
100
100
}
101
101
}
102
+
103
+ public function testUrlDirectory ()
104
+ {
105
+ $ url = new Embed \Url ('http://domain.com/first//second/third ' );
106
+
107
+ $ this ->assertEquals ('first ' , $ url ->getDirectory (0 ));
108
+ $ this ->assertEquals ('second ' , $ url ->getDirectory (1 ));
109
+ $ this ->assertEquals ('third ' , $ url ->getDirectory (2 ));
110
+ $ this ->assertNull ($ url ->getDirectory (3 ));
111
+ }
102
112
}
You can’t perform that action at this time.
0 commit comments