Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
esokullu authored Apr 12, 2018
1 parent e6c493c commit 92a4d89
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/Pho/Framework/Loaders/OutgoingEdgeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,22 @@ public static function pack(Framework\ParticleInterface $particle): AbstractLoad
else
$pattern .= $_pattern;
}
$formation_patterns[$formable] = substr(str_replace("\\", ":", $pattern),0 ,-3);
$pattern = str_replace("\\", ":", $pattern);
if($pattern[strlen($pattern)-1]!="?") {
$pattern = substr($pattern, 0 ,-3);
}
elseif($pattern[0]!="(") {
// if the last char is optional
// like: string:::string:::string?
// instead of string:::string:::(string:::)?
// which would be trimmed as string:::string:::(string::
// show: string:::string(:::string?)
$pattern = substr($pattern, sprintf(":::(%s)?", $_pattern), sprintf("(:::%s)?", substr($_pattern, 0, -3)));
}
else { // case of (string:::)?
$pattern = substr($pattern, ":::)?", ")?");
}
$formation_patterns[$formable] = $pattern;
}
$cargo->formative_patterns[$_method] = $formation_patterns;
}
Expand Down Expand Up @@ -147,4 +162,4 @@ protected static function getFormativeTrim(Framework\ParticleInterface $particle
return $trim;
}

}
}

0 comments on commit 92a4d89

Please sign in to comment.