Completed
Push — master ( 4ac624...f91529 )
by mehdi
06:08
created
vendor/composer/autoload_psr4.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,6 +6,6 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    'Datium\\Tools\\' => array($baseDir . '/src'),
10
-    'Datium\\' => array($baseDir . '/src', $baseDir . '/src/Events'),
9
+    'Datium\\Tools\\' => array($baseDir.'/src'),
10
+    'Datium\\' => array($baseDir.'/src', $baseDir.'/src/Events'),
11 11
 );
Please login to merge, or discard this patch.
src/CalendarSettings/Gregorian.php 4 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
- use Datium\Datium as Datium;
4
-
5 3
  return array (
6 4
 
7 5
  /************************************************************
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -137,7 +137,9 @@  discard block
 block discarded – undo
137 137
 
138 138
      foreach( $config['month_days_number'] as $_month => $value ) {
139 139
 
140
-       if ( $_month < $month ) $result += $value;
140
+       if ( $_month < $month ) {
141
+         $result += $value;
142
+       }
141 143
 
142 144
      }
143 145
 
@@ -155,7 +157,9 @@  discard block
 block discarded – undo
155 157
 
156 158
     foreach ($config['days_of_week'] as $key => $value) {
157 159
 
158
-      if ( $value == $day ) return $key += 1;
160
+      if ( $value == $day ) {
161
+        return $key += 1;
162
+      }
159 163
 
160 164
     }
161 165
 
Please login to merge, or discard this patch.
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 ``<?php
2 2
 
3
- use Datium\Datium as Datium;
3
+  use Datium\Datium as Datium;
4 4
 
5
- return array (
5
+  return array (
6 6
 
7
- 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
7
+  'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
8 8
 
9
- 'am_time' => 'AM',
9
+  'am_time' => 'AM',
10 10
 
11
- 'pm_time' => 'PM',
11
+  'pm_time' => 'PM',
12 12
 
13
- 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
13
+  'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
14 14
 
15 15
 
16 16
 
17
- /************************************************************
17
+  /************************************************************
18 18
   *                        Convert to
19 19
   ************************************************************
20 20
   *
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
   *
23 23
   *\_________________________________________________________/
24 24
   */
25
-   'convert_to' => function( $date_time ) {
25
+    'convert_to' => function( $date_time ) {
26 26
 
27
-     return null;
27
+      return null;
28 28
 
29
-   },
29
+    },
30 30
 
31
-   /************************************************************
31
+    /************************************************************
32 32
     *                        Convert From
33 33
     ************************************************************
34 34
     *
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
     *
37 37
     *\_________________________________________________________/
38 38
     */
39
-   'convert_from' => function( $date_time ) {
39
+    'convert_from' => function( $date_time ) {
40 40
 
41
-     return null;
41
+      return null;
42 42
 
43
-   },
43
+    },
44 44
 
45
-   /************************************************************
45
+    /************************************************************
46 46
     *               Shorthand for jalali calendar
47 47
     ************************************************************
48 48
     *
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
     *
51 51
     *\_________________________________________________________/
52 52
     */
53
-   'shorthand' => 'gr',
53
+    'shorthand' => 'gr',
54 54
 
55
-   /************************************************************
55
+    /************************************************************
56 56
     *                        Month's name
57 57
     ************************************************************
58 58
     *
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
       'December'
88 88
 
89
-     ),
89
+      ),
90 90
 
91
-   /************************************************************
91
+    /************************************************************
92 92
     *                        Days of Week
93 93
     ************************************************************
94 94
     *
@@ -97,55 +97,55 @@  discard block
 block discarded – undo
97 97
     *
98 98
     *\_________________________________________________________/
99 99
     */
100
-   'days_of_week' => array (
100
+    'days_of_week' => array (
101 101
 
102
-       'Monday',
103
-       'Tuesday',
104
-       'Wednesday',
105
-       'Thursday',
106
-       'Friday',
107
-       'Saturday',
108
-       'Sunday',
109
-   ),
102
+        'Monday',
103
+        'Tuesday',
104
+        'Wednesday',
105
+        'Thursday',
106
+        'Friday',
107
+        'Saturday',
108
+        'Sunday',
109
+    ),
110 110
 
111 111
 
112
-   'month_days_number' => array(   1 => 31,
113
-                                   2 => 28,
114
-                                   3 => 31,
115
-                                   4 => 30,
116
-                                   5 => 31,
117
-                                   6 => 30,
118
-                                   7 => 31,
119
-                                   8 => 31,
120
-                                   9 => 30,
121
-                                   10 => 31,
122
-                                   11 => 30,
123
-                                   12 => 30 ),
112
+    'month_days_number' => array(   1 => 31,
113
+                                    2 => 28,
114
+                                    3 => 31,
115
+                                    4 => 30,
116
+                                    5 => 31,
117
+                                    6 => 30,
118
+                                    7 => 31,
119
+                                    8 => 31,
120
+                                    9 => 30,
121
+                                    10 => 31,
122
+                                    11 => 30,
123
+                                    12 => 30 ),
124 124
 
125 125
 
126
-   'day_of_year' => function( $date_time ) {
126
+    'day_of_year' => function( $date_time ) {
127 127
 
128
-     $result = null;
128
+      $result = null;
129 129
 
130
-     $_month = null;
130
+      $_month = null;
131 131
 
132
-     $config = include( 'Gregorian.php' );
132
+      $config = include( 'Gregorian.php' );
133 133
 
134
-     $month = $date_time->format('n');
134
+      $month = $date_time->format('n');
135 135
 
136
-     $day = $date_time->format('d');
136
+      $day = $date_time->format('d');
137 137
 
138
-     foreach( $config['month_days_number'] as $_month => $value ) {
138
+      foreach( $config['month_days_number'] as $_month => $value ) {
139 139
 
140
-       if ( $_month < $month ) $result += $value;
140
+        if ( $_month < $month ) $result += $value;
141 141
 
142
-     }
142
+      }
143 143
 
144
-     $result += $day;
144
+      $result += $day;
145 145
 
146
-     return $result;
146
+      return $result;
147 147
 
148
-   },
148
+    },
149 149
 
150 150
   'day_of_week' => function( $date_time ) {
151 151
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 
160 160
     }
161 161
 
162
-   },
162
+    },
163 163
 
