public function __construct($dir, $options = array())
{
$is_windows = defined('PHP_WINDOWS_VERSION_BUILD');
$options = array_merge(array('working_dir' => null, 'debug' => true, 'logger' => null, 'environment_variables' => $is_windows ? array('PATH' => getenv('path')) : array(), 'command' => 'git', 'process_timeout' => 3600), $options);
if (null !== $options['logger'] && !$options['logger'] instanceof LoggerInterface) {
throw new InvalidArgumentException(sprintf('Argument "logger" passed to Repository should be a Psr\\Log\\LoggerInterface. A %s was provided', is_object($options['logger']) ? get_class($options['logger']) : gettype($options['logger'])));
}
$this->logger = $options['logger'];
$this->initDir($dir, $options['working_dir']);
$this->objects = array();
$this->debug = (bool) $options['debug'];
$this->environmentVariables = $options['environment_variables'];
$this->processTimeout = $options['process_timeout'];
$this->command = $options['command'];
if (true === $this->debug && null !== $this->logger) {
$this->logger->debug(sprintf('Repository created (git dir: "%s", working dir: "%s")', $this->gitDir, $this->workingDir ?: 'none'));
}
}