Passed
Push — master ( b691b7...9fda08 )
by Sebastian
02:50
created
src/ConvertHelper/DurationConverter.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -32,39 +32,39 @@  discard block
 block discarded – undo
32 32
     const SECONDS_PER_MONTH_APPROX = 2505600; // imprecise - for 29 days, only for approximations. 
33 33
     const SECONDS_PER_YEAR = 31536000;
34 34
     
35
-   /**
36
-    * @var int
37
-    */
35
+    /**
36
+     * @var int
37
+     */
38 38
     protected $dateFrom;
39 39
     
40
-   /**
41
-    * @var int
42
-    */
40
+    /**
41
+     * @var int
42
+     */
43 43
     protected $dateTo;
44 44
     
45
-   /**
46
-    * @var bool
47
-    */
45
+    /**
46
+     * @var bool
47
+     */
48 48
     protected $future = false;
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $interval = '';
54 54
     
55
-   /**
56
-    * @var int
57
-    */
55
+    /**
56
+     * @var int
57
+     */
58 58
     protected $difference = 0;
59 59
     
60
-   /**
61
-    * @var int
62
-    */
60
+    /**
61
+     * @var int
62
+     */
63 63
     protected $dateDiff = 0;
64 64
     
65
-   /**
66
-    * @var array|NULL
67
-    */
65
+    /**
66
+     * @var array|NULL
67
+     */
68 68
     protected static $texts = null;
69 69
     
70 70
     public function __construct()
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
         self::$texts = null;
85 85
     }
86 86
     
87
-   /**
88
-    * Sets the origin date to calculate from.
89
-    * 
90
-    * NOTE: if this is further in the future than
91
-    * the to: date, it will be considered as a 
92
-    * calculation for something to come, i.e. 
93
-    * "In two days".
94
-    *  
95
-    * @param \DateTime $date
96
-    * @return ConvertHelper_DurationConverter
97
-    */
87
+    /**
88
+     * Sets the origin date to calculate from.
89
+     * 
90
+     * NOTE: if this is further in the future than
91
+     * the to: date, it will be considered as a 
92
+     * calculation for something to come, i.e. 
93
+     * "In two days".
94
+     *  
95
+     * @param \DateTime $date
96
+     * @return ConvertHelper_DurationConverter
97
+     */
98 98
     public function setDateFrom(\DateTime $date) : ConvertHelper_DurationConverter
99 99
     {
100 100
         $this->dateFrom = ConvertHelper::date2timestamp($date);
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
         return $this;
103 103
     }
104 104
     
105
-   /**
106
-    * Sets the date to calculate to. Defaults to 
107
-    * the current time if not set.
108
-    * 
109
-    * @param \DateTime $date
110
-    * @return ConvertHelper_DurationConverter
111
-    */
105
+    /**
106
+     * Sets the date to calculate to. Defaults to 
107
+     * the current time if not set.
108
+     * 
109
+     * @param \DateTime $date
110
+     * @return ConvertHelper_DurationConverter
111
+     */
112 112
     public function setDateTo(\DateTime $date) : ConvertHelper_DurationConverter
113 113
     {
114 114
         $this->dateTo = ConvertHelper::date2timestamp($date);
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
         return $this;
117 117
     }
118 118
     
119
-   /**
120
-    * Converts the specified dates to a human readable string.
121
-    * 
122
-    * @throws ConvertHelper_Exception
123
-    * @return string
124
-    * 
125
-    * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
126
-    */
119
+    /**
120
+     * Converts the specified dates to a human readable string.
121
+     * 
122
+     * @throws ConvertHelper_Exception
123
+     * @return string
124
+     * 
125
+     * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
126
+     */
127 127
     public function convert() : string
