function getRepositories() {
foreach ($this->_parentPaths as $parentPath) {
$parentRepos = $parentPath->getRepositories();}}
有段正确的代码
parentpath 明明是一个变量 怎么有了函数功能了?
$parentPath->getRepositories()到底返回了什么?
完整函数如下
function getRepositories() {
// lazily load parent paths
if ($this->_parentPathsLoaded) return $this->_repositories;
$this->_parentPathsLoaded = true;
foreach ($this->_parentPaths as $parentPath) {
$parentRepos = $parentPath->getRepositories();
foreach ($parentRepos as $repo) {
if (!$parentPath->getSkipAlreadyAdded()) {
$this->_repositories[] = $repo;
} else {
// we have to check if we already have a repo with the same svn name
$duplicate = false;
foreach ($this->_repositories as $knownRepos) {
if ($knownRepos->path == $repo->path && $knownRepos->subpath == $repo->subpath) {
$duplicate = true;
break;
}
}
if (!$duplicate && !in_array($repo->path, $this->_excluded, true)) {
$this->_repositories[] = $repo;
}
}
}
}
return $this->_repositories;
}
“ = ” 是赋值的意思 ,把 = 右边的值赋给左边的变量
“ -> ”我就不知道了
“ > ” 也是赋值类的
我不大懂PHP语言,但和JS C++等都类似
系统地学把,运算符都没懂就看这长条函数
W3Cschool-
返回_repositories这个方法的结果本回答被提问者采纳