本文整理汇总了PHP中Path::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::toString方法的具体用法?PHP Path::toString怎么用?PHP Path::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: continuePath
function continuePath($path, $destination, $lineName)
{
$debug = true;
outputDebug("algorithm.continuePath()", $debug);
$currentStation = $path->getCurrentStation();
$currentLine = $currentStation->getLine($lineName);
$connections = $currentLine->getConnections();
if ($debug) {
echo "currentStation = " . $currentStation->getName() . " (" . $currentStation->getID() . ")<br/>\n";
echo "currentLine = " . $currentLine->name . "<br/>\n";
echo "continuePath() :: found " . count($connections) . " connections.<br/>\n";
}
$newPaths = array();
foreach ($connections as $connection) {
if ($connection->id == $path->getLastStation()->getID()) {
continue;
}
// create a new segment from the connection
outputDebug("connection->id = " . $connection->id, $debug);
$nextStation = retrieveStation($connection->id);
$visited = isVisited($nextStation, $path->visited);
if ($visited) {
if (count($connections) == 1) {
// end of the line. no match.
outputDebug("end of line.", $debug);
$newPaths[] = new MetaPath("EOL", $path);
return $newPaths;
} else {
// we only care to go in the forward direction
outputDebug("continuePath() :: already visited.", $debug);
continue;
}
}
$lines = $currentStation->getOverlapLines($nextStation);
$newPath = new Path($path, $nextStation, $currentLine, $connection);
$pathDestination = $path->getDestination();
if ($destination instanceof Station2 && $nextStation->getID() == $destination->getID()) {
outputDebug("found match, creating completed path", $debug);
$newPaths[] = new MetaPath("match", $newPath);
continue;
}
if ($pathDestination instanceof Station2 && $nextStation->getID() == $pathDestination->getID()) {
outputDebug("found path destination, creating completed path", $debug);
$newPaths[] = new MetaPath("found", $newPath);
continue;
}
outputDebug("adding path to list = " . $newPath->toString(), $debug);
$newPaths[] = new MetaPath("continue", $newPath);
}
outputDebug("algorithm.continuePath() : DONE", $debug);
return $newPaths;
}
示例2: testCreateFromParts
public function testCreateFromParts()
{
$parts = ['foo', 'bar/baz', 'taz'];
$phlibPath = new Path($parts);
$this->assertEquals('foo/bar\\/baz/taz', $phlibPath->toString());
}