Passed
Pull Request — master (#64)
by
unknown
03:05
created
Lib/Vendor/Httpful/Httpful.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 class Httpful {
6 6
     const VERSION = '0.2.18';
7 7
 
8
-    private static $mimeRegistrar = array();
8
+    private static $mimeRegistrar = array ();
9 9
     private static $default = null;
10 10
 
11 11
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
      * @param string $mime_type
13 13
      * @param MimeHandlerAdapter $handler
14 14
      */
15
-    public static function register($mimeType, \Httpful\Handlers\MimeHandlerAdapter $handler)
16
-    {
15
+    public static function register($mimeType, \Httpful\Handlers\MimeHandlerAdapter $handler) {
17 16
         self::$mimeRegistrar[$mimeType] = $handler;
18 17
     }
19 18
 
@@ -21,8 +20,7 @@  discard block
 block discarded – undo
21 20
      * @param string $mime_type defaults to MimeHandlerAdapter
22 21
      * @return MimeHandlerAdapter
23 22
      */
24
-    public static function get($mimeType = null)
25
-    {
23
+    public static function get($mimeType = null) {
26 24
         if (isset(self::$mimeRegistrar[$mimeType])) {
27 25
             return self::$mimeRegistrar[$mimeType];
28 26
         }
@@ -39,8 +37,7 @@  discard block
 block discarded – undo
39 37
      * for it?
40 38
      * @return bool
41 39
      */
42
-    public static function hasParserRegistered($mimeType)
43
-    {
40
+    public static function hasParserRegistered($mimeType) {
44 41
         return isset(self::$mimeRegistrar[$mimeType]);
45 42
     }
46 43
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
     const VERSION = '0.2.18';
7 7
 
8 8
     private static $mimeRegistrar = array();
9
-    private static $default = null;
9
+    private static $default = NULL;
10 10
 
11 11
     /**
12 12
      * @param string $mime_type
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      * @param string $mime_type defaults to MimeHandlerAdapter
22 22
      * @return MimeHandlerAdapter
23 23
      */
24
-    public static function get($mimeType = null)
24
+    public static function get($mimeType = NULL)
25 25
     {
26 26
         if (isset(self::$mimeRegistrar[$mimeType])) {
27 27
             return self::$mimeRegistrar[$mimeType];
Please login to merge, or discard this patch.
Lib/Vendor/Httpful/Bootstrap.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public static function init()
23 23
     {
24
-        spl_autoload_register(array('\Httpful\Bootstrap', 'autoload'));
24
+        spl_autoload_register(array ('\Httpful\Bootstrap', 'autoload'));
25 25
         self::registerHandlers();
26 26
     }
27 27
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public static function pharInit()
42 42
     {
43
-        spl_autoload_register(array('\Httpful\Bootstrap', 'pharAutoload'));
43
+        spl_autoload_register(array ('\Httpful\Bootstrap', 'pharAutoload'));
44 44
         self::registerHandlers();
45 45
     }
46 46
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         // @todo check a conf file to load from that instead of
80 80
         // hardcoding into the library?
81
-        $handlers = array(
81
+        $handlers = array (
82 82
             \Httpful\Mime::JSON => new \Httpful\Handlers\JsonHandler(),
83 83
             \Httpful\Mime::XML  => new \Httpful\Handlers\XmlHandler(),
84 84
             \Httpful\Mime::FORM => new \Httpful\Handlers\FormHandler(),
Please login to merge, or discard this patch.
Braces   +10 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
8 8
  *
9 9
  * @author Nate Good <[email protected]>
10 10
  */
11
-class Bootstrap
12
-{
11
+class Bootstrap {
13 12
 
14 13
     const DIR_GLUE = DIRECTORY_SEPARATOR;
15 14
     const NS_GLUE = '\\';
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
     /**
20 19
      * Register the autoloader and any other setup needed
21 20
      */
22
-    public static function init()
23
-    {
21
+    public static function init() {
24 22
         spl_autoload_register(array('\Httpful\Bootstrap', 'autoload'));
25 23
         self::registerHandlers();
26 24
     }
@@ -30,16 +28,14 @@  discard block
 block discarded – undo
30 28
      *
31 29
      * @param string $classname
32 30
      */
33
-    public static function autoload($classname)
34
-    {
31
+    public static function autoload($classname) {
35 32
         self::_autoload(dirname(dirname(__FILE__)), $classname);
36 33
     }
37 34
 
38 35
     /**
39 36
      * Register the autoloader and any other setup needed
40 37
      */
41
-    public static function pharInit()
42
-    {
38
+    public static function pharInit() {
43 39
         spl_autoload_register(array('\Httpful\Bootstrap', 'pharAutoload'));
44 40
         self::registerHandlers();
45 41
     }
@@ -49,8 +45,7 @@  discard block
 block discarded – undo
49 45
      *
50 46
      * @param string $classname
51 47
      */
52
-    public static function pharAutoload($classname)
53
-    {
48
+    public static function pharAutoload($classname) {
54 49
         self::_autoload('phar://httpful.phar', $classname);
55 50
     }
56 51
 
@@ -58,8 +53,7 @@  discard block
 block discarded – undo
58 53
      * @param string base
59 54
      * @param string classname
60 55
      */
61
-    private static function _autoload($base, $classname)
62
-    {
56
+    private static function _autoload($base, $classname) {
63 57
         $parts      = explode(self::NS_GLUE, $classname);
64 58
         $path       = $base . self::DIR_GLUE . implode(self::DIR_GLUE, $parts) . '.php';
65 59
 
@@ -70,8 +64,7 @@  discard block
 block discarded – undo
70 64
     /**
71 65
      * Register default mime handlers.  Is idempotent.
72 66
      */
73
-    public static function registerHandlers()
74
-    {
67
+    public static function registerHandlers() {
75 68
         if (self::$registered === true) {
76 69
             return;
77 70
         }
@@ -87,8 +80,9 @@  discard block
 block discarded – undo
87 80
 
88 81
         foreach ($handlers as $mime => $handler) {
89 82
             // Don't overwrite if the handler has already been registered
90
-            if (Httpful::hasParserRegistered($mime))
91
-                continue;
83
+            if (Httpful::hasParserRegistered($mime)) {
84
+                            continue;
85
+            }
92 86
             Httpful::register($mime, $handler);
93 87
         }
94 88
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     const DIR_GLUE = DIRECTORY_SEPARATOR;
15 15
     const NS_GLUE = '\\';
16 16
 
17
-    public static $registered = false;
17
+    public static $registered = FALSE;
18 18
 
19 19
     /**
20 20
      * Register the autoloader and any other setup needed
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public static function registerHandlers()
74 74
     {
75
-        if (self::$registered === true) {
75
+        if (self::$registered === TRUE) {
76 76
             return;
77 77
         }
78 78
 
@@ -92,6 +92,6 @@  discard block
 block discarded – undo
92 92
             Httpful::register($mime, $handler);
93 93
         }
94 94
 
95
-        self::$registered = true;
95
+        self::$registered = TRUE;
96 96
     }
97 97
 }
Please login to merge, or discard this patch.
Tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
  * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache2
13 13
  * @link       http://elasticsearch.org
14 14
  */
15
-class SniffingConnectionPoolIntegrationTest extends \PHPUnit_Framework_TestCase
16
-{
15
+class SniffingConnectionPoolIntegrationTest extends \PHPUnit_Framework_TestCase {
17 16
     public function testSniff() {
18 17
         $params['connectionPoolClass'] = '\Elasticsearch\ConnectionPool\SniffingConnectionPool';
19 18
         $params['connectionPoolParams']['sniffingInterval'] = -10;
Please login to merge, or discard this patch.
Elasticsearch/Tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $roundRobin = new Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector();
29 29
 
30
-        $mockConnections = array();
31
-        foreach (range(0,10) as $index) {
30
+        $mockConnections = array ();
31
+        foreach (range(0, 10) as $index) {
32 32
             $mockConnections[$index] = $this->getMockBuilder('\Elasticsearch\Connections\CurlMultiConnection')
33 33
                 ->disableOriginalConstructor()
34 34
                 ->getMock();
35 35
         }
36 36
 
37
-        foreach (range(0,15) as $index) {
37
+        foreach (range(0, 15) as $index) {
38 38
             $retConnection = $roundRobin->select($mockConnections);
39 39
 
40 40
             $nextIndex = ($index % 10) + 1;
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $roundRobin = new Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector();
58 58
 
59
-        $mockConnections = array();
60
-        foreach (range(0,10) as $index) {
59
+        $mockConnections = array ();
60
+        foreach (range(0, 10) as $index) {
61 61
             $mockConnections[$index] = $this->getMockBuilder('\Elasticsearch\Connections\CurlMultiConnection')
62 62
                 ->disableOriginalConstructor()
63 63
                 ->getMock();
64 64
         }
65 65
 
66
-        foreach (range(0,4) as $index) {
66
+        foreach (range(0, 4) as $index) {
67 67
             $retConnection = $roundRobin->select($mockConnections);
68 68
 
69
-            $nextIndex = ($index % (count($mockConnections)-1)) + 1;
69
+            $nextIndex = ($index % (count($mockConnections) - 1)) + 1;
70 70
             $this->assertEquals($mockConnections[$nextIndex], $retConnection);
71 71
         }
72 72
 
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
         unset($mockConnections[9]);
75 75
         unset($mockConnections[10]);
76 76
 
77
-        foreach (range(5,15) as $index) {
77
+        foreach (range(5, 15) as $index) {
78 78
             $retConnection = $roundRobin->select($mockConnections);
79 79
 
80
-            $nextIndex = ($index % (count($mockConnections)-1)) + 1;
80
+            $nextIndex = ($index % (count($mockConnections) - 1)) + 1;
81 81
             $this->assertEquals($mockConnections[$nextIndex], $retConnection);
82 82
         }
83 83
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
  * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache2
14 14
  * @link       http://elasticsearch.org
15 15
  */
16
-class RoundRobinSelectorTest extends \PHPUnit_Framework_TestCase
17
-{
16
+class RoundRobinSelectorTest extends \PHPUnit_Framework_TestCase {
18 17
 
19 18
     /**
20 19
      * Add Ten connections, select 15 to verify round robin
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
      *
24 23
      * @return void
25 24
      */
26
-    public function testTenConnections()
27
-    {
25
+    public function testTenConnections() {
28 26
         $roundRobin = new Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector();
29 27
 
30 28
         $mockConnections = array();
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      *
53 51
      * @return void
54 52
      */
55
-    public function testAddTenConnectionsestFiveTRemoveThree()
56
-    {
53
+    public function testAddTenConnectionsestFiveTRemoveThree() {
57 54
         $roundRobin = new Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector();
58 55
 
59 56
         $mockConnections = array();
Please login to merge, or discard this patch.
tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function testSerializeArray()
20 20
     {
21 21
         $serializer = new EverythingToJSONSerializer();
22
-        $body = array('value' => 'field');
22
+        $body = array ('value' => 'field');
23 23
 
24 24
         $ret = $serializer->serialize($body);
25 25
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $serializer = new EverythingToJSONSerializer();
33 33
 
34
-        $ret = $serializer->serialize(array());
34
+        $ret = $serializer->serialize(array ());
35 35
 
36 36
         $this->assertEquals('{}', $ret);
37 37
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $serializer = new EverythingToJSONSerializer();
56 56
 
57
-        $body = array("value" => "\xB1\x31"); // invalid UTF-8 byte sequence
57
+        $body = array ("value" => "\xB1\x31"); // invalid UTF-8 byte sequence
58 58
 
59 59
         $serializer->serialize($body);
60 60
     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $serializer = new EverythingToJSONSerializer();
65 65
         $body = '{"field":"value"}';
66 66
 
67
-        $ret = $serializer->deserialize($body, array());
67
+        $ret = $serializer->deserialize($body, array ());
68 68
 
69 69
         $body = json_decode($body, true);
70 70
         $this->assertEquals($body, $ret);
@@ -78,6 +78,6 @@  discard block
 block discarded – undo
78 78
         $serializer = new EverythingToJSONSerializer();
79 79
         $body = '{"field":}';
80 80
 
81
-        $serializer->deserialize($body, array());
81
+        $serializer->deserialize($body, array ());
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,10 +14,8 @@  discard block
 block discarded – undo
14 14
  * Class EverythingToJSONSerializerTest
15 15
  * @package Elasticsearch\Tests\Serializers
16 16
  */
17
-class EverythingToJSONSerializerTest extends PHPUnit_Framework_TestCase
18
-{
19
-    public function testSerializeArray()
20
-    {
17
+class EverythingToJSONSerializerTest extends PHPUnit_Framework_TestCase {
18
+    public function testSerializeArray() {
21 19
         $serializer = new EverythingToJSONSerializer();
22 20
         $body = array('value' => 'field');
23 21
 
@@ -27,8 +25,7 @@  discard block
 block discarded – undo
27 25
         $this->assertEquals($body, $ret);
28 26
     }
29 27
 
30
-    public function testSerializeEmptyArrayReturnsEmptyJsonObject()
31
-    {
28
+    public function testSerializeEmptyArrayReturnsEmptyJsonObject() {
32 29
         $serializer = new EverythingToJSONSerializer();
33 30
 
34 31
         $ret = $serializer->serialize(array());
@@ -36,8 +33,7 @@  discard block
 block discarded – undo
36 33
         $this->assertEquals('{}', $ret);
37 34
     }
38 35
 
39
-    public function testSerializeString()
40
-    {
36
+    public function testSerializeString() {
41 37
         $serializer = new EverythingToJSONSerializer();
42 38
         $body = 'abc';
43 39
 
@@ -50,8 +46,7 @@  discard block
 block discarded – undo
50 46
     /**
51 47
      * @expectedException Elasticsearch\Common\Exceptions\Serializer\JsonSerializationError
52 48
      */
53
-    public function testSerializeArrayWithInvalidUtf8ThrowsException()
54
-    {
49
+    public function testSerializeArrayWithInvalidUtf8ThrowsException() {
55 50
         $serializer = new EverythingToJSONSerializer();
56 51
 
57 52
         $body = array("value" => "\xB1\x31"); // invalid UTF-8 byte sequence
@@ -59,8 +54,7 @@  discard block
 block discarded – undo
59 54
         $serializer->serialize($body);
60 55
     }
61 56
 
62
-    public function testDeserializeJSON()
63
-    {
57
+    public function testDeserializeJSON() {
64 58
         $serializer = new EverythingToJSONSerializer();
65 59
         $body = '{"field":"value"}';
66 60
 
@@ -73,8 +67,7 @@  discard block
 block discarded – undo
73 67
     /**
74 68
      * @expectedException Elasticsearch\Common\Exceptions\Serializer\JsonDeserializationError
75 69
      */
76
-    public function testDeserializeWithInvalidJsonThrowsException()
77
-    {
70
+    public function testDeserializeWithInvalidJsonThrowsException() {
78 71
         $serializer = new EverythingToJSONSerializer();
79 72
         $body = '{"field":}';
80 73
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
 
67 67
         $ret = $serializer->deserialize($body, array());
68 68
 
69
-        $body = json_decode($body, true);
69
+        $body = json_decode($body, TRUE);
70 70
         $this->assertEquals($body, $ret);
71 71
     }
72 72
 
Please login to merge, or discard this patch.
tests/Elasticsearch/Tests/Serializers/SmartSerializerTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
     {
23 23
         $body = '<some-tag>content</some-tag>';
24 24
 
25
-        $result = $this->serializer->deserialize($body, array('content_type' => 'application/xml'));
25
+        $result = $this->serializer->deserialize($body, array ('content_type' => 'application/xml'));
26 26
 
27 27
         $this->assertEquals($body, $result);
28 28
     }
29 29
 
30 30
     public function testDeserializeWithJsonContentTypeReturnsDecodedJson()
31 31
     {
32
-        $result = $this->serializer->deserialize('{"one": "two"}', array('content_type' => 'application/json'));
32
+        $result = $this->serializer->deserialize('{"one": "two"}', array ('content_type' => 'application/json'));
33 33
 
34 34
         $this->assertInternalType('array', $result);
35 35
         $this->assertArrayHasKeY('one', $result);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function testDeserializeWithoutContentTypeReturnsDecodedJson()
39 39
     {
40
-        $result = $this->serializer->deserialize('{"one": "two"}', array());
40
+        $result = $this->serializer->deserialize('{"one": "two"}', array ());
41 41
 
42 42
         $this->assertInternalType('array', $result);
43 43
         $this->assertArrayHasKeY('one', $result);
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,12 +14,10 @@  discard block
 block discarded – undo
14 14
  * Class SmartSerializerTest
15 15
  * @package Elasticsearch\Tests\Serializers
16 16
  */
17
-class SmartSerializerTest extends PHPUnit_Framework_TestCase
18
-{
17
+class SmartSerializerTest extends PHPUnit_Framework_TestCase {
19 18
     private $serializer;
20 19
 
21
-    public function testDeserializeWithNonJsonContentTypeReturnsRawDataString()
22
-    {
20
+    public function testDeserializeWithNonJsonContentTypeReturnsRawDataString() {
23 21
         $body = '<some-tag>content</some-tag>';
24 22
 
25 23
         $result = $this->serializer->deserialize($body, array('content_type' => 'application/xml'));
@@ -27,24 +25,21 @@  discard block
 block discarded – undo
27 25
         $this->assertEquals($body, $result);
28 26
     }
29 27
 
30
-    public function testDeserializeWithJsonContentTypeReturnsDecodedJson()
31
-    {
28
+    public function testDeserializeWithJsonContentTypeReturnsDecodedJson() {
32 29
         $result = $this->serializer->deserialize('{"one": "two"}', array('content_type' => 'application/json'));
33 30
 
34 31
         $this->assertInternalType('array', $result);
35 32
         $this->assertArrayHasKeY('one', $result);
36 33
     }
37 34
 
38
-    public function testDeserializeWithoutContentTypeReturnsDecodedJson()
39
-    {
35
+    public function testDeserializeWithoutContentTypeReturnsDecodedJson() {
40 36
         $result = $this->serializer->deserialize('{"one": "two"}', array());
41 37
 
42 38
         $this->assertInternalType('array', $result);
43 39
         $this->assertArrayHasKeY('one', $result);
44 40
     }
45 41
 
46
-    protected function setUp()
47
-    {
42
+    protected function setUp() {
48 43
         $this->serializer = new SmartSerializer();
49 44
     }
50 45
 }
Please login to merge, or discard this patch.
tests/Elasticsearch/Tests/Serializers/ArrayToJSONSerializerTest.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function testSerializeArray()
20 20
     {
21 21
         $serializer = new ArrayToJSONSerializer();
22
-        $body = array('value' => 'field');
22
+        $body = array ('value' => 'field');
23 23
 
24 24
         $ret = $serializer->serialize($body);
25 25
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $serializer = new ArrayToJSONSerializer();
43 43
         $body = '{"field":"value"}';
44 44
 
45
-        $ret = $serializer->deserialize($body, array());
45
+        $ret = $serializer->deserialize($body, array ());
46 46
 
47 47
         $body = json_decode($body, true);
48 48
         $this->assertEquals($body, $ret);
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,10 +14,8 @@  discard block
 block discarded – undo
14 14
  * Class ArrayToJSONSerializerTest
15 15
  * @package Elasticsearch\Tests\Serializers
16 16
  */
17
-class ArrayToJSONSerializerTest extends PHPUnit_Framework_TestCase
18
-{
19
-    public function testSerializeArray()
20
-    {
17
+class ArrayToJSONSerializerTest extends PHPUnit_Framework_TestCase {
18
+    public function testSerializeArray() {
21 19
         $serializer = new ArrayToJSONSerializer();
22 20
         $body = array('value' => 'field');
23 21
 
@@ -27,8 +25,7 @@  discard block
 block discarded – undo
27 25
         $this->assertEquals($body, $ret);
28 26
     }
29 27
 
30
-    public function testSerializeString()
31
-    {
28
+    public function testSerializeString() {
32 29
         $serializer = new ArrayToJSONSerializer();
33 30
         $body = 'abc';
34 31
 
@@ -37,8 +34,7 @@  discard block
 block discarded – undo
37 34
         $this->assertEquals($body, $ret);
38 35
     }
39 36
 
40
-    public function testDeserializeJSON()
41
-    {
37
+    public function testDeserializeJSON() {
42 38
         $serializer = new ArrayToJSONSerializer();
43 39
         $body = '{"field":"value"}';
44 40
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
         $ret = $serializer->deserialize($body, array());
46 46
 
47
-        $body = json_decode($body, true);
47
+        $body = json_decode($body, TRUE);
48 48
         $this->assertEquals($body, $ret);
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
Lib/ElasticSearchPhpClient/tests/Elasticsearch/Tests/YamlRunnerTest.php 3 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public static function getHostEnvVar()
52 52
     {
53 53
         if (isset($_SERVER['ES_TEST_HOST']) === true) {
54
-            echo "Test Host: ".$_SERVER['ES_TEST_HOST']."\n";
54
+            echo "Test Host: " . $_SERVER['ES_TEST_HOST'] . "\n";
55 55
             return $_SERVER['ES_TEST_HOST'];
56 56
         } else {
57 57
             echo 'Environment variable for elasticsearch test cluster (ES_TEST_HOST) not defined. Exiting yaml test';
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         $response = json_decode($response, true);
75 75
         YamlRunnerTest::$esVersion = $response['version']['number'];
76
-        echo "ES Version: ".YamlRunnerTest::$esVersion."\n";
76
+        echo "ES Version: " . YamlRunnerTest::$esVersion . "\n";
77 77
     }
78 78
 
79 79
     public function setUp()
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $this->yaml = new Parser();
82 82
         $uri = parse_url($host = YamlRunnerTest::getHostEnvVar());
83 83
 
84
-        $params['hosts'] = array($uri['host'].':'.$uri['port']);
84
+        $params['hosts'] = array ($uri['host'] . ':' . $uri['port']);
85 85
         $params['connectionParams']['timeout'] = 10000;
86 86
         $params['logging'] = true;
87 87
         $params['logLevel'] = \Psr\Log\LogLevel::DEBUG;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         echo "\n>>>CLEARING<<<\n";
95 95
         $host = YamlRunnerTest::getHostEnvVar();
96
-        $ch = curl_init($host."/*");
96
+        $ch = curl_init($host . "/*");
97 97
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
98 98
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
99 99
         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $response = curl_exec($ch);
102 102
         curl_close($ch);
103 103
 
104
-        $ch = curl_init($host."/_template/*");
104
+        $ch = curl_init($host . "/_template/*");
105 105
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
106 106
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
107 107
         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
@@ -114,19 +114,19 @@  discard block
 block discarded – undo
114 114
 
115 115
     private function assertTruthy($value)
116 116
     {
117
-        echo "\n         |assertTruthy: ".json_encode($value)."\n";
117
+        echo "\n         |assertTruthy: " . json_encode($value) . "\n";
118 118
         ob_flush();
119 119
         if (isset($value) === false || $value === 0 || $value === false || $value === null || $value === '') {
120
-            $this->fail("Value is not truthy: ".print_r($value, true));
120
+            $this->fail("Value is not truthy: " . print_r($value, true));
121 121
         }
122 122
     }
123 123
 
124 124
     private function assertFalsey($value)
125 125
     {
126
-        echo "\n         |assertFalsey: ".json_encode($value)."\n";
126
+        echo "\n         |assertFalsey: " . json_encode($value) . "\n";
127 127
         ob_flush();
128 128
         if (!(isset($value) === false || $value === 0 || $value === false || $value === null || $value === '')) {
129
-            $this->fail("Value is not falsey: ".print_r($value, true));
129
+            $this->fail("Value is not falsey: " . print_r($value, true));
130 130
         }
131 131
     }
132 132
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $pattern = trim($pattern);
135 135
 
136 136
         // PHP doesn't like unescaped forward slashes
137
-        $pattern = substr($pattern, 1, strlen($pattern)-2);
137
+        $pattern = substr($pattern, 1, strlen($pattern) - 2);
138 138
         $pattern = str_replace('/', '\/', $pattern);
139 139
         $pattern = "/$pattern/mx";
140 140
         echo "\n         |> actual: $actual\n";
@@ -173,20 +173,20 @@  discard block
 block discarded – undo
173 173
 
174 174
     public static function provider()
175 175
     {
176
-        $path = dirname(__FILE__).'/../../../util/elasticsearch/rest-api-spec/test/';
176
+        $path = dirname(__FILE__) . '/../../../util/elasticsearch/rest-api-spec/test/';
177 177
 
178
-        $files = array();
178
+        $files = array ();
179 179
         $objects = new RecursiveIteratorIterator(
180 180
             new RecursiveDirectoryIterator($path),
181 181
             RecursiveIteratorIterator::SELF_FIRST
182 182
         );
183 183
 
184
-        foreach($objects as $object) {
184
+        foreach ($objects as $object) {
185 185
 
186 186
             /** @var FilesystemIterator $object */
187 187
             if ($object->isFile() === true && $object->getFilename() !== 'README.asciidoc' && $object->getFilename() !== 'TODO.txt') {
188
-                $path = $object->getPathInfo()->getRealPath()."/".$object->getBasename();
189
-                $files[] = array($path);
188
+                $path = $object->getPathInfo()->getRealPath() . "/" . $object->getBasename();
189
+                $files[] = array ($path);
190 190
             }
191 191
         }
192 192
 
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
             $fileData = file_get_contents($testFile);
225 225
             $documents = array_filter(explode("---", $fileData));
226 226
 
227
-            $yamlDocs = array();
227
+            $yamlDocs = array ();
228 228
             $setup = null;
229 229
             foreach ($documents as $document) {
230 230
                 try {
231
-                    $tDoc = array();
231
+                    $tDoc = array ();
232 232
                     $tDoc['document'] = $this->checkForTimestamp($testFile, $document);
233 233
                     $tDoc['document'] = $this->checkForEmptyProperty($testFile, $tDoc['document']);
234 234
                     $tDoc['values'] = $this->yaml->parse($tDoc['document'], false, false, true);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
             foreach ($yamlDocs as $doc) {
248 248
                 $ts = date('c');
249
-                echo "   ".key($doc['values'])." [$ts]\n";
249
+                echo "   " . key($doc['values']) . " [$ts]\n";
250 250
                 ob_flush();
251 251
 
252 252
                 $this->clearCluster();
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                     try {
256 256
                         $this->executeTestCase($setup, $testFile);
257 257
                     } catch (SetupSkipException $e) {
258
-                        break;  //exit this test since we skipped in the setup
258
+                        break; //exit this test since we skipped in the setup
259 259
                     }
260 260
 
261 261
                 }
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 
297 297
     private function executeTestCase($test, $testFile)
298 298
     {
299
-        $stash = array();
300
-        $response = array();
299
+        $stash = array ();
300
+        $response = array ();
301 301
         reset($test);
302 302
         $key = key($test);
303 303
 
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 
332 332
 
333 333
                     try {
334
-                        echo "         |".json_encode($hash)."\n";
334
+                        echo "         |" . json_encode($hash) . "\n";
335 335
                         $response = $this->callMethod($method, $hash);
336
-                        echo "         |".json_encode($response)."\n";
336
+                        echo "         |" . json_encode($response) . "\n";
337 337
                         ob_flush();
338 338
 
339 339
                         //$this->waitForYellow();
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
                         if (isset($expectedError) === true) {
342 342
                             $this->fail("Expected Exception not thrown: $expectedError");
343 343
                         }
344
-                    } catch (Missing404Exception $exception){
344
+                    } catch (Missing404Exception $exception) {
345 345
                         if ($expectedError === 'missing') {
346 346
                             $this->assertTrue(true);
347 347
                         } else {
348 348
                             $this->fail($exception->getMessage());
349 349
                         }
350
-                        $response = array();
350
+                        $response = array ();
351 351
 
352 352
 
353 353
                     } catch (Conflict409Exception $exception) {
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                         } else {
357 357
                             $this->fail($exception->getMessage());
358 358
                         }
359
-                        $response = array();
359
+                        $response = array ();
360 360
 
361 361
                     } catch (Forbidden403Exception $exception) {
362 362
                         if ($expectedError === 'forbidden') {
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
                         } else {
365 365
                             $this->fail($exception->getMessage());
366 366
                         }
367
-                        $response = array();
367
+                        $response = array ();
368 368
 
369
-                    } catch (BadRequest400Exception $exception){
369
+                    } catch (BadRequest400Exception $exception) {
370 370
                         if ($expectedError === 'request') {
371 371
                             $this->assertTrue(true);
372 372
                         } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
                         } else {
375 375
                             $this->fail($exception->getMessage());
376 376
                         }
377
-                        $response = array();
377
+                        $response = array ();
378 378
 
379
-                    } catch (ServerErrorResponseException $exception){
379
+                    } catch (ServerErrorResponseException $exception) {
380 380
                         if ($expectedError === 'request') {
381 381
                             $this->assertTrue(true);
382 382
                         } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
                         } else {
385 385
                             $this->fail($exception->getMessage());
386 386
                         }
387
-                        $response = array();
387
+                        $response = array ();
388 388
 
389
-                    } catch (Elasticsearch\Common\Exceptions\RuntimeException $exception){
389
+                    } catch (Elasticsearch\Common\Exceptions\RuntimeException $exception) {
390 390
                         if ($expectedError === 'param') {
391 391
                             $this->assertTrue(true);
392 392
                         } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                         } else {
395 395
                             $this->fail($exception->getMessage());
396 396
                         }
397
-                        $response = array();
397
+                        $response = array ();
398 398
 
399 399
                     } catch (\Exception $exception) {
400 400
                         if ($expectedError === null) {
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
                         } else {
405 405
                             $this->fail($exception->getMessage());
406 406
                         }
407
-                        $response = array();
407
+                        $response = array ();
408 408
 
409 409
                     }
410 410
 
411
-                } elseif($operator === 'match') {
411
+                } elseif ($operator === 'match') {
412 412
 
413 413
                     $expected = $this->getValue($settings, key($settings));
414 414
                     if (key($settings) === '') {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                     } else if (key($settings) === '$body') {
417 417
                         $actual = $response;
418 418
                     } else {
419
-                        $actual   = $this->getNestedVar($response, key($settings));
419
+                        $actual = $this->getNestedVar($response, key($settings));
420 420
 
421 421
                     }
422 422
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                         $version = explode("-", $version);
496 496
                         if (version_compare(YamlRunnerTest::$esVersion, $version[0]) >= 0
497 497
                             && version_compare($version[1], YamlRunnerTest::$esVersion) >= 0) {
498
-                            echo "Skipping: ".$settings['reason']."\n";
498
+                            echo "Skipping: " . $settings['reason'] . "\n";
499 499
 
500 500
                             if ($key == 'setup') {
501 501
                                 throw new SetupSkipException();
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                         }
505 505
                     } else if (isset($settings['features']) === true) {
506 506
                         $feature = $settings['features'];
507
-                        $whitelist = array('gtelte');
507
+                        $whitelist = array ('gtelte');
508 508
 
509 509
                         if (array_search($feature, $whitelist) === false) {
510 510
                             echo "Unsupported optional feature: $feature\n";
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
     private function callMethod($method, $hash)
522 522
     {
523
-        $ret = array();
523
+        $ret = array ();
524 524
 
525 525
         $methodParts = explode(".", $method);
526 526
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
     private function getValue($a, $key) {
541 541
         if (is_array($a)) {
542 542
             return $a[$key];
543
-        } elseif(is_object($a)) {
543
+        } elseif (is_object($a)) {
544 544
             return $a->$key;
545 545
         } else {
546 546
             die('non-array, non-object in getValue()');
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
     {
580 580
         $isMatch = preg_match($this->getTimestampRegex(), $document, $matches);
581 581
         if ($isMatch) {
582
-            $newTime = new \DateTime($matches[0].'GMT');
582
+            $newTime = new \DateTime($matches[0] . 'GMT');
583 583
             $document = preg_replace($this->getTimestampRegex(), $newTime->format('U') * 1000, $document);
584 584
         }
585 585
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
     private function skipTest($path)
630 630
     {//all_path_options
631
-        $skipList = array(
631
+        $skipList = array (
632 632
             'indices.delete_mapping/all_path_options.yaml',
633 633
             'indices.exists_type/10_basic.yaml',
634 634
             'indices.get_mapping/10_basic.yaml',
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
         if (version_compare(YamlRunnerTest::$esVersion, "1.4.0", "<")) {
648 648
 
649 649
             // Breaking changes in null alias
650
-            $skipList = array(
650
+            $skipList = array (
651 651
                 'indices.delete_alias/all_path_options.yaml',
652 652
                 'indices.put_alias/all_path_options.yaml'
653 653
             );
Please login to merge, or discard this patch.
Braces   +25 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
  * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache2
34 34
  * @link       http://elasticsearch.org
35 35
  */
36
-class YamlRunnerTest extends \PHPUnit_Framework_TestCase
37
-{
36
+class YamlRunnerTest extends \PHPUnit_Framework_TestCase {
38 37
     /** @var  Parser */
39 38
     private $yaml;
40 39
 
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
     /**
49 48
      * @return mixed
50 49
      */
51
-    public static function getHostEnvVar()
52
-    {
50
+    public static function getHostEnvVar() {
53 51
         if (isset($_SERVER['ES_TEST_HOST']) === true) {
54 52
             echo "Test Host: ".$_SERVER['ES_TEST_HOST']."\n";
55 53
             return $_SERVER['ES_TEST_HOST'];
@@ -60,8 +58,7 @@  discard block
 block discarded – undo
60 58
     }
61 59
 
62 60
 
63
-    public static function setUpBeforeClass()
64
-    {
61
+    public static function setUpBeforeClass() {
65 62
         $host = YamlRunnerTest::getHostEnvVar();
66 63
         $ch = curl_init($host);
67 64
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -76,8 +73,7 @@  discard block
 block discarded – undo
76 73
         echo "ES Version: ".YamlRunnerTest::$esVersion."\n";
77 74
     }
78 75
 
79
-    public function setUp()
80
-    {
76
+    public function setUp() {
81 77
         $this->yaml = new Parser();
82 78
         $uri = parse_url($host = YamlRunnerTest::getHostEnvVar());
83 79
 
@@ -89,8 +85,7 @@  discard block
 block discarded – undo
89 85
 
90 86
     }
91 87
 
92
-    private function clearCluster()
93
-    {
88
+    private function clearCluster() {
94 89
         echo "\n>>>CLEARING<<<\n";
95 90
         $host = YamlRunnerTest::getHostEnvVar();
96 91
         $ch = curl_init($host."/*");
@@ -112,8 +107,7 @@  discard block
 block discarded – undo
112 107
         $this->waitForYellow();
113 108
     }
114 109
 
115
-    private function assertTruthy($value)
116
-    {
110
+    private function assertTruthy($value) {
117 111
         echo "\n         |assertTruthy: ".json_encode($value)."\n";
118 112
         ob_flush();
119 113
         if (isset($value) === false || $value === 0 || $value === false || $value === null || $value === '') {
@@ -121,8 +115,7 @@  discard block
 block discarded – undo
121 115
         }
122 116
     }
123 117
 
124
-    private function assertFalsey($value)
125
-    {
118
+    private function assertFalsey($value) {
126 119
         echo "\n         |assertFalsey: ".json_encode($value)."\n";
127 120
         ob_flush();
128 121
         if (!(isset($value) === false || $value === 0 || $value === false || $value === null || $value === '')) {
@@ -145,8 +138,7 @@  discard block
 block discarded – undo
145 138
 
146 139
     }
147 140
 
148
-    private function waitForYellow()
149
-    {
141
+    private function waitForYellow() {
150 142
         $host = YamlRunnerTest::getHostEnvVar();
151 143
         $ch = curl_init("$host/_cluster/health?wait_for_status=yellow&timeout=50s");
152 144
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -171,8 +163,7 @@  discard block
 block discarded – undo
171 163
     }
172 164
 
173 165
 
174
-    public static function provider()
175
-    {
166
+    public static function provider() {
176 167
         $path = dirname(__FILE__).'/../../../util/elasticsearch/rest-api-spec/test/';
177 168
 
178 169
         $files = array();
@@ -197,7 +188,9 @@  discard block
 block discarded – undo
197 188
 
198 189
     private static function recursiveSort(&$array) {
199 190
         foreach ($array as &$value) {
200
-            if (is_array($value)) YamlRunnerTest::recursiveSort($value);
191
+            if (is_array($value)) {
192
+                YamlRunnerTest::recursiveSort($value);
193
+            }
201 194
         }
202 195
         return sort($array);
203 196
     }
@@ -207,8 +200,7 @@  discard block
 block discarded – undo
207 200
      * @dataProvider provider
208 201
      * @group yaml
209 202
      */
210
-    public function testYaml()
211
-    {
203
+    public function testYaml() {
212 204
         //* @runInSeparateProcess
213 205
 
214 206
         $files = func_get_args();
@@ -269,8 +261,7 @@  discard block
 block discarded – undo
269 261
 
270 262
     }
271 263
 
272
-    private function replaceWithStash($values, $stash)
273
-    {
264
+    private function replaceWithStash($values, $stash) {
274 265
         if (count($stash) === 0) {
275 266
             return $values;
276 267
         }
@@ -294,8 +285,7 @@  discard block
 block discarded – undo
294 285
         return $values;
295 286
     }
296 287
 
297
-    private function executeTestCase($test, $testFile)
298
-    {
288
+    private function executeTestCase($test, $testFile) {
299 289
         $stash = array();
300 290
         $response = array();
301 291
         reset($test);
@@ -341,7 +331,7 @@  discard block
 block discarded – undo
341 331
                         if (isset($expectedError) === true) {
342 332
                             $this->fail("Expected Exception not thrown: $expectedError");
343 333
                         }
344
-                    } catch (Missing404Exception $exception){
334
+                    } catch (Missing404Exception $exception) {
345 335
                         if ($expectedError === 'missing') {
346 336
                             $this->assertTrue(true);
347 337
                         } else {
@@ -366,7 +356,7 @@  discard block
 block discarded – undo
366 356
                         }
367 357
                         $response = array();
368 358
 
369
-                    } catch (BadRequest400Exception $exception){
359
+                    } catch (BadRequest400Exception $exception) {
370 360
                         if ($expectedError === 'request') {
371 361
                             $this->assertTrue(true);
372 362
                         } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
@@ -376,7 +366,7 @@  discard block
 block discarded – undo
376 366
                         }
377 367
                         $response = array();
378 368
 
379
-                    } catch (ServerErrorResponseException $exception){
369
+                    } catch (ServerErrorResponseException $exception) {
380 370
                         if ($expectedError === 'request') {
381 371
                             $this->assertTrue(true);
382 372
                         } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
@@ -386,7 +376,7 @@  discard block
 block discarded – undo
386 376
                         }
387 377
                         $response = array();
388 378
 
389
-                    } catch (Elasticsearch\Common\Exceptions\RuntimeException $exception){
379
+                    } catch (Elasticsearch\Common\Exceptions\RuntimeException $exception) {
390 380
                         if ($expectedError === 'param') {
391 381
                             $this->assertTrue(true);
392 382
                         } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
@@ -518,8 +508,7 @@  discard block
 block discarded – undo
518 508
         }
519 509
     }
520 510
 
521
-    private function callMethod($method, $hash)
522
-    {
511
+    private function callMethod($method, $hash) {
523 512
         $ret = array();
524 513
 
525 514
         $methodParts = explode(".", $method);
@@ -575,8 +564,7 @@  discard block
 block discarded – undo
575 564
      *
576 565
      * @return mixed
577 566
      */
578
-    private function checkForTimestamp($file, $document)
579
-    {
567
+    private function checkForTimestamp($file, $document) {
580 568
         $isMatch = preg_match($this->getTimestampRegex(), $document, $matches);
581 569
         if ($isMatch) {
582 570
             $newTime = new \DateTime($matches[0].'GMT');
@@ -608,8 +596,7 @@  discard block
 block discarded – undo
608 596
         }
609 597
     }
610 598
 
611
-    private function getTimestampRegex()
612
-    {
599
+    private function getTimestampRegex() {
613 600
         return <<<EOF
614 601
         ~
615 602
         (?P<year>[0-9][0-9][0-9][0-9])
@@ -626,8 +613,8 @@  discard block
 block discarded – undo
626 613
 EOF;
627 614
     }
628 615
 
629
-    private function skipTest($path)
630
-    {//all_path_options
616
+    private function skipTest($path) {
617
+//all_path_options
631 618
         $skipList = array(
632 619
             'indices.delete_mapping/all_path_options.yaml',
633 620
             'indices.exists_type/10_basic.yaml',
@@ -664,6 +651,5 @@  discard block
 block discarded – undo
664 651
 
665 652
 }
666 653
 
667
-class SetupSkipException extends \Exception
668
-{
654
+class SetupSkipException extends \Exception {
669 655
 }
670 656
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public static function getHostEnvVar()
52 52
     {
53
-        if (isset($_SERVER['ES_TEST_HOST']) === true) {
53
+        if (isset($_SERVER['ES_TEST_HOST']) === TRUE) {
54 54
             echo "Test Host: ".$_SERVER['ES_TEST_HOST']."\n";
55 55
             return $_SERVER['ES_TEST_HOST'];
56 56
         } else {
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $host = YamlRunnerTest::getHostEnvVar();
66 66
         $ch = curl_init($host);
67
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
67
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
68 68
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
69 69
         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
70 70
 
71 71
         $response = curl_exec($ch);
72 72
         curl_close($ch);
73 73
 
74
-        $response = json_decode($response, true);
74
+        $response = json_decode($response, TRUE);
75 75
         YamlRunnerTest::$esVersion = $response['version']['number'];
76 76
         echo "ES Version: ".YamlRunnerTest::$esVersion."\n";
77 77
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         $params['hosts'] = array($uri['host'].':'.$uri['port']);
85 85
         $params['connectionParams']['timeout'] = 10000;
86
-        $params['logging'] = true;
86
+        $params['logging'] = TRUE;
87 87
         $params['logLevel'] = \Psr\Log\LogLevel::DEBUG;
88 88
         $this->client = new Elasticsearch\Client($params);
89 89
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         echo "\n>>>CLEARING<<<\n";
95 95
         $host = YamlRunnerTest::getHostEnvVar();
96 96
         $ch = curl_init($host."/*");
97
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
97
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
98 98
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
99 99
         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
100 100
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         curl_close($ch);
103 103
 
104 104
         $ch = curl_init($host."/_template/*");
105
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
105
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
106 106
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
107 107
         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
108 108
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
     {
117 117
         echo "\n         |assertTruthy: ".json_encode($value)."\n";
118 118
         ob_flush();
119
-        if (isset($value) === false || $value === 0 || $value === false || $value === null || $value === '') {
120
-            $this->fail("Value is not truthy: ".print_r($value, true));
119
+        if (isset($value) === FALSE || $value === 0 || $value === FALSE || $value === NULL || $value === '') {
120
+            $this->fail("Value is not truthy: ".print_r($value, TRUE));
121 121
         }
122 122
     }
123 123
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
     {
126 126
         echo "\n         |assertFalsey: ".json_encode($value)."\n";
127 127
         ob_flush();
128
-        if (!(isset($value) === false || $value === 0 || $value === false || $value === null || $value === '')) {
129
-            $this->fail("Value is not falsey: ".print_r($value, true));
128
+        if (!(isset($value) === FALSE || $value === 0 || $value === FALSE || $value === NULL || $value === '')) {
129
+            $this->fail("Value is not falsey: ".print_r($value, TRUE));
130 130
         }
131 131
     }
132 132
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $host = YamlRunnerTest::getHostEnvVar();
151 151
         $ch = curl_init("$host/_cluster/health?wait_for_status=yellow&timeout=50s");
152
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
152
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
153 153
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
154 154
         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
155 155
 
156
-        $response = json_decode(curl_exec($ch), true);
156
+        $response = json_decode(curl_exec($ch), TRUE);
157 157
 
158 158
         $counter = 0;
159 159
         while ($response['status'] === 'red') {
160 160
             sleep(0.5);
161
-            $response = json_decode(curl_exec($ch), true);
161
+            $response = json_decode(curl_exec($ch), TRUE);
162 162
             ++$counter;
163 163
 
164 164
             if ($counter > 10) {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         foreach($objects as $object) {
185 185
 
186 186
             /** @var FilesystemIterator $object */
187
-            if ($object->isFile() === true && $object->getFilename() !== 'README.asciidoc' && $object->getFilename() !== 'TODO.txt') {
187
+            if ($object->isFile() === TRUE && $object->getFilename() !== 'README.asciidoc' && $object->getFilename() !== 'TODO.txt') {
188 188
                 $path = $object->getPathInfo()->getRealPath()."/".$object->getBasename();
189 189
                 $files[] = array($path);
190 190
             }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             echo "$testFile\n";
218 218
             ob_flush();
219 219
 
220
-            if ($this->skipTest($testFile) === true) {
220
+            if ($this->skipTest($testFile) === TRUE) {
221 221
                 $this->markTestSkipped('Skipped due to skip-list');
222 222
             }
223 223
 
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
             $documents = array_filter(explode("---", $fileData));
226 226
 
227 227
             $yamlDocs = array();
228
-            $setup = null;
228
+            $setup = NULL;
229 229
             foreach ($documents as $document) {
230 230
                 try {
231 231
                     $tDoc = array();
232 232
                     $tDoc['document'] = $this->checkForTimestamp($testFile, $document);
233 233
                     $tDoc['document'] = $this->checkForEmptyProperty($testFile, $tDoc['document']);
234
-                    $tDoc['values'] = $this->yaml->parse($tDoc['document'], false, false, true);
234
+                    $tDoc['values'] = $this->yaml->parse($tDoc['document'], FALSE, FALSE, TRUE);
235 235
 
236 236
                     if (key($tDoc['values']) === 'setup') {
237 237
                         $setup = $tDoc['values'];
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
                 $this->clearCluster();
253 253
 
254
-                if ($setup !== null) {
254
+                if ($setup !== NULL) {
255 255
                     try {
256 256
                         $this->executeTestCase($setup, $testFile);
257 257
                     } catch (SetupSkipException $e) {
@@ -275,17 +275,17 @@  discard block
 block discarded – undo
275 275
             return $values;
276 276
         }
277 277
 
278
-        if (is_array($values) === true) {
278
+        if (is_array($values) === TRUE) {
279 279
             array_walk_recursive($values, function(&$item, $key) use ($stash) {
280
-                if (is_string($item) === true || is_numeric($item) === true) {
281
-                    if (array_key_exists($item, $stash) == true) {
280
+                if (is_string($item) === TRUE || is_numeric($item) === TRUE) {
281
+                    if (array_key_exists($item, $stash) == TRUE) {
282 282
                         $item = $stash[$item];
283 283
                     }
284 284
                 }
285 285
 
286 286
             });
287 287
         } elseif (is_string($values) || is_numeric($values)) {
288
-            if (array_key_exists($values, $stash) == true) {
288
+            if (array_key_exists($values, $stash) == TRUE) {
289 289
                 $values = $stash[$values];
290 290
             }
291 291
         }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                         echo "(catch: $expectedError) ";
318 318
                         ob_flush();
319 319
                     } else {
320
-                        $expectedError = null;
320
+                        $expectedError = NULL;
321 321
                     }
322 322
 
323 323
                     $method = key($settings);
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 
339 339
                         //$this->waitForYellow();
340 340
 
341
-                        if (isset($expectedError) === true) {
341
+                        if (isset($expectedError) === TRUE) {
342 342
                             $this->fail("Expected Exception not thrown: $expectedError");
343 343
                         }
344 344
                     } catch (Missing404Exception $exception){
345 345
                         if ($expectedError === 'missing') {
346
-                            $this->assertTrue(true);
346
+                            $this->assertTrue(TRUE);
347 347
                         } else {
348 348
                             $this->fail($exception->getMessage());
349 349
                         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
                     } catch (Conflict409Exception $exception) {
354 354
                         if ($expectedError === 'conflict') {
355
-                            $this->assertTrue(true);
355
+                            $this->assertTrue(TRUE);
356 356
                         } else {
357 357
                             $this->fail($exception->getMessage());
358 358
                         }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
                     } catch (Forbidden403Exception $exception) {
362 362
                         if ($expectedError === 'forbidden') {
363
-                            $this->assertTrue(true);
363
+                            $this->assertTrue(TRUE);
364 364
                         } else {
365 365
                             $this->fail($exception->getMessage());
366 366
                         }
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 
369 369
                     } catch (BadRequest400Exception $exception){
370 370
                         if ($expectedError === 'request') {
371
-                            $this->assertTrue(true);
372
-                        } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
373
-                            $this->assertTrue(true);
371
+                            $this->assertTrue(TRUE);
372
+                        } elseif (isset($expectedError) === TRUE && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
373
+                            $this->assertTrue(TRUE);
374 374
                         } else {
375 375
                             $this->fail($exception->getMessage());
376 376
                         }
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
 
379 379
                     } catch (ServerErrorResponseException $exception){
380 380
                         if ($expectedError === 'request') {
381
-                            $this->assertTrue(true);
382
-                        } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
383
-                            $this->assertTrue(true);
381
+                            $this->assertTrue(TRUE);
382
+                        } elseif (isset($expectedError) === TRUE && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
383
+                            $this->assertTrue(TRUE);
384 384
                         } else {
385 385
                             $this->fail($exception->getMessage());
386 386
                         }
@@ -388,19 +388,19 @@  discard block
 block discarded – undo
388 388
 
389 389
                     } catch (Elasticsearch\Common\Exceptions\RuntimeException $exception){
390 390
                         if ($expectedError === 'param') {
391
-                            $this->assertTrue(true);
392
-                        } elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
393
-                            $this->assertTrue(true);
391
+                            $this->assertTrue(TRUE);
392
+                        } elseif (isset($expectedError) === TRUE && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
393
+                            $this->assertTrue(TRUE);
394 394
                         } else {
395 395
                             $this->fail($exception->getMessage());
396 396
                         }
397 397
                         $response = array();
398 398
 
399 399
                     } catch (\Exception $exception) {
400
-                        if ($expectedError === null) {
400
+                        if ($expectedError === NULL) {
401 401
                             $this->fail($exception->getMessage());
402 402
                         } elseif (preg_match("/$expectedError/", $exception->getMessage()) === 1) {
403
-                            $this->assertTrue(true);
403
+                            $this->assertTrue(TRUE);
404 404
                         } else {
405 405
                             $this->fail($exception->getMessage());
406 406
                         }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
                         $expected = json_decode(json_encode($expected));
434 434
                     }
435 435
 
436
-                    if ($this->checkForRegex($expected) === true) {
436
+                    if ($this->checkForRegex($expected) === TRUE) {
437 437
                         $this->assertRegex($expected, $actual);
438 438
                     } else {
439 439
                         $this->assertEquals($expected, $actual);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
                     echo "\n";
445 445
 
446 446
                 } elseif ($operator === "is_true") {
447
-                    if (empty($settings) === true) {
447
+                    if (empty($settings) === TRUE) {
448 448
                         $response = $this->replaceWithStash($response, $stash);
449 449
                         $this->assertTruthy($response);
450 450
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                     echo "\n";
458 458
 
459 459
                 } elseif ($operator === "is_false") {
460
-                    if (empty($settings) === true) {
460
+                    if (empty($settings) === TRUE) {
461 461
                         $response = $this->replaceWithStash($response, $stash);
462 462
                         $this->assertFalsey($response);
463 463
                     } else {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                     $this->assertGreaterThan($expectedCount, $this->getNestedVar($response, key($settings)));
490 490
                     echo "\n";
491 491
                 } elseif ($operator === "skip") {
492
-                    if (isset($settings['version']) === true) {
492
+                    if (isset($settings['version']) === TRUE) {
493 493
                         $version = $settings['version'];
494 494
                         $version = str_replace(" ", "", $version);
495 495
                         $version = explode("-", $version);
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
                             }
503 503
                             return;
504 504
                         }
505
-                    } else if (isset($settings['features']) === true) {
505
+                    } else if (isset($settings['features']) === TRUE) {
506 506
                         $feature = $settings['features'];
507 507
                         $whitelist = array('gtelte');
508 508
 
509
-                        if (array_search($feature, $whitelist) === false) {
509
+                        if (array_search($feature, $whitelist) === FALSE) {
510 510
                             echo "Unsupported optional feature: $feature\n";
511 511
                             return;
512 512
                         }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
             $piece = str_replace('\.', '.', $piece);
558 558
             if (!is_array($context) || !array_key_exists($piece, $context)) {
559 559
                 // error occurred
560
-                return null;
560
+                return NULL;
561 561
             }
562 562
             $context = &$context[$piece];
563 563
         }
@@ -596,15 +596,15 @@  discard block
 block discarded – undo
596 596
     }
597 597
 
598 598
     private function checkForRegex($value) {
599
-        if (is_string($value) !== true) {
600
-            return false;
599
+        if (is_string($value) !== TRUE) {
600
+            return FALSE;
601 601
         }
602 602
 
603 603
         $value = trim($value);
604 604
         if (substr($value, 0, 1) === '/' && substr($value, strlen($value) - 1, 1) === '/') {
605
-            return true;
605
+            return TRUE;
606 606
         } else {
607
-            return false;
607
+            return FALSE;
608 608
         }
609 609
     }
610 610
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
         (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?)
624 624
         (?::(?P<tz_minute>[0-9][0-9]))?))?)?
625 625
         ~x
626
-EOF;
626
+eof;
627 627
     }
628 628
 
629 629
     private function skipTest($path)
@@ -638,8 +638,8 @@  discard block
 block discarded – undo
638 638
         );
639 639
 
640 640
         foreach ($skipList as $skip) {
641
-            if (strpos($path, $skip) !== false) {
642
-                return true;
641
+            if (strpos($path, $skip) !== FALSE) {
642
+                return TRUE;
643 643
             }
644 644
         }
645 645
 
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
             );
654 654
 
655 655
             foreach ($skipList as $skip) {
656
-                if (strpos($path, $skip) !== false) {
657
-                    return true;
656
+                if (strpos($path, $skip) !== FALSE) {
657
+                    return TRUE;
658 658
                 }
659 659
             }
660 660
         }
661 661
 
662
-        return false;
662
+        return FALSE;
663 663
     }
664 664
 
665 665
 }
Please login to merge, or discard this patch.
tests/Elasticsearch/Tests/Connections/GuzzleConnectionIntegrationTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
      */
37 37
     public function test5xxErrorBadHost()
38 38
     {
39
-        $hostDetails = array('host' => 'localhost5', 'port' => 9200);
39
+        $hostDetails = array ('host' => 'localhost5', 'port' => 9200);
40 40
 
41 41
         $connectionParams['guzzleClient'] = new Client();
42 42
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,8 @@  discard block
 block discarded – undo
23 23
  * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache2
24 24
  * @link       http://elasticsearch.org
25 25
  */
26
-class GuzzleConnectionIntegrationTest extends \PHPUnit_Framework_TestCase
27
-{
28
-    public function tearDown()
29
-    {
26
+class GuzzleConnectionIntegrationTest extends \PHPUnit_Framework_TestCase {
27
+    public function tearDown() {
30 28
         m::close();
31 29
     }
32 30
 
@@ -34,8 +32,7 @@  discard block
 block discarded – undo
34 32
     /**
35 33
      * @expectedException Elasticsearch\Common\Exceptions\Curl\CouldNotResolveHostException
36 34
      */
37
-    public function test5xxErrorBadHost()
38
-    {
35
+    public function test5xxErrorBadHost() {
39 36
         $hostDetails = array('host' => 'localhost5', 'port' => 9200);
40 37
 
41 38
         $connectionParams['guzzleClient'] = new Client();
Please login to merge, or discard this patch.