protected function createProjectConfiguration(stdClass $config = null)
    {
        if (null === $config) {
            return new ProjectConfiguration(
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                $this->defaultCacheDir()
            );
        }

        $configData = new ObjectAccess($config);

        $cacheDir = $configData->getDefault('cache-dir');
        if (null === $cacheDir) {
            $cacheDir = $this->defaultCacheDir();
        }

        return new ProjectConfiguration(
            $configData->getDefault('process-timeout'),
            $configData->getDefault('use-include-path'),
            $this->createInstallationMethod(
                $configData->getDefault('preferred-install')
            ),
            $configData->getDefault('github-protocols'),
            $this->objectToArray($configData->getDefault('github-oauth')),
            $configData->getDefault('vendor-dir'),
            $configData->getDefault('bin-dir'),
            $cacheDir,
            $configData->getDefault('cache-files-dir'),
            $configData->getDefault('cache-repo-dir'),
            $configData->getDefault('cache-vcs-dir'),
            $configData->getDefault('cache-files-ttl'),
            $configData->getDefault('cache-files-maxsize'),
            $configData->getDefault('prepend-autoloader'),
            $configData->getDefault('autoloader-suffix'),
            $configData->getDefault('optimize-autoloader'),
            $configData->getDefault('github-domains'),
            $configData->getDefault('notify-on-install'),
            $this->createVcsChangePolicy(
                $configData->getDefault('discard-changes')
            ),
            $configData->data()
        );
    }