Passed
Push — master ( 693dda...155960 )
by Sebastian
02:20
created
src/NumberInfo.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -38,24 +38,24 @@  discard block
 block discarded – undo
38 38
  */
39 39
 class NumberInfo
40 40
 {
41
-   /**
42
-    * @var mixed
43
-    */
41
+    /**
42
+     * @var mixed
43
+     */
44 44
     protected $rawValue;
45 45
     
46
-   /**
47
-    * @var array
48
-    */
46
+    /**
47
+     * @var array
48
+     */
49 49
     protected $info;
50 50
     
51
-   /**
52
-    * @var bool
53
-    */
51
+    /**
52
+     * @var bool
53
+     */
54 54
     protected $empty = false;
55 55
     
56
-   /**
57
-    * @var array
58
-    */
56
+    /**
57
+     * @var array
58
+     */
59 59
     protected $knownUnits = array(
60 60
         '%' => true,
61 61
         'rem' => true,
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
         return $this;
96 96
     }
97 97
     
98
-   /**
99
-    * Retrieves the raw, internal information array resulting
100
-    * from the parsing of the number.
101
-    *  
102
-    * @return array
103
-    */
98
+    /**
99
+     * Retrieves the raw, internal information array resulting
100
+     * from the parsing of the number.
101
+     *  
102
+     * @return array
103
+     */
104 104
     public function getRawInfo() : array
105 105
     {
106 106
         return $this->info;
107 107
     }
108 108
     
109
-   /**
110
-    * Whether the number was empty (null or empty string).
111
-    * @return boolean
112
-    */
109
+    /**
110
+     * Whether the number was empty (null or empty string).
111
+     * @return boolean
112
+     */
113 113
     public function isEmpty() : bool
114 114
     {
115 115
         return $this->empty;
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
         return $cache[$key];
533 533
     }
534 534
     
535
-   /**
536
-    * Parses a string number notation with units included, e.g. 14px, 50%...
537
-    * 
538
-    * @param string $test
539
-    * @return array
540
-    */
535
+    /**
536
+     * Parses a string number notation with units included, e.g. 14px, 50%...
537
+     * 
538
+     * @param string $test
539
+     * @return array
540
+     */
541 541
     private function parseStringValue(string $test) : array
542 542
     {
543 543
         $number = null;
@@ -588,13 +588,13 @@  discard block
 block discarded – undo
588 588
         return $this->filterInfo($result);
589 589
     }
590 590
     
591
-   /**
592
-    * Attempts to determine what kind of units are specified
593
-    * in the string. Returns NULL if none could be matched.
594
-    * 
595
-    * @param string $value
596
-    * @return array|NULL
597
-    */
591
+    /**
592
+     * Attempts to determine what kind of units are specified
593
+     * in the string. Returns NULL if none could be matched.
594
+     * 
595
+     * @param string $value
596
+     * @return array|NULL
597
+     */
598 598
     private function findUnits(string $value) : ?array
599 599
     {
600 600
         $vlength = strlen($value);
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
         return null;
623 623
     }
624 624
     
625
-   /**
626
-    * Creates the cache key for the specified value.
627
-    * 
628
-    * @param mixed $value
629
-    * @return string
630
-    */
625
+    /**
626
+     * Creates the cache key for the specified value.
627
+     * 
628
+     * @param mixed $value
629
+     * @return string
630
+     */
631 631
     private function createValueKey($value) : string
632 632
     {
633 633
         if(!is_string($value) && !is_numeric($value))
@@ -640,59 +640,59 @@  discard block
 block discarded – undo
640 640
     
641 641
     protected $postProcess = false;
642 642
     
643
-   /**
644
-    * Called if explicitly enabled: allows filtering the 
645
-    * number after the detection process has completed.
646
-    * 
647
-    * @param string|NULL $number The adjusted number
648
-    * @param string $originalString The original value before it was parsed
649
-    * @return mixed
650
-    */
643
+    /**
644
+     * Called if explicitly enabled: allows filtering the 
645
+     * number after the detection process has completed.
646
+     * 
647
+     * @param string|NULL $number The adjusted number
648
+     * @param string $originalString The original value before it was parsed
649
+     * @return mixed
650
+     */
651 651
     protected function postProcess(?string $number, /** @scrutinizer ignore-unused */ string $originalString)
652 652
     {
653 653
         return $number;
654 654
     }
655 655
     
656
-   /**
657
-    * Filters the value before it is parsed, but only if it is a string.
658
-    * 
659
-    * NOTE: This may be overwritten in a subclass, to allow custom filtering
660
-    * the the values. An example of a use case would be a preprocessor for
661
-    * variables in a templating system.
662
-    * 
663
-    * @param string $trimmedString The trimmed value.
664
-    * @param array $cache The internal values cache array.
665
-    * @param string $originalValue The original value that the NumberInfo was created for.
666
-    * @return string
667
-    * 
668
-    * @see NumberInfo::enablePostProcess()
669
-    */
656
+    /**
657
+     * Filters the value before it is parsed, but only if it is a string.
658
+     * 
659
+     * NOTE: This may be overwritten in a subclass, to allow custom filtering
660
+     * the the values. An example of a use case would be a preprocessor for
661
+     * variables in a templating system.
662
+     * 
663
+     * @param string $trimmedString The trimmed value.
664
+     * @param array $cache The internal values cache array.
665
+     * @param string $originalValue The original value that the NumberInfo was created for.
666
+     * @return string
667
+     * 
668
+     * @see NumberInfo::enablePostProcess()
669
+     */
670 670
     protected function preProcess(string $trimmedString, /** @scrutinizer ignore-unused */ array &$cache, /** @scrutinizer ignore-unused */ string $originalValue) : string
671 671
     {
672 672
         return str_replace(',', '.', $trimmedString);
673 673
     }
674 674
     
675
-   /**
676
-    * Enables the post processing so the postProcess method gets called.
677
-    * This should be called in the {@link NumberInfo::preProcess()}
678
-    * method as needed.
679
-    * 
680
-    * @return NumberInfo
681
-    * @see NumberInfo::postProcess()
682
-    */
675
+    /**
676
+     * Enables the post processing so the postProcess method gets called.
677
+     * This should be called in the {@link NumberInfo::preProcess()}
678
+     * method as needed.
679
+     * 
680
+     * @return NumberInfo
681
+     * @see NumberInfo::postProcess()
682
+     */
683 683
     private function enablePostProcess() : NumberInfo
684 684
     {
685 685
         $this->postProcess = true;
686 686
         return $this;
687 687
     }
688 688
     
689
-   /**
690
-    * Filters the number info array to adjust the units
691
-    * and number according to the required rules.
692
-    * 
693
-    * @param array $info
694
-    * @return array
695
-    */
689
+    /**
690
+     * Filters the number info array to adjust the units
691
+     * and number according to the required rules.
692
+     * 
693
+     * @param array $info
694
+     * @return array
695
+     */
696 696
     protected function filterInfo(array $info) : array
697 697
     {
698 698
         $useUnits = 'px';
Please login to merge, or discard this patch.