Skip to content

Commit

Permalink
CS: Convert double quotes to single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Mar 21, 2015
1 parent eb335a7 commit 1125498
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public function __toString()
$str = urlencode($this->getName()).'=';

if ('' === (string) $this->getValue()) {
$str .= 'deleted; expires='.gmdate("D, d-M-Y H:i:s T", time() - 31536001);
$str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001);
} else {
$str .= urlencode($this->getValue());

if ($this->getExpiresTime() !== 0) {
$str .= '; expires='.gmdate("D, d-M-Y H:i:s T", $this->getExpiresTime());
$str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime());
}
}

Expand Down
4 changes: 2 additions & 2 deletions IpUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public static function checkIp6($requestIp, $ip)
$netmask = 128;
}

$bytesAddr = unpack("n*", inet_pton($address));
$bytesTest = unpack("n*", inet_pton($requestIp));
$bytesAddr = unpack('n*', inet_pton($address));
$bytesTest = unpack('n*', inet_pton($requestIp));

for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
$left = $netmask - 16 * ($i-1);
Expand Down
2 changes: 1 addition & 1 deletion Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ public function isEmpty()
protected function ensureIEOverSSLCompatibility(Request $request)
{
if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) {
if ((int) preg_replace("/(MSIE )(.*?);/", "$2", $match[0]) < 9) {
if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) {
$this->headers->remove('Cache-Control');
}
}
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/MockArraySessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function setName($name)
public function save()
{
if (!$this->started || $this->closed) {
throw new \RuntimeException("Trying to save a session that was not started yet or was already closed");
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
}
// nothing to do since we don't persist the session data
$this->closed = false;
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/MockFileSessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function regenerate($destroy = false, $lifetime = null)
public function save()
{
if (!$this->started) {
throw new \RuntimeException("Trying to save a session that was not started yet or was already closed");
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
}

file_put_contents($this->getFilePath(), serialize($this->data));
Expand Down
10 changes: 5 additions & 5 deletions Tests/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public function invalidNames()
{
return array(
array(''),
array(",MyName"),
array(";MyName"),
array(" MyName"),
array(',MyName'),
array(';MyName'),
array(' MyName'),
array("\tMyName"),
array("\rMyName"),
array("\nMyName"),
Expand Down Expand Up @@ -89,7 +89,7 @@ public function testConstructorWithDateTime()

public function testGetExpiresTimeWithStringValue()
{
$value = "+1 day";
$value = '+1 day';
$cookie = new Cookie('foo', 'bar', $value);
$expire = strtotime($value);

Expand Down Expand Up @@ -137,7 +137,7 @@ public function testToString()
$this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly', $cookie->__toString(), '->__toString() returns string representation of the cookie');

$cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
$this->assertEquals('foo=deleted; expires='.gmdate("D, d-M-Y H:i:s T", time()-31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');
$this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time()-31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');

$cookie = new Cookie('foo', 'bar', 0, '/', '');
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());
Expand Down
2 changes: 1 addition & 1 deletion Tests/HeaderBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testKeys()
{
$bag = new HeaderBag(array('foo' => 'bar'));
$keys = $bag->keys();
$this->assertEquals("foo", $keys[0]);
$this->assertEquals('foo', $keys[0]);
}

public function testGetDate()
Expand Down
2 changes: 1 addition & 1 deletion Tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ public function testGetContentReturnsResource()
$req = new Request();
$retval = $req->getContent(true);
$this->assertInternalType('resource', $retval);
$this->assertEquals("", fread($retval, 1));
$this->assertEquals('', fread($retval, 1));
$this->assertTrue(feof($retval));
}

Expand Down
12 changes: 6 additions & 6 deletions Tests/ResponseHeaderBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ public function testToStringIncludesCookieHeaders()
$bag = new ResponseHeaderBag(array());
$bag->setCookie(new Cookie('foo', 'bar'));

$this->assertContains("Set-Cookie: foo=bar; path=/; httponly", explode("\r\n", $bag->__toString()));
$this->assertContains('Set-Cookie: foo=bar; path=/; httponly', explode("\r\n", $bag->__toString()));

$bag->clearCookie('foo');

$this->assertContains("Set-Cookie: foo=deleted; expires=".gmdate("D, d-M-Y H:i:s T", time() - 31536001)."; path=/; httponly", explode("\r\n", $bag->__toString()));
$this->assertContains('Set-Cookie: foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; path=/; httponly', explode("\r\n", $bag->__toString()));
}

public function testReplace()
Expand Down Expand Up @@ -155,10 +155,10 @@ public function testCookiesWithSameNames()
$this->assertCount(4, $bag->getCookies());

$headers = explode("\r\n", $bag->__toString());
$this->assertContains("Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly", $headers);
$this->assertContains("Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly", $headers);
$this->assertContains("Set-Cookie: foo=bar; path=/path/bar; domain=bar.foo; httponly", $headers);
$this->assertContains("Set-Cookie: foo=bar; path=/; httponly", $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly', $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly', $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/path/bar; domain=bar.foo; httponly', $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/; httponly', $headers);

$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
$this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo']));
Expand Down
6 changes: 3 additions & 3 deletions Tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function testToString()
{
$response = new Response();
$response = explode("\r\n", $response);
$this->assertEquals("HTTP/1.0 200 OK", $response[0]);
$this->assertEquals("Cache-Control: no-cache", $response[1]);
$this->assertEquals('HTTP/1.0 200 OK', $response[0]);
$this->assertEquals('Cache-Control: no-cache', $response[1]);
}

public function testClone()
Expand Down Expand Up @@ -497,7 +497,7 @@ public function testSetCache()
$response = new Response();
//array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public')
try {
$response->setCache(array("wrong option" => "value"));
$response->setCache(array('wrong option' => 'value'));
$this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported');
Expand Down

0 comments on commit 1125498

Please sign in to comment.