128 128
     {
129 129
         $this->initTexts();
Please login to merge, or discard this patch.
src/ConvertHelper/StorageSizeEnum.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
     
32 32
     const BASE_2 = 1024;
33 33
     
34
-   /**
35
-    * @var ConvertHelper_StorageSizeEnum_Size[]
36
-    */
34
+    /**
35
+     * @var ConvertHelper_StorageSizeEnum_Size[]
36
+     */
37 37
     protected static $sizes = array();
38 38
     
39
-   /**
40
-    * Initializes the supported unit notations, and
41
-    * how they are supposed to be calculated.
42
-    *
43
-    * @see ConvertHelper_SizeNotation::parseSize()
44
-    */
39
+    /**
40
+     * Initializes the supported unit notations, and
41
+     * how they are supposed to be calculated.
42
+     *
43
+     * @see ConvertHelper_SizeNotation::parseSize()
44
+     */
45 45
     protected static function init() : void
46 46
     {
47 47
         if(!empty(self::$sizes)) {
@@ -68,28 +68,28 @@  discard block
 block discarded – undo
68 68
         }
69 69
     }
70 70
     
71
-   /**
72
-    * Called whenever the application locale is changed,
73
-    * to reset the size definitions so the labels get 
74
-    * translated to the new locale.
75
-    */
71
+    /**
72
+     * Called whenever the application locale is changed,
73
+     * to reset the size definitions so the labels get 
74
+     * translated to the new locale.
75
+     */
76 76
     public static function handle_localeChanged() : void
77 77
     {
78 78
         self::$sizes = array();
79 79
     }
80 80
     
81
-   /**
82
-    * Adds a storage size to the internal collection.
83
-    * 
84
-    * @param string $name The lowercase size name, e.g. "kb", "mib"
85
-    * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
86
-    * @param int $exponent The multiplier of the base to get the byte value
87
-    * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
88
-    * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
89
-    * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
90
-    * 
91
-    * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
92
-    */
81
+    /**
82
+     * Adds a storage size to the internal collection.
83
+     * 
84
+     * @param string $name The lowercase size name, e.g. "kb", "mib"
85
+     * @param int $base This defines how many bytes there are in a kilobyte, to differentiate with the two common way to calculate sizes: base 10 or base 2. See the Wikipedia link for more details.
86
+     * @param int $exponent The multiplier of the base to get the byte value
87
+     * @param string $suffix The localized short suffix, e.g. "KB", "MiB"
88
+     * @param string $singular The localized singular label of the size, e.g. "Kilobyte".
89
+     * @param string $plural The localized plural label of the size, e.g. "Kilobytes".
90
+     * 
91
+     * @see https://en.m.wikipedia.org/wiki/Megabyte#Definitions
92
+     */
93 93
     protected static function addSize(string $name, int $base, int $exponent, string $suffix, string $singular, string $plural) : void
94 94
     {
95 95
         self::$sizes[$name] = new ConvertHelper_StorageSizeEnum_Size(
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
         );
103 103
     }
104 104
     
105
-   /**
106
-    * Retrieves all known sizes.
107
-    * 
108
-    * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
109
-    */
105
+    /**
106
+     * Retrieves all known sizes.
107
+     * 
108
+     * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
109
+     */
110 110
     public static function getSizes() : array
111 111
     {
112 112
         self::init();
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
         return self::$sizes;
115 115
     }
116 116
     
117
-   /**
118
-    * Retrieves a size definition instance by its name.
119
-    * 
120
-    * @param string $name Case insensitive. For example "kb", "MiB"...
121
-    * @throws ConvertHelper_Exception
122
-    * @return ConvertHelper_StorageSizeEnum_Size
123
-    * 
124
-    * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
125
-    */
117
+    /**
118
+     * Retrieves a size definition instance by its name.
119
+     * 
120
+     * @param string $name Case insensitive. For example "kb", "MiB"...
121
+     * @throws ConvertHelper_Exception
122
+     * @return ConvertHelper_StorageSizeEnum_Size
123
+     * 
124
+     * @see ConvertHelper_StorageSizeEnum::ERROR_UNKNOWN_UNIT_NAME
125
+     */
126 126
     public static function getSizeByName(string $name) : ConvertHelper_StorageSizeEnum_Size
127 127
     {
128 128
         self::init();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
         );
145 145
     }
146 146
     
147
-   /**
148
-    * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
149
-    * @return array
150
-    */
147
+    /**
148
+     * Retrieves a list of all size names, e.g. "mb", "kib" (lowercase).
149
+     * @return array
150
+     */
151 151
     public static function getSizeNames() : array
152 152
     {
153 153
         self::init();
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
         return array_keys(self::$sizes);
156 156
     }
157 157
    
158
-   /**
159
-    * Retrieves all available storage sizes for the specified
160
-    * base value.
161
-    * 
162
-    * @param int $base
163
-    * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
164
-    * 
165
-    * @see ConvertHelper_StorageSizeEnum::BASE_10
166
-    * @see ConvertHelper_StorageSizeEnum::BASE_2
167
-    */
158
+    /**
159
+     * Retrieves all available storage sizes for the specified
160
+     * base value.
161
+     * 
162
+     * @param int $base
163
+     * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[]
164
+     * 
165
+     * @see ConvertHelper_StorageSizeEnum::BASE_10
166
+     * @see ConvertHelper_StorageSizeEnum::BASE_2
167
+     */
168 168
     public static function getSizesByBase(int $base) : array
169 169
     {
170 170
         self::init();
Please login to merge, or discard this patch.