Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing the support for old Zend conventions in AbstractTool.

  • Loading branch information...
commit 7e25caf381d5e85faf41472634d6f51f51474fe1 1 parent c8f3877
@zyxist zyxist authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/Opl/Autoloader/Toolset/AbstractTool.php
View
16 src/Opl/Autoloader/Toolset/AbstractTool.php
@@ -123,14 +123,22 @@ public function toFilename($className, $withNamespacePath = true)
{
$className = ltrim($className, $this->namespaceSeparator);
+ // PSR-0 conventions
foreach($this->namespaces as $namespace => $path)
{
if(0 === strpos($className, $namespace))
{
- $rest = strrchr($className, $this->namespaceSeparator);
- $replacement =
- str_replace($this->namespaceSeparator, '/', substr($className, 0, strlen($className) - strlen($rest))).
- str_replace(array('_', $this->namespaceSeparator), '/', $rest);
+ if(strpos($className, $this->namespaceSeparator) !== false)
+ {
+ $rest = strrchr($className, $this->namespaceSeparator);
+ $replacement =
+ str_replace($this->namespaceSeparator, '/', substr($className, 0, strlen($className) - strlen($rest))).
+ str_replace(array('_', $this->namespaceSeparator), '/', $rest);
+ }
+ else
+ {
+ $replacement = str_replace('_', '/', $className);
+ }
if(!$withNamespacePath)
{
return $replacement.$this->extensions[$namespace];
Please sign in to comment.
Something went wrong with that request. Please try again.