1
0
Fork 0

Rename options to transport-options, refs #2189

pull/2604/head
Jordi Boggiano 2014-05-07 18:25:28 +02:00
parent 31092843fd
commit 32cd883daa
12 changed files with 27 additions and 31 deletions

View File

@ -118,7 +118,7 @@ class FileDownloader implements DownloaderInterface
$retries = 3;
while ($retries--) {
try {
$rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getOptions());
$rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
break;
} catch (TransportException $e) {
// if we got an http response with a proper code, then requesting again will probably not help, abort

View File

@ -49,7 +49,7 @@ abstract class BasePackage implements PackageInterface
protected $repository;
protected $id;
protected $options;
protected $transportOptions;
/**
* All descendants' constructors should call this parent constructor
@ -61,7 +61,7 @@ abstract class BasePackage implements PackageInterface
$this->prettyName = $name;
$this->name = strtolower($name);
$this->id = -1;
$this->options = array();
$this->transportOptions = array();
}
/**
@ -138,17 +138,19 @@ abstract class BasePackage implements PackageInterface
/**
* {@inheritDoc}
*/
public function getOptions()
public function getTransportOptions()
{
return $this->options;
return $this->transportOptions;
}
/**
* {@inheritDoc}
* Configures the list of options to download package dist files
*
* @param array $options
*/
public function setOptions(array $options)
public function setTransportOptions(array $options)
{
$this->options = $options;
$this->transportOptions = $options;
}
/**

View File

@ -108,8 +108,8 @@ class ArrayDumper
}
}
if (count($package->getOptions()) > 0) {
$data['options'] = $package->getOptions();
if (count($package->getTransportOptions()) > 0) {
$data['transport-options'] = $package->getTransportOptions();
}
return $data;

View File

@ -199,8 +199,8 @@ class ArrayLoader implements LoaderInterface
}
}
if ($this->loadOptions && isset($config['options'])) {
$package->setOptions($config['options']);
if ($this->loadOptions && isset($config['transport-options'])) {
$package->setTransportOptions($config['transport-options']);
}
return $package;

View File

@ -230,7 +230,7 @@ class ValidatingArrayLoader implements LoaderInterface
// TODO validate package repositories' packages using this recursively
$this->validateFlatArray('include-path');
$this->validateArray('options');
$this->validateArray('transport-options');
// branch alias validation
if (isset($this->config['extra']['branch-alias'])) {

View File

@ -314,17 +314,10 @@ interface PackageInterface
*/
public function getArchiveExcludes();
/**
* Configures the list of options to download package dist files
*
* @param array $options
*/
public function setOptions(array $options);
/**
* Returns a list of options to download package dist files
*
* @return array
*/
public function getOptions();
public function getTransportOptions();
}

View File

@ -219,7 +219,7 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
{
if ($package instanceof Package
&& strpos($package->getDistUrl(), $this->baseUrl) === 0) {
$package->setOptions($this->options);
$package->setTransportOptions($this->options);
}
}

View File

@ -90,7 +90,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue('http://example.com/script.js'))
;
$packageMock->expects($this->atLeastOnce())
->method('getOptions')
->method('getTransportOptions')
->will($this->returnValue(array()))
;
@ -166,7 +166,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue('http://example.com/script.js'))
;
$packageMock->expects($this->atLeastOnce())
->method('getOptions')
->method('getTransportOptions')
->will($this->returnValue(array()))
;
$packageMock->expects($this->any())

View File

@ -31,7 +31,7 @@ class ZipDownloaderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue('file://'.__FILE__))
;
$packageMock->expects($this->atLeastOnce())
->method('getOptions')
->method('getTransportOptions')
->will($this->returnValue(array()))
;

View File

@ -196,8 +196,9 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
),
array(
'options',
array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
'transport-options',
array('ssl' => array('local_cert' => '/opt/certs/test.pem')),
'transportOptions'
)
);
}

View File

@ -117,7 +117,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
'archive' => array(
'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'),
),
'options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
);
$package = $this->loader->load($config);

View File

@ -146,7 +146,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'bin/foo',
'bin/bar',
),
'options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
),
),
array( // test as array
@ -267,10 +267,10 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
array(
array(
'name' => 'foo/bar',
'options' => 'test',
'transport-options' => 'test',
),
array(
'options : should be an array, string given'
'transport-options : should be an array, string given'
)
),
);