Gitonomy\Git\Repository::initDir PHP Method

initDir() private method

Initializes directory attributes on repository:.
private initDir ( string $gitDir, string $workingDir = null )
$gitDir string directory of a working copy with files checked out
$workingDir string directory containing git files (objects, config...)
    private function initDir($gitDir, $workingDir = null)
    {
        $realGitDir = realpath($gitDir);
        if (false === $realGitDir) {
            throw new InvalidArgumentException(sprintf('Directory "%s" does not exist or is not a directory', $gitDir));
        } else {
            if (!is_dir($realGitDir)) {
                throw new InvalidArgumentException(sprintf('Directory "%s" does not exist or is not a directory', $realGitDir));
            } elseif (null === $workingDir && is_dir($realGitDir . '/.git')) {
                $workingDir = $realGitDir;
                $realGitDir = $realGitDir . '/.git';
            }
        }
        $this->gitDir = $realGitDir;
        $this->workingDir = $workingDir;
    }