Completed
Push — master ( 821eef...e5b389 )
by mehdi
02:43
created
src/Convert.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -63,6 +63,10 @@  discard block
 block discarded – undo
63 63
    *
64 64
    *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
65 65
    */
66
+
67
+  /**
68
+   * @param \DateTime $date_time
69
+   */
66 70
   public function __construct( $date_time = NULL ) {
67 71
 
68 72
     if ( $date_time !== NULL ) {
@@ -96,6 +100,7 @@  discard block
 block discarded – undo
96 100
 /**
97 101
    *convert shamsi year to gregorian year
98 102
    * @since Oct, 16 2015
103
+   * @param \DateTime $date_time
99 104
    * @return object
100 105
    */
101 106
 public function shamsiToGregorian( $date_time ) {
@@ -296,6 +301,7 @@  discard block
 block discarded – undo
296 301
   /**
297 302
     * convert ghamari year to gregorian year
298 303
     * @since Oct, 17 2015
304
+    * @param \DateTime $date_time
299 305
     * @return object
300 306
     */
301 307
   public function ghamariToGregorian( $date_time ) {
Please login to merge, or discard this patch.
src/Datium.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
 
61 61
     $this->config = include('Config.php');
62 62
 
63
-    $this->calendar_type = $this->config[ 'default_calendar' ];
63
+    $this->calendar_type = $this->config['default_calendar'];
64 64
 
65
-    date_default_timezone_set( $this->config['timezone'] );
65
+    date_default_timezone_set($this->config['timezone']);
66 66
 
67
-    switch( Datium::$call_type ) {
67
+    switch (Datium::$call_type) {
68 68
 
69 69
       case 'now':
70 70
 
71
-        $this->date_time = new DateTime( 'now' );
71
+        $this->date_time = new DateTime('now');
72 72
 
73 73
         $this->gregorian_DayofWeek = $this->date_time->format('w');
74 74
 
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 
79 79
       case 'make':
80 80
 
81
-        $this->date_time = new DateTime( 'now' );
81
+        $this->date_time = new DateTime('now');
82 82
 
83
-        $this->date_time->setDate( self::$array_date['year'], self::$array_date['month'], self::$array_date['day'] );
83
+        $this->date_time->setDate(self::$array_date['year'], self::$array_date['month'], self::$array_date['day']);
84 84
 
85
-        $this->date_time->setTime( self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second'] );
85
+        $this->date_time->setTime(self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second']);
86 86
 
87 87
         $this->gregorian_DayofWeek = $this->date_time->format('w');
88 88
 
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
 
117 117
     return (object) array(
118 118
 
119
-      'second' => $this->date_time->format( 's' ),
119
+      'second' => $this->date_time->format('s'),
120 120
 
121
-      'minute' => $this->date_time->format( 'm' ),
121
+      'minute' => $this->date_time->format('m'),
122 122
 
123
-      'hour' => $this->date_time->format( 'H' ),
123
+      'hour' => $this->date_time->format('H'),
124 124
 
125
-      'day' => $this->date_time->format( 'd' ),
125
+      'day' => $this->date_time->format('d'),
126 126
 
127
-      'month' => $this->date_time->format( 'm' ),
127
+      'month' => $this->date_time->format('m'),
128 128
 
129
-      'year' => $this->date_time->format( 'Y' )
129
+      'year' => $this->date_time->format('Y')
130 130
 
131 131
     );
132 132
 
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
    * @param $second integer
156 156
    * @return object
157 157
    */
158
-  public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) {
158
+  public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) {
159 159
 
160 160
       /**
161 161
        * When we want to set a Datetime object to Datium
162 162
        */
163
-      if( func_num_args() === 1 ) {
163
+      if (func_num_args() === 1) {
164 164
 
165 165
         self::$static_date_time = func_get_arg(0);
166 166
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
       } else {
170 170
 
171
-        self::$array_date = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second );
171
+        self::$array_date = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second);
172 172
 
173 173
         self::$call_type = 'make';
174 174
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
   }
180 180
 
181
-  public static function between( $date_start, $date_end ) {
181
+  public static function between($date_start, $date_end) {
182 182
 
183 183
     self::$date_start = $date_start;
184 184
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 
191 191
   }
192 192
 
193
-  public function to( $calendar ) {
193
+  public function to($calendar) {
194 194
 
195
-    $this->convert = new Convert( $this->date_time );
195
+    $this->convert = new Convert($this->date_time);
196 196
 
197
-    $this->date_time = $this->convert->to( $calendar );
197
+    $this->date_time = $this->convert->to($calendar);
198 198
 
199 199
     return $this;
200 200
 
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
    * @param $start datetime
207 207
    * @param $end datetime
208 208
    */
209
-  public static function diff( $start, $end ) {
209
+  public static function diff($start, $end) {
210 210
 
211
-    return date_diff( $start, $end );
211
+    return date_diff($start, $end);
212 212
 
213 213
   }
214 214
 
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
    * @param $value string
218 218
    * @return object
219 219
    */
220
-  public function add( $value ) {
220
+  public function add($value) {
221 221
 
222
-    $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value );
222
+    $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value);
223 223
 
224
-    $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression );
224
+    $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression);
225 225
 
226
-    $this->date_time->add( new DateInterval( $this->date_interval_expression ) );
226
+    $this->date_time->add(new DateInterval($this->date_interval_expression));
227 227
 
228 228
     return $this;
229 229
 
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
    * @param $value
235 235
    * @return obejct
236 236
    */
237
-  public function sub( $value ) {
237
+  public function sub($value) {
238 238
 
239
-    $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value );
239
+    $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value);
240 240
 
241
-    $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression );
241
+    $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression);
242 242
 
243
-    $this->date_time->sub( new DateInterval( $this->date_interval_expression ) );
243
+    $this->date_time->sub(new DateInterval($this->date_interval_expression));
244 244
 
245 245
     return $this;
246 246
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
    * Check if current year is leap or not
251 251
    * @return boolean
252 252
    */
253
-  public function leap( $type = 'gr') {
253
+  public function leap($type = 'gr') {
254 254
 
255
-    $this->leap = new Leap( $this->date_time->format( 'Y' ), $type );
255
+    $this->leap = new Leap($this->date_time->format('Y'), $type);
256 256
 
257 257
     return $this->leap;
258 258
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
    */
264 264
   public function dayOf() {
265 265
 
266
-    $this->day_of = new DayOf( $this->date_time, $this->calendar_type );
266
+    $this->day_of = new DayOf($this->date_time, $this->calendar_type);
267 267
 
268 268
     return $this->day_of;
269 269
 
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
    */
275 275
   public function events() {
276 276
 
277
-    if ( Datium::$call_type == 'between' ) {
277
+    if (Datium::$call_type == 'between') {
278 278
 
279
-      $this->events = new Events( Datium::$date_start, Datium::$date_end );
279
+      $this->events = new Events(Datium::$date_start, Datium::$date_end);
280 280
 
281 281
     } else {
282 282
 
283
-      $this->events = new Events( $this->date_time );
283
+      $this->events = new Events($this->date_time);
284 284
 
285 285
     }
286 286
 
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 
289 289
   }
290 290
 
291
-  public function translate( $calendar, $format ) {
291
+  public function translate($calendar, $format) {
292 292
 
293
-    $this->date_time = new Translate( $this->date_time, $calendar, $format, $this->gregorian_DayofWeek );
293
+    $this->date_time = new Translate($this->date_time, $calendar, $format, $this->gregorian_DayofWeek);
294 294
 
295 295
     return $this->date_time;
296 296
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
    *
306 306
    *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
307 307
    */
308
-  public function object(){
308
+  public function object() {
309 309
 
310 310
     return $this->date_time;
311 311
 
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
    * @param $calendar string
318 318
    * @param $format string
319 319
    */
320
-  public function get( $format = 'Y-m-d H:i:s' ) {
320
+  public function get($format = 'Y-m-d H:i:s') {
321 321
 
322
-    if( in_array( $this->calendar_type, $this->config[ 'calendar' ] ) ){
322
+    if (in_array($this->calendar_type, $this->config['calendar'])) {
323 323
 
324
-        return $this->translate( $this->calendar_type, $format )->get();
324
+        return $this->translate($this->calendar_type, $format)->get();
325 325
 
326 326
     }
327 327
 
Please login to merge, or discard this patch.