From a5523902babb4f8cdb009c8e625c3127051efda4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 6 Jul 2012 22:28:01 +0200 Subject: [PATCH] simplified code --- lib/Application/Utils.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Application/Utils.php b/lib/Application/Utils.php index 1c2bab6..a2643ba 100644 --- a/lib/Application/Utils.php +++ b/lib/Application/Utils.php @@ -25,13 +25,12 @@ class Utils public function getBreadcrumbs($spec) { $paths = explode('/', $spec); - $last = ''; - foreach ($paths as $path) { - $dir['dir'] = $path; - $dir['path'] = "$last$path"; - $breadcrumbs[] = $dir; - $last .= $path . '/'; + foreach ($paths as $i => $path) { + $breadcrumbs[] = array( + 'dir' => $path, + 'path' => implode('/', array_slice($paths, 0, $i + 1)), + ); } return $breadcrumbs;