Completed
Branch master (6c5b52)
by Oliver
07:17
created
src/Carbonated.php 2 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * Get the attributes that should be handled as carbonated timestamps.
26 26
      *
27
-     * @return array
27
+     * @return string[]
28 28
      */
29 29
     public function carbonatedTimestamps()
30 30
     {
@@ -479,6 +479,10 @@  discard block
 block discarded – undo
479 479
         $this->attributes[$key] = $value;
480 480
     }
481 481
 
482
+    /**
483
+     * @param Carbonated $instance
484
+     * @param string $propertyName
485
+     */
482 486
     private function ensureProperty($instance, $propertyName)
483 487
     {
484 488
         if(!property_exists($instance, $propertyName))
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
         $fieldType = $this->carbonatedAttributeType($key);
299 299
 
300 300
         // Get output format and timezone for conversion.
301
-        $outputFormat = $this->{$accessorType . ucfirst($fieldType) . 'Format'}();
302
-        $outputTimezone = $this->{$accessorType . 'Timezone'}();
301
+        $outputFormat = $this->{$accessorType.ucfirst($fieldType).'Format'}();
302
+        $outputTimezone = $this->{$accessorType.'Timezone'}();
303 303
 
304 304
         // Get Carbon instance.
305 305
         $carbonInstance = $this->carbonInstances()->$key;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $fieldType = $this->carbonatedAttributeType($key);
322 322
 
323 323
         // Get database format and timezone.
324
-        $databaseFormat = $this->{'database' . ucfirst($fieldType) . 'Format'}();
324
+        $databaseFormat = $this->{'database'.ucfirst($fieldType).'Format'}();
325 325
         $databaseTimezone = $this->databaseTimezone();
326 326
 
327 327
         // If value is DateTime instance, convert to Carbon instance.
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 
337 337
         // Otherwise, get input format and timezone for conversion.
338 338
         if (static::requestIsJson()) {
339
-            $inputFormat = $this->{'json' . ucfirst($fieldType) . 'Format'}();
339
+            $inputFormat = $this->{'json'.ucfirst($fieldType).'Format'}();
340 340
             $inputTimezone = $this->jsonTimezone();
341 341
         } else {
342
-            $inputFormat = $this->{'carbonated' . ucfirst($fieldType) . 'Format'}();
342
+            $inputFormat = $this->{'carbonated'.ucfirst($fieldType).'Format'}();
343 343
             $inputTimezone = $this->carbonatedTimezone();
344 344
         }
345 345
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         // If returning JSON output, reference our own accessors for relevant date/time fields.
396 396
         if ($useJsonAccessors) {
397 397
             foreach ($attributes as $key => $value) {
398
-                if (! $this->hasGetMutator($key) && in_array($key, $this->carbonatedAttributes())) {
398
+                if (!$this->hasGetMutator($key) && in_array($key, $this->carbonatedAttributes())) {
399 399
                     $attributes[$key] = $this->carbonatedAccessor($key, true);
400 400
                 }
401 401
             }
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
         if ($this->hasCast($key)) {
439 439
             $value = $this->castAttribute($key, $value);
440 440
         } elseif (in_array($key, $this->getDates())) {
441
-            if (! is_null($value)) {
441
+            if (!is_null($value)) {
442 442
                 return $this->asDateTime($value);
443 443
             }
444 444
         }
@@ -481,13 +481,13 @@  discard block
 block discarded – undo
481 481
 
482 482
     private function ensureProperty($instance, $propertyName)
483 483
     {
484
-        if(!property_exists($instance, $propertyName))
484
+        if (!property_exists($instance, $propertyName))
485 485
         {
486 486
             return false;
487 487
         }
488 488
 
489 489
         // Check property value for null and false values
490
-        if(empty($instance->{$propertyName})){
490
+        if (empty($instance->{$propertyName})) {
491 491
             return false;
492 492
         }
493 493
 
Please login to merge, or discard this patch.