Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/psr-2_compliance' of git://github.com/RWOverdijk…
Browse files Browse the repository at this point in the history
…/zf2 into RWOverdijk-hotfix/psr-2_compliance
  • Loading branch information
Ralph Schindler committed Aug 13, 2012
2 parents a1bfde3 + 736aba7 commit f329014
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ protected function calcAuthDigest($user, $password, $type = self::AUTH_BASIC, $d
throw new Exception\InvalidArgumentException("Invalid or not supported authentication type: '$type'");
}
$response = false;
switch(strtolower($type)) {
switch (strtolower($type)) {
case self::AUTH_BASIC :
// In basic authentication, the user name cannot contain ":"
if (strpos($user, ':') !== false) {
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function setOptions($options = array())

foreach ($options as $k => $v) {
$option = strtolower($k);
switch($option) {
switch ($option) {
case 'proxyhost':
$this->setCurlOption(CURLOPT_PROXY, $v);
break;
Expand Down
6 changes: 3 additions & 3 deletions src/PhpEnvironment/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getContent()
{
if (empty($this->content)) {
$requestBody = file_get_contents('php://input');
if (strlen($requestBody) > 0){
if (strlen($requestBody) > 0) {
$this->content = $requestBody;
}
}
Expand Down Expand Up @@ -307,7 +307,7 @@ public function getServer($name = null, $default = null)
$this->serverParams = new Parameters();
}

if($name === null){
if ($name === null) {
return $this->serverParams;
}

Expand Down Expand Up @@ -340,7 +340,7 @@ public function getEnv($name = null, $default = null)
$this->envParams = new Parameters();
}

if($name === null){
if ($name === null) {
return $this->envParams;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function getQuery($name = null, $default = null)
$this->queryParams = new Parameters();
}

if($name === null){
if ($name === null) {
return $this->queryParams;
}

Expand Down Expand Up @@ -270,7 +270,7 @@ public function getPost($name = null, $default = null)
$this->postParams = new Parameters();
}

if($name === null){
if ($name === null) {
return $this->postParams;
}

Expand Down Expand Up @@ -314,7 +314,7 @@ public function getFiles($name = null, $default = null)
$this->fileParams = new Parameters();
}

if($name === null){
if ($name === null) {
return $this->fileParams;
}

Expand All @@ -336,11 +336,11 @@ public function getHeaders($name = null, $default = false)
$this->headers = (is_string($this->headers)) ? Headers::fromString($this->headers) : new Headers();
}

if($name === null){
if ($name === null) {
return $this->headers;
}

if($this->headers->has($name)){
if ($this->headers->has($name)) {
return $this->headers->get($name);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Response/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static function fromStream($responseString, $stream)
}

$headers = $response->getHeaders();
foreach($headers as $header) {
foreach ($headers as $header) {
if ($header instanceof \Zend\Http\Header\ContentLength) {
$response->contentLength = (int) $header->getFieldValue();
if (strlen($response->content) > $response->contentLength) {
Expand Down
10 changes: 5 additions & 5 deletions test/Client/CommonHttpTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public function testMutipleFilesWithSameFormNameZF5744()
$files = array('file1.txt', 'file2.txt', 'someotherfile.foo');

$expectedBody = '';
foreach($files as $filename) {
foreach ($files as $filename) {
$this->client->setFileUpload($filename, 'uploadfile[]', $rawData, 'text/plain');
$expectedBody .= "uploadfile $filename text/plain " . strlen($rawData) . "\n";
}
Expand Down Expand Up @@ -844,7 +844,7 @@ public function testZF4238FalseLinesInResponse()

public function testStreamResponse()
{
if(!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
if (!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
$this->markTestSkipped('Current adapter does not support streaming');
return;
}
Expand All @@ -871,7 +871,7 @@ public function testStreamResponseBody()
{
$this->markTestSkipped('To check with the new ZF2 implementation');

if(!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
if (!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
$this->markTestSkipped('Current adapter does not support streaming');
return;
}
Expand All @@ -891,7 +891,7 @@ public function testStreamResponseBody()

public function testStreamResponseNamed()
{
if(!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
if (!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
$this->markTestSkipped('Current adapter does not support streaming');
return;
}
Expand All @@ -917,7 +917,7 @@ public function testStreamResponseNamed()

public function testStreamRequest()
{
if(!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
if (!($this->client->getAdapter() instanceof Adapter\StreamInterface)) {
$this->markTestSkipped('Current adapter does not support streaming');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/Client/CurlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testConfigSetAsArray()
$this->_adapter->setOptions($config);

$hasConfig = $this->_adapter->getConfig();
foreach($config as $k => $v) {
foreach ($config as $k => $v) {
$this->assertEquals($v, $hasConfig[$k]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/Client/SocketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testConfigSetAsArray()
$this->_adapter->setOptions($config);

$hasConfig = $this->_adapter->getConfig();
foreach($config as $k => $v) {
foreach ($config as $k => $v) {
$this->assertEquals($v, $hasConfig[$k]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/Client/StaticTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function testConfigSetAsArray()

$hasConfig = $this->_client->config;

foreach($config as $k => $v) {
foreach ($config as $k => $v) {
$this->assertEquals($v, $hasConfig[$k]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/Client/_files/testRedirections.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Http
*/

if (! isset($_GET['redirection'])){
if (! isset($_GET['redirection'])) {
$_GET['redirection'] = 0;

/**
Expand Down
2 changes: 1 addition & 1 deletion test/Client/_files/testUploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if (! empty($_FILES)) {
foreach ($_FILES as $name => $file) {
if (is_array($file['name'])) {
foreach($file['name'] as $k => $v) {
foreach ($file['name'] as $k => $v) {
echo "$name $v {$file['type'][$k]} {$file['size'][$k]}\n";
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion test/Header/AcceptCharsetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testPrioritizesValuesBasedOnQParameter()
);

$test = array();
foreach($header->getPrioritized() as $type) {
foreach ($header->getPrioritized() as $type) {
$this->assertEquals(array_shift($expected), $type->getCharset());
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/Header/AcceptEncodingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testPrioritizesValuesBasedOnQParameter()
);

$test = array();
foreach($header->getPrioritized() as $type) {
foreach ($header->getPrioritized() as $type) {
$this->assertEquals(array_shift($expected), $type->getEncoding());
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/Header/AcceptLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testPrioritizesValuesBasedOnQParameter()
);

$test = array();
foreach($header->getPrioritized() as $type) {
foreach ($header->getPrioritized() as $type) {
$this->assertEquals(array_shift($expected), $type->typeString);
}
$this->assertEquals($expected, $test);
Expand Down
4 changes: 2 additions & 2 deletions test/Header/AcceptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testPrioritizesValuesBasedOnQParameter()
);

$test = array();
foreach($header->getPrioritized() as $type) {
foreach ($header->getPrioritized() as $type) {
$this->assertEquals(array_shift($expected), $type->typeString);
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ public function testPrioritizedLevel()
);

$test = array();
foreach($header->getPrioritized() as $type) {
foreach ($header->getPrioritized() as $type) {
$this->assertEquals(array_shift($expected), $type->raw);
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/Response/ResponseStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function testGzipResponse ()
$stream = fopen(__DIR__ . '/../_files/response_gzip','rb');

$headers = '';
while(false!== ($newLine = fgets($stream))) {
while (false!== ($newLine = fgets($stream))) {
$headers .= $newLine;
if($headers == "\n" || $headers == "\r\n") {
if ($headers == "\n" || $headers == "\r\n") {
break;
}
}
Expand Down Expand Up @@ -93,9 +93,9 @@ protected function readResponse($response)
$stream = fopen(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . $response, 'rb');

$data = '';
while(false!== ($newLine = fgets($stream))) {
while (false!== ($newLine = fgets($stream))) {
$data .= $newLine;
if($newLine == "\n" || $newLine == "\r\n") {
if ($newLine == "\n" || $newLine == "\r\n") {
break;
}
}
Expand Down

0 comments on commit f329014

Please sign in to comment.