164
-   /************************************************************
164
+    /************************************************************
165 165
     *                       Leap year
166 166
     ************************************************************
167 167
     *
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
     *
170 170
     *\_________________________________________________________/
171 171
     */
172
-   'leap_year' => null,
172
+    'leap_year' => null,
173 173
 
174
-   /************************************************************
174
+    /************************************************************
175 175
     *                        Weekend
176 176
     ************************************************************
177 177
     *
@@ -179,6 +179,6 @@  discard block
 block discarded – undo
179 179
     *
180 180
     *\_________________________________________________________/
181 181
     */
182
-   'weekend' => array( 'saturday', 'sunday' ),
182
+    'weekend' => array( 'saturday', 'sunday' ),
183 183
 
184 184
   );
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@  discard block
 block discarded – undo
2 2
 
3 3
  use Datium\Datium as Datium;
4 4
 
5
- return array (
5
+ return array(
6 6
 
7
- 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
7
+ 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
8 8
 
9 9
  'am_time' => 'AM',
10 10
 
11 11
  'pm_time' => 'PM',
12 12
 
13
- 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
13
+ 'end_of_days' => array('th', 'st', 'nd', 'rd'),
14 14
 
15 15
 
16 16
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   *
23 23
   *\_________________________________________________________/
24 24
   */
25
-   'convert_to' => function( $date_time ) {
25
+   'convert_to' => function($date_time) {
26 26
 
27 27
      return null;
28 28
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     *
37 37
     *\_________________________________________________________/
38 38
     */
39
-   'convert_from' => function( $date_time ) {
39
+   'convert_from' => function($date_time) {
40 40
 
41 41
      return null;
42 42
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     *
98 98
     *\_________________________________________________________/
99 99
     */
100
-   'days_of_week' => array (
100
+   'days_of_week' => array(
101 101
 
102 102
        'Monday',
103 103
        'Tuesday',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
    ),
110 110
 
111 111
 
112
-   'month_days_number' => array(   1 => 31,
112
+   'month_days_number' => array(1 => 31,
113 113
                                    2 => 28,
114 114
                                    3 => 31,
115 115
                                    4 => 30,
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
                                    9 => 30,
121 121
                                    10 => 31,
122 122
                                    11 => 30,
123
-                                   12 => 30 ),
123
+                                   12 => 30),
124 124
 
125 125
 
126
-   'day_of_year' => function( $date_time ) {
126
+   'day_of_year' => function($date_time) {
127 127
 
128 128
      $result = null;
129 129
 
130 130
      $_month = null;
131 131
 
132
-     $config = include( 'Gregorian.php' );
132
+     $config = include('Gregorian.php');
133 133
 
134 134
      $month = $date_time->format('n');
135 135
 
136 136
      $day = $date_time->format('d');
137 137
 
138
-     foreach( $config['month_days_number'] as $_month => $value ) {
138
+     foreach ($config['month_days_number'] as $_month => $value) {
139 139
 
140
-       if ( $_month < $month ) $result += $value;
140
+       if ($_month < $month) $result += $value;
141 141
 
142 142
      }
143 143
 
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 
148 148
    },
149 149
 
150
-  'day_of_week' => function( $date_time ) {
150
+  'day_of_week' => function($date_time) {
151 151
 
152
-    $config = include( 'Gregorian.php' );
152
+    $config = include('Gregorian.php');
153 153
 
154 154
     $day = $date_time->format('l');
155 155
 
156 156
     foreach ($config['days_of_week'] as $key => $value) {
157 157
 
158
-      if ( $value == $day ) return $key += 1;
158
+      if ($value == $day) return $key += 1;
159 159
 
160 160
     }
161 161
 
@@ -179,6 +179,6 @@  discard block
 block discarded – undo
179 179
     *
180 180
     *\_________________________________________________________/
181 181
     */
182
-   'weekend' => array( 'saturday', 'sunday' ),
182
+   'weekend' => array('saturday', 'sunday'),
183 183
 
184 184
   );
Please login to merge, or discard this patch.
src/Config.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,4 +125,4 @@
 block discarded – undo
125 125
    */
126 126
   'weekend' => array( 'friday' )
127 127
 
128
- );
128
+  );
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@
 block discarded – undo
35 35
   'default_calendar' => 'gregorian',
36 36
 
37 37
 
38
-  'date_interval' => array( 'D', 'M', 'Y', 'H', 'm', 'S' ),
38
+  'date_interval' => array('D', 'M', 'Y', 'H', 'm', 'S'),
39 39
 
40 40
 
41
-  'date_simple' => array( 'day', ' month', ' year', ' hour', ' minute', ' second' ),
41
+  'date_simple' => array('day', ' month', ' year', ' hour', ' minute', ' second'),
42 42
 
43 43
  );
Please login to merge, or discard this patch.
src/Datium.php 3 patches
Doc Comments   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
   /**
139 139
    * Get current datetime
140 140
    * @since Aug 17 2015
141
-   * @return object
141
+   * @return Datium
142 142
    */
143 143
   public static function now() {
144 144
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
    * @param $hour integer
157 157
    * @param $minute integer
158 158
    * @param $second integer
159
-   * @return object
159
+   * @return Datium
160 160
    */
161 161
   public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) {
162 162
 
@@ -195,6 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
   /**
197 197
    * Convert from current calendar, what type is current calendar?
198
+   * @param string $calendar
198 199
    */
199 200
   public function from( $calendar ) {
200 201
 
@@ -213,6 +214,9 @@  discard block
 block discarded – undo
213 214
 
214 215
   }
215 216
 
217
+  /**
218
+   * @param string $calendar
219
+   */
216 220
   public function to( $calendar ) {
217 221
 
218 222
     $this->convert = new Convert( $this->date_time );
@@ -245,7 +249,7 @@  discard block
 block discarded – undo
245 249
   /**
246 250
    * Add new date value to current date
247 251
    * @param $value string
248
-   * @return object
252
+   * @return Datium
249 253
    */
250 254
   public function add( $value ) {
251 255
 
@@ -262,7 +266,7 @@  discard block
 block discarded – undo
262 266
   /**
263 267
    * Sub date from current date
264 268
    * @param $value
265
-   * @return obejct
269
+   * @return Datium
266 270
    */
267 271
   public function sub( $value ) {
268 272
 
@@ -278,7 +282,7 @@  discard block
 block discarded – undo
278 282
 
279 283
   /**
280 284
    * Check if current year is leap or not
281
-   * @return boolean
285
+   * @return Leap
282 286
    */
283 287
   public function leap( $type = 'gregorian') {
284 288
 
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 
73 73
     $this->config = include('Config.php');
74 74
 
75
-    $this->calendar_type = $this->config[ 'default_calendar' ];
75
+    $this->calendar_type = $this->config['default_calendar'];
76 76
 
77
-    date_default_timezone_set( $this->config['timezone'] );
77
+    date_default_timezone_set($this->config['timezone']);
78 78
 
79 79
     $this->calendar_type = 'gregorian';
80 80
 
81
-    switch( Datium::$call_type ) {
81
+    switch (Datium::$call_type) {
82 82
 
83 83
       case 'now':
84 84
 
85
-        $this->date_time = new DateTime( 'now' );
85
+        $this->date_time = new DateTime('now');
86 86
 
87 87
         $this->gregorian_DayofWeek = $this->date_time->format('w');
88 88
 
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 
91 91
       case 'make':
92 92
 
93
-        $this->date_time = new DateTime( 'now' );
93
+        $this->date_time = new DateTime('now');
94 94
 
95
-        $this->date_time->setDate( self::$array_date['year'], self::$array_date['month'], self::$array_date['day'] );
95
+        $this->date_time->setDate(self::$array_date['year'], self::$array_date['month'], self::$array_date['day']);
96 96
 
97
-        $this->date_time->setTime( self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second'] );
97
+        $this->date_time->setTime(self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second']);
98 98
 
99 99
         $this->gregorian_DayofWeek = $this->date_time->format('w');
100 100
 
@@ -123,17 +123,17 @@  discard block
 block discarded – undo
123 123
 
124 124
     return (object) array(
125 125
 
126
-      'second' => $this->date_time->format( 's' ),
126
+      'second' => $this->date_time->format('s'),
127 127
 
128
-      'minute' => $this->date_time->format( 'm' ),
128
+      'minute' => $this->date_time->format('m'),
129 129
 
130
-      'hour' => $this->date_time->format( 'H' ),
130
+      'hour' => $this->date_time->format('H'),
131 131
 
132
-      'day' => $this->date_time->format( 'd' ),
132
+      'day' => $this->date_time->format('d'),
133 133
 
134
-      'month' => $this->date_time->format( 'm' ),
134
+      'month' => $this->date_time->format('m'),
135 135
 
136
-      'year' => $this->date_time->format( 'Y' )
136
+      'year' => $this->date_time->format('Y')
137 137
 
138 138
     );
139 139
 
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
    * @param $second integer
163 163
    * @return object
164 164
    */
165
-  public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) {
165
+  public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) {
166 166
 
167 167
       /**
168 168
        * When we want to set a Datetime object to Datium
169 169
        */
170
-      if( func_num_args() === 1 ) {
170
+      if (func_num_args() === 1) {
171 171
 
172 172
         self::$static_date_time = func_get_arg(0);
173 173
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
       } else {
177 177
 
178
-        self::$array_date = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second );
178
+        self::$array_date = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second);
179 179
 
180 180
         self::$call_type = 'make';
181 181
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
   }
187 187
 
188
-  public static function between( $date_start, $date_end ) {
188
+  public static function between($date_start, $date_end) {
189 189
 
190 190
     self::$date_start = $date_start;
191 191
 
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
   /**
201 201
    * Convert from current calendar, what type is current calendar?
202 202
    */
203
-  public function from( $calendar ) {
203
+  public function from($calendar) {
204 204
 
205
-    $this->convert = new Convert( $this->date_time );
205
+    $this->convert = new Convert($this->date_time);
206 206
 
207
-    $this->date_time = $this->convert->from( $calendar );
207
+    $this->date_time = $this->convert->from($calendar);
208 208
 
209 209
 
210 210
     /**
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 
219 219
   }
220 220
 
221
-  public function to( $calendar ) {
221
+  public function to($calendar) {
222 222
 
223
-    $this->convert = new Convert( $this->date_time );
223
+    $this->convert = new Convert($this->date_time);
224 224
 
225
-    $this->date_time = $this->convert->to( $calendar );
225
+    $this->date_time = $this->convert->to($calendar);
226 226
 
227 227
     /**
228 228
      * We need this part for DayOf class
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
    * @param $start datetime
242 242
    * @param $end datetime
243 243
    */
244
-  public static function diff( $start, $end ) {
244
+  public static function diff($start, $end) {
245 245
 
246
-    return date_diff( $start, $end );
246
+    return date_diff($start, $end);
247 247
 
248 248
   }
249 249
 
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
    * @param $value string
253 253
    * @return object
254 254
    */
255
-  public function add( $value ) {
255
+  public function add($value) {
256 256
 
257
-    $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value );
257
+    $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value);
258 258
 
259
-    $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression );
259
+    $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression);
260 260
 
261
-    $this->date_time->add( new DateInterval( $this->date_interval_expression ) );
261
+    $this->date_time->add(new DateInterval($this->date_interval_expression));
262 262
 
263 263
     return $this;
264 264
 
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
    * @param $value
270 270
    * @return obejct
271 271
    */
272
-  public function sub( $value ) {
272
+  public function sub($value) {
273 273
 
274
-    $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value );
274
+    $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value);
275 275
 
276
-    $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression );
276
+    $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression);
277 277
 
278
-    $this->date_time->sub( new DateInterval( $this->date_interval_expression ) );
278
+    $this->date_time->sub(new DateInterval($this->date_interval_expression));
279 279
 
280 280
     return $this;
281 281
 
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
    * Check if current year is leap or not
286 286
    * @return boolean
287 287
    */
288
-  public function leap( $type = 'gregorian') {
288
+  public function leap($type = 'gregorian') {
289 289
 
290
-    $this->leap = new Leap( $this->date_time->format( 'Y' ), $type );
290
+    $this->leap = new Leap($this->date_time->format('Y'), $type);
291 291
 
292 292
     return $this->leap;
293 293
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
    */
299 299
   public function dayOf() {
300 300
 
301
-    $this->day_of = new DayOf( $this->date_time, $this->calendar_type );
301
+    $this->day_of = new DayOf($this->date_time, $this->calendar_type);
302 302
 
303 303
     return $this->day_of;
304 304
 
@@ -309,13 +309,13 @@  discard block
 block discarded – undo
309 309
    */
310 310
   public function events() {
311 311
 
312
-    if ( Datium::$call_type == 'between' ) {
312
+    if (Datium::$call_type == 'between') {
313 313
 
314
-      $this->events = new Events( Datium::$date_start, Datium::$date_end );
314
+      $this->events = new Events(Datium::$date_start, Datium::$date_end);
315 315
 
316 316
     } else {
317 317
 
318
-      $this->events = new Events( $this->date_time );
318
+      $this->events = new Events($this->date_time);
319 319
 
320 320
     }
321 321
 
@@ -332,17 +332,17 @@  discard block
 block discarded – undo
332 332
    *
333 333
    *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
334 334
    */
335
-  public function object(){
335
+  public function object() {
336 336
 
337 337
     return $this->date_time;
338 338
 
339 339
   }
340 340
 
341
-  public function lang( $language = 'fa' ){
341
+  public function lang($language = 'fa') {
342 342
 
343 343
   $this->result = new Lang();
344 344
 
345
-  $this->result->setConfig( $language );
345
+  $this->result->setConfig($language);
346 346
 
347 347
   $this->toConfig = $this->result->getConfig();
348 348
 
@@ -356,29 +356,29 @@  discard block
 block discarded – undo
356 356
    * @param $calendar string
357 357
    * @param $format string
358 358
    */
359
-  public function get( $format = 'Y-m-d H:i:s' ) {
359
+  public function get($format = 'Y-m-d H:i:s') {
360 360
 
361
-    if ( is_null( $this->fromConfig ) )
362
-      $this->fromConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_from ) . '.php' );
361
+    if (is_null($this->fromConfig))
362
+      $this->fromConfig = include('CalendarSettings/'.ucfirst($this->translate_from).'.php');
363 363
 
364
-    if ( is_null( $this->toConfig ) )
365
-        $this->toConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_to ) . '.php' );
364
+    if (is_null($this->toConfig))
365
+        $this->toConfig = include('CalendarSettings/'.ucfirst($this->translate_to).'.php');
366 366
 
367
-      $string_date = $this->date_time->format( $format );
367
+      $string_date = $this->date_time->format($format);
368 368
 
369
-      if ( $this->translate_to != 'gregorian' ) {
369
+      if ($this->translate_to != 'gregorian') {
370 370
 
371
-      $string_date = str_replace( $this->fromConfig['month'], $this->toConfig['month'],  $string_date );
371
+      $string_date = str_replace($this->fromConfig['month'], $this->toConfig['month'], $string_date);
372 372
 
373
-      $string_date = str_replace( $this->fromConfig['days_of_week'], $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], $string_date );
373
+      $string_date = str_replace($this->fromConfig['days_of_week'], $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], $string_date);
374 374
 
375
-      $string_date = str_replace( $this->fromConfig['numbers'], $this->toConfig['numbers'], $string_date );
375
+      $string_date = str_replace($this->fromConfig['numbers'], $this->toConfig['numbers'], $string_date);
376 376
 
377
-      $string_date = str_replace( $this->fromConfig['am_time'], $this->toConfig['am_time'], $string_date );
377
+      $string_date = str_replace($this->fromConfig['am_time'], $this->toConfig['am_time'], $string_date);
378 378
 
379
-      $string_date = str_replace( $this->fromConfig['pm_time'], $this->toConfig['pm_time'], $string_date );
379
+      $string_date = str_replace($this->fromConfig['pm_time'], $this->toConfig['pm_time'], $string_date);
380 380
 
381
-      $string_date = str_replace( $this->fromConfig['end_of_days'], $this->toConfig['end_of_days'], $string_date );
381
+      $string_date = str_replace($this->fromConfig['end_of_days'], $this->toConfig['end_of_days'], $string_date);
382 382
 
383 383
     }
384 384
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -358,11 +358,13 @@
 block discarded – undo
358 358
    */
359 359
   public function get( $format = 'Y-m-d H:i:s' ) {
360 360
 
361
-    if ( is_null( $this->fromConfig ) )
362
-      $this->fromConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_from ) . '.php' );
361
+    if ( is_null( $this->fromConfig ) ) {
362
+          $this->fromConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_from ) . '.php' );
363
+    }
363 364
 
364
-    if ( is_null( $this->toConfig ) )
365
-        $this->toConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_to ) . '.php' );
365
+    if ( is_null( $this->toConfig ) ) {
366
+            $this->toConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_to ) . '.php' );
367
+    }
366 368
 
367 369
       $string_date = $this->date_time->format( $format );
368 370
 
Please login to merge, or discard this patch.
src/DayOf.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
   protected $geregorian_DayofWeek;
21 21
 
22
-  public function __construct( $date_time, $calendar_type = 'gregorian' ) {
22
+  public function __construct($date_time, $calendar_type = 'gregorian') {
23 23
 
24
-    $this->config = include( 'Config.php' );
24
+    $this->config = include('Config.php');
25 25
 
26 26
     $this->date_time = $date_time;
27 27
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
    */
39 39
   public function year() {
40 40
 
41
-    $this->config = include(  'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' );
41
+    $this->config = include('CalendarSettings/'.ucfirst($this->calendar_type).'.php');
42 42
 
43
-    return $this->config[ 'day_of_year' ]( $this->date_time );
43
+    return $this->config['day_of_year']($this->date_time);
44 44
 
45 45
   }
46 46
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
    */
53 53
   public function week() {
54 54
 
55
-    $this->config = include(  'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' );
55
+    $this->config = include('CalendarSettings/'.ucfirst($this->calendar_type).'.php');
56 56
 
57
-    return $this->config[ 'day_of_week' ]( $this->date_time );
57
+    return $this->config['day_of_week']($this->date_time);
58 58
 
59 59
   }
60 60
 
Please login to merge, or discard this patch.
src/Lang.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
37 37
      */
38
-    public static function setConfig( $language ) {
38
+    public static function setConfig($language) {
39 39
 
40 40
       /**
41 41
        * Fetch translated file to config attribute
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
        /**
46 46
         * Fetch translated expression to langTable attribute
47 47
         */
48
-       self::$langTable = include('lang/' . $language . '/general.php');
48
+       self::$langTable = include('lang/'.$language.'/general.php');
49 49
 
50
-       foreach( self::$langTable as $key => $translate ){
50
+       foreach (self::$langTable as $key => $translate) {
51 51
 
52
-         if(  self::$config[ $key ] ) {
52
+         if (self::$config[$key]) {
53 53
 
54
-           self::$config[ $key ] = $translate;
54
+           self::$config[$key] = $translate;
55 55
 
56 56
          }
57 57
        }
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,21 +40,21 @@
 block discarded – undo
40 40
       /**
41 41
        * Fetch translated file to config attribute
42 42
        */
43
-       self::$config = include('src/CalendarSettings/Jalali.php');
43
+        self::$config = include('src/CalendarSettings/Jalali.php');
44 44
 
45
-       /**
46
-        * Fetch translated expression to langTable attribute
47
-        */
48
-       self::$langTable = include('lang/' . $language . '/general.php');
45
+        /**
46
+         * Fetch translated expression to langTable attribute
47
+         */
48
+        self::$langTable = include('lang/' . $language . '/general.php');
49 49
 
50
-       foreach( self::$langTable as $key => $translate ){
50
+        foreach( self::$langTable as $key => $translate ){
51 51
 
52
-         if(  self::$config[ $key ] ) {
52
+          if(  self::$config[ $key ] ) {
53 53
 
54
-           self::$config[ $key ] = $translate;
54
+            self::$config[ $key ] = $translate;
55 55
 
56
-         }
57
-       }
56
+          }
57
+        }
58 58
 
59 59
     }
60 60
 
Please login to merge, or discard this patch.
src/lang/ar/general.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,23 +2,23 @@
 block discarded – undo
2 2
 
3 3
   return array(
4 4
 
5
-       'events' => array( 'eid fitr' => 'عيد الفطر',
5
+        'events' => array( 'eid fitr' => 'عيد الفطر',
6 6
 
7 7
                         ),
8 8
 
9 9
         'month' => array(
10 10
                           'مُحَرَّم',
11 11
                           'صَفَر',
12
-                           'رَبيع الأوّل',
13
-                           'رَبيع الآخر',
14
-                           'جُمادى الأولى',
15
-                           'جُمادى الآخرة',
16
-                           'رَجَب',
17
-                           'شَعْبان',
18
-                           'رَمَضان',
19
-                           'شَوّال',
20
-                           'ذو القِعْدة',
21
-                           'ذو الحِجّة'
12
+                            'رَبيع الأوّل',
13
+                            'رَبيع الآخر',
14
+                            'جُمادى الأولى',
15
+                            'جُمادى الآخرة',
16
+                            'رَجَب',
17
+                            'شَعْبان',
18
+                            'رَمَضان',
19
+                            'شَوّال',
20
+                            'ذو القِعْدة',
21
+                            'ذو الحِجّة'
22 22
                         ),
23 23
 
24 24
         'days_of_week' => array(
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
   return array(
4 4
 
5
-       'events' => array( 'eid fitr' => 'عيد الفطر',
5
+       'events' => array('eid fitr' => 'عيد الفطر',
6 6
 
7 7
                         ),
8 8
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
         'pm_time' => '',
39 39
 
40
-        'end_of_days' => array( "" ),
40
+        'end_of_days' => array(""),
41 41
 
42
-        'numbers' => array( '۰', '۱', '۲', '۳', '٤‎', '٥‎', '٦‎', '۷', '۸', '۹'),
42
+        'numbers' => array('۰', '۱', '۲', '۳', '٤‎', '٥‎', '٦‎', '۷', '۸', '۹'),
43 43
 
44 44
   );
45 45
 
Please login to merge, or discard this patch.
test.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -3,81 +3,81 @@
 block discarded – undo
3 3
 use Datium\Datium as Datium;
4 4
 use Datium\Tools\Convert as Covnert;
5 5
 
6
-try{
6
+try {
7 7
 
8
-require_once( 'vendor/autoload.php' );
9
-var_dump( Datium::create( 1394, 9, 24 )->from( 'jalali' )->get() );
10
-var_dump( Datium::create( 2020, 07, 11 )->to( 'jalali' )->get() );
11
-var_dump( Datium::create( 2020, 07, 11 )->to( 'hijri' )->get() );
8
+require_once('vendor/autoload.php');
9
+var_dump(Datium::create(1394, 9, 24)->from('jalali')->get());
10
+var_dump(Datium::create(2020, 07, 11)->to('jalali')->get());
11
+var_dump(Datium::create(2020, 07, 11)->to('hijri')->get());
12 12
 echo '<br>this year:<br>';
13
-var_dump( Datium::create( 2016, 6, 25, 12, 0, 0 )->to( 'hijri' )->lang( 'ar' )->get('l jS F Y h:i:s A') );
13
+var_dump(Datium::create(2016, 6, 25, 12, 0, 0)->to('hijri')->lang('ar')->get('l jS F Y h:i:s A'));
14 14
 echo "<br>";
15
-var_dump( Datium::now()->to( 'jalali' )->get('l jS F Y h:i:s A') );
15
+var_dump(Datium::now()->to('jalali')->get('l jS F Y h:i:s A'));
16 16
 echo "<br>";
17
-var_dump( Datium::now()->to( 'jalali' )->sub('3 year')->get() );
17
+var_dump(Datium::now()->to('jalali')->sub('3 year')->get());
18 18
 echo "<br>";
19
-var_dump( Datium::now()->to( 'jalali' )->add('3 year')->get() );
19
+var_dump(Datium::now()->to('jalali')->add('3 year')->get());
20 20
 echo "<br>";
21
-var_dump( Datium::now()->get( 'l jS F Y h:i:s A' ) );
21
+var_dump(Datium::now()->get('l jS F Y h:i:s A'));
22 22
 echo "<br>Leap year ";
23
-var_dump( Datium::now()->leap()->get() );
23
+var_dump(Datium::now()->leap()->get());
24 24
 echo "<br>Create new DateTime: ";
25
-var_dump( Datium::create(2000, 1, 1, 0, 0, 0)->get() );
25
+var_dump(Datium::create(2000, 1, 1, 0, 0, 0)->get());
26 26
 echo "<br>";
27 27
 echo 'Is next year leap? ';
28
-var_dump( Datium::now()->add('1 year')->leap()->get() );
28
+var_dump(Datium::now()->add('1 year')->leap()->get());
29 29
 echo "<br>";
30 30
 echo "Day of Year in gregorian:";
31 31
 echo "<br>";
32
-var_dump( Datium::now()->dayOf()->year() );
32
+var_dump(Datium::now()->dayOf()->year());
33 33
 echo "<br>";
34 34
 echo "Day of Year in jalali:";
35 35
 echo "<br>";
36
-var_dump( Datium::now()->to('jalali')->dayOf()->year() );
36
+var_dump(Datium::now()->to('jalali')->dayOf()->year());
37 37
 echo "<br>";
38 38
 echo "Day of Year in hijri:";
39 39
 echo "<br>";
40
-var_dump( Datium::now()->to( 'hijri' )->dayOf()->year() );
40
+var_dump(Datium::now()->to('hijri')->dayOf()->year());
41 41
 echo "<br>";
42 42
 echo "Day of Week : gregorian";
43 43
 echo "<br>";
44
-var_dump( Datium::now()->dayOf()->week() );
44
+var_dump(Datium::now()->dayOf()->week());
45 45
 echo "<br>";
46 46
 echo "Day of Week in Date(2015, 1, 1)";
47 47
 echo "<br>";
48
-var_dump( Datium::create( 2015, 1, 1 )->dayOf()->week() );
48
+var_dump(Datium::create(2015, 1, 1)->dayOf()->week());
49 49
 echo "<br>";
50 50
 echo "Day of Week : jalali";
51 51
 echo "<br>";
52
-var_dump( Datium::now()->to('jalali')->dayOf()->week() );
52
+var_dump(Datium::now()->to('jalali')->dayOf()->week());
53 53
 echo "<br>";
54 54
 echo "Day of Week in Date(2015, 1, 1)";
55 55
 echo "<br>";
56
-var_dump( Datium::create( 2015, 1, 1 )->to('jalali')->dayOf()->week() );
56
+var_dump(Datium::create(2015, 1, 1)->to('jalali')->dayOf()->week());
57 57
 echo "<br>";
58 58
 echo "Change date form gregorian to jalali with method: ";
59
-var_dump( Datium::create( 1989, 10, 27 )->to( 'jalali' )->get( 'l jS F Y h:i:s A' ) );
59
+var_dump(Datium::create(1989, 10, 27)->to('jalali')->get('l jS F Y h:i:s A'));
60 60
 echo "<br>";
61
-var_dump( Datium::now()->to( 'hijri' )->get( 'l jS F Y h:i:s A' ) );
61
+var_dump(Datium::now()->to('hijri')->get('l jS F Y h:i:s A'));
62 62
 echo "<br>";
63
-var_dump( Datium::now()->to( 'hijri' )->lang( 'ar' )->get( 'h:i:s Y jS l F' ) );
63
+var_dump(Datium::now()->to('hijri')->lang('ar')->get('h:i:s Y jS l F'));
64 64
 echo "<br>";
65 65
 echo "<br>is persian holiday? ";
66 66
 // var_dump(  Datium::between( Datium::now()->object() , Datium::now()->add( '3 month' )->object() )->events()->local( 'us' )->local( 'ir' )->get() );
67 67
 echo 'return international days';
68 68
 // var_dump(  Datium::between( Datium::now()->object() , Datium::now()->add('4 month')->object() )->events()->international()->get() );
69 69
 echo 'Convert gregorian to perisan';
70
-var_dump( Datium::now()->to('jalali')->get() );
70
+var_dump(Datium::now()->to('jalali')->get());
71 71
 echo 'Today\'s events:';
72 72
 // var_dump( Datium::now()->events()->local( 'ir' )->get() );
73 73
 echo 'Date diff';
74
-$diff = Datium::diff( Datium::now()->object(), Datium::now()->add('5 day')->object() );
75
-var_dump( $diff->days );
76
-var_dump( Datium::create( 2015, 11, 9 )->to( 'hijri' )->get() );
74
+$diff = Datium::diff(Datium::now()->object(), Datium::now()->add('5 day')->object());
75
+var_dump($diff->days);
76
+var_dump(Datium::create(2015, 11, 9)->to('hijri')->get());
77 77
 
78 78
 
79
-} catch (Exception $e ) {
79
+} catch (Exception $e) {
80 80
 
81
-  var_dump( $e );
81
+  var_dump($e);
82 82
 
83 83
 }
Please login to merge, or discard this patch.