浏览代码

[Bundle] Small optimization

Victor Berchet 14 年之前
父节点
当前提交
2a97f89897
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/Symfony/Component/HttpKernel/Bundle/Bundle.php

+ 3 - 2
src/Symfony/Component/HttpKernel/Bundle/Bundle.php

@@ -61,9 +61,10 @@ abstract class Bundle extends ContainerAware implements BundleInterface
             return $this->name;
         }
 
-        $pos = strrpos(get_class($this), '\\');
+        $name = get_class($this);
+        $pos = strrpos($name, '\\');
 
-        return $this->name = substr(get_class($this), $pos ? $pos + 1 : 0);
+        return $this->name = false === $pos ? $name :  substr($name, $pos + 1);
     }
 
     /**