2012-01-10 14:44:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of Composer.
|
|
|
|
*
|
|
|
|
* (c) Nils Adermann <naderman@naderman.de>
|
|
|
|
* Jordi Boggiano <j.boggiano@seld.be>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Composer\Repository\Vcs;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A driver implementation
|
|
|
|
*
|
|
|
|
* @author François Pluchino <francois.pluchino@opendisplay.com>
|
|
|
|
*/
|
2012-01-10 17:50:16 +00:00
|
|
|
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
|
2012-01-10 14:44:13 +00:00
|
|
|
abstract class VcsDriver
|
|
|
|
{
|
|
|
|
protected $url;
|
2012-01-10 17:50:16 +00:00
|
|
|
protected $input;
|
|
|
|
protected $output;
|
2012-01-10 14:44:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
2012-01-10 17:50:16 +00:00
|
|
|
* @param string $url The URL
|
|
|
|
* @param InputInterface $input The Input instance
|
|
|
|
* @param OutputInterface $output The output instance
|
2012-01-10 14:44:13 +00:00
|
|
|
*/
|
2012-01-10 17:50:16 +00:00
|
|
|
public function __construct($url, InputInterface $input, OutputInterface $output)
|
2012-01-10 14:44:13 +00:00
|
|
|
{
|
|
|
|
$this->url = $url;
|
2012-01-10 17:50:16 +00:00
|
|
|
$this->input = $input;
|
|
|
|
$this->output = $output;
|
2012-01-10 14:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the https or http protocol.
|
|
|
|
*
|
|
|
|
* @return string The correct type of protocol
|
|
|
|
*/
|
2012-01-11 00:11:56 +00:00
|
|
|
protected function getScheme()
|
2012-01-10 14:44:13 +00:00
|
|
|
{
|
|
|
|
if (extension_loaded('openssl')) {
|
|
|
|
return 'https';
|
|
|
|
}
|
|
|
|
return 'http';
|
|
|
|
}
|
|
|
|
}
|