/** * Retrieve file object by relative file path * * @param string $filePath Relative file path * * @return File */ public function getFileByPath($filePath) { $normalizePath = ltrim($filePath, DIRECTORY_SEPARATOR); foreach ($this->getChangedFilesInternal() as $filePath => $status) { if ($normalizePath == $filePath) { return new File($this->repository->getProjectPath() . DIRECTORY_SEPARATOR . $filePath, $this->repository, $status); } } return null; }
/** * Return path name without repository path * * @return string */ public function getPathname() { return ltrim(mb_substr($this->path, mb_strlen($this->repository->getProjectPath())), DIRECTORY_SEPARATOR); }