Completed
Pull Request — master (#4)
by Harry
03:03
created
src/Client.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function __toString()
166 166
     {
167
-        return 'DogStatsD\Client::[' . $this->instanceId . ']';
167
+        return 'DogStatsD\Client::['.$this->instanceId.']';
168 168
     }
169 169
 
170 170
     /**
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
         if ($sampleRate < 1) {
264 264
             foreach ($metrics as $metric) {
265 265
                 if ((mt_rand() / mt_getrandmax()) <= $sampleRate) {
266
-                    $data[$metric] = $delta . '|c|@' . $sampleRate;
266
+                    $data[$metric] = $delta.'|c|@'.$sampleRate;
267 267
                 }
268 268
             }
269 269
         } else {
270 270
             foreach ($metrics as $metric) {
271
-                $data[$metric] = $delta . '|c';
271
+                $data[$metric] = $delta.'|c';
272 272
             }
273 273
         }
274 274
         return $this->send($data, $tags);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         return $this->send(
304 304
             [
305
-                $metric => $time . '|ms',
305
+                $metric => $time.'|ms',
306 306
             ],
307 307
             $tags
308 308
         );
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     {
340 340
         return $this->send(
341 341
             [
342
-                $metric => $value . '|g',
342
+                $metric => $value.'|g',
343 343
             ],
344 344
             $tags
345 345
         );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     {
359 359
         return $this->send(
360 360
             [
361
-                $metric => $value . '|s',
361
+                $metric => $value.'|s',
362 362
             ],
363 363
             $tags
364 364
         );
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 
392 392
         $text = str_replace(["\r", "\n"], ['', "\\n"], $text);
393 393
         $metric = sprintf('_e{%d,%d}', strlen($title), strlen($text));
394
-        $prefix = $this->namespace ? $this->namespace . '.' : '';
395
-        $value = sprintf('%s|%s', $prefix . $title, $text);
394
+        $prefix = $this->namespace ? $this->namespace.'.' : '';
395
+        $value = sprintf('%s|%s', $prefix.$title, $text);
396 396
 
397 397
         foreach ($metadata as $key => $data) {
398 398
             if (isset($this->eventMetaData[$key])) {
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
             return $this;
429 429
         }
430 430
 
431
-        $prefix = $this->namespace ? $this->namespace . '.' : '';
432
-        $value = sprintf('_sc|%s|%d', $prefix . $name, $status);
431
+        $prefix = $this->namespace ? $this->namespace.'.' : '';
432
+        $value = sprintf('_sc|%s|%d', $prefix.$name, $status);
433 433
 
434 434
         $applyMetadata = function ($metadata, $definition) use (&$value) {
435 435
             foreach ($metadata as $key => $data) {
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
     protected function send(array $data, array $tags = [])
484 484
     {
485 485
         $messages = [];
486
-        $prefix = $this->namespace ? $this->namespace . '.' : '';
486
+        $prefix = $this->namespace ? $this->namespace.'.' : '';
487 487
         $formattedTags = $this->formatTags(array_merge($this->tags, $tags));
488 488
         foreach ($data as $key => $value) {
489
-            $messages[] = $prefix . $key . ':' . $value . $formattedTags;
489
+            $messages[] = $prefix.$key.':'.$value.$formattedTags;
490 490
         }
491 491
         return $this->sendMessages($messages);
492 492
     }
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
      */
500 500
     protected function sendMessages(array $messages)
501 501
     {
502
-        $socket = @fsockopen('udp://' . $this->host, $this->port, $errno, $errstr, $this->timeout);
502
+        $socket = @fsockopen('udp://'.$this->host, $this->port, $errno, $errstr, $this->timeout);
503 503
         if (!$socket) {
504 504
             if ($this->throwExceptions) {
505
-                throw new ConnectionException($this, '(' . $errno . ') ' . $errstr);
505
+                throw new ConnectionException($this, '('.$errno.') '.$errstr);
506 506
             } else {
507 507
                 trigger_error(
508 508
                     sprintf('StatsD server connection failed (udp://%s:%d)', $this->host, $this->port),
Please login to merge, or discard this patch.
tests/unit/ConnectionTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
                     'StatsD server connection failed (udp://hostdoesnotexiststalleverlol.stupidtld:8125)',
48 48
                     $errstr
49 49
                 );
50
-                $testCase->assertSame(realpath(__DIR__ . '/../../src/Client.php'), $errfile);
50
+                $testCase->assertSame(realpath(__DIR__.'/../../src/Client.php'), $errfile);
51 51
             },
52 52
             E_USER_WARNING
53 53
         );
Please login to merge, or discard this patch.