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)
395395 */
396396 public function getDirectory ($ key )
397397 {
398+ if ($ key === count ($ this ->info ['path ' ])) {
399+ return $ this ->info ['file ' ];
400+ }
401+
398402 return isset ($ this ->info ['path ' ][$ key ]) ? $ this ->info ['path ' ][$ key ] : null ;
399403 }
400404
Original file line number Diff line number Diff line change @@ -99,4 +99,14 @@ public function testUrlParser()
9999 $ this ->assertEquals ($ expected_url , $ parsed_url ->getUrl ());
100100 }
101101 }
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+ }
102112}
You can’t perform that action at this time.
0 commit comments