@@ -63,6 +63,10 @@ |
||
| 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 ) { |
@@ -112,7 +112,9 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | foreach ( $this->config['shamsi_month_days'] as $month => $value ) { |
| 114 | 114 | |
| 115 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 115 | + if( $this->month > $month ) { |
|
| 116 | + $days_of_year += $value; |
|
| 117 | + } |
|
| 116 | 118 | |
| 117 | 119 | } |
| 118 | 120 | |
@@ -128,9 +130,7 @@ discard block |
||
| 128 | 130 | |
| 129 | 131 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 621 ) / 4 ) ); |
| 130 | 132 | |
| 131 | -} |
|
| 132 | - |
|
| 133 | -elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 133 | +} elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 134 | 134 | |
| 135 | 135 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 622 ) / 4 ) ); |
| 136 | 136 | |
@@ -142,7 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
| 144 | 144 | |
| 145 | - if ( $gregorian_month < $value ) break; |
|
| 145 | + if ( $gregorian_month < $value ) { |
|
| 146 | + break; |
|
| 147 | + } |
|
| 146 | 148 | |
| 147 | 149 | $gregorian_month -= $value; |
| 148 | 150 | } |
@@ -185,7 +187,9 @@ discard block |
||
| 185 | 187 | |
| 186 | 188 | $this->leap = new Leap( $this->year ); |
| 187 | 189 | |
| 188 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
| 190 | + if( $this->leap->get() && $this->month > 11 ) { |
|
| 191 | + $this->temp_day++; |
|
| 192 | + } |
|
| 189 | 193 | |
| 190 | 194 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
| 191 | 195 | |
@@ -258,7 +262,9 @@ discard block |
||
| 258 | 262 | |
| 259 | 263 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
| 260 | 264 | |
| 261 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 265 | + if( $this->month > $month ) { |
|
| 266 | + $days_of_year += $value; |
|
| 267 | + } |
|
| 262 | 268 | |
| 263 | 269 | } |
| 264 | 270 | |
@@ -278,7 +284,9 @@ discard block |
||
| 278 | 284 | |
| 279 | 285 | foreach ($this->config['shamsi_month_days'] as $month => $value) { |
| 280 | 286 | |
| 281 | - if ( $shamsi_month < $value ) break; |
|
| 287 | + if ( $shamsi_month < $value ) { |
|
| 288 | + break; |
|
| 289 | + } |
|
| 282 | 290 | |
| 283 | 291 | $shamsi_month -= $value; |
| 284 | 292 | } |
@@ -312,7 +320,9 @@ discard block |
||
| 312 | 320 | |
| 313 | 321 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
| 314 | 322 | |
| 315 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 323 | + if( $this->month > $month ) { |
|
| 324 | + $days_of_year += $value; |
|
| 325 | + } |
|
| 316 | 326 | |
| 317 | 327 | } |
| 318 | 328 | |
@@ -332,7 +342,9 @@ discard block |
||
| 332 | 342 | |
| 333 | 343 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
| 334 | 344 | |
| 335 | - if ( $gregorian_month < $value ) break; |
|
| 345 | + if ( $gregorian_month < $value ) { |
|
| 346 | + break; |
|
| 347 | + } |
|
| 336 | 348 | |
| 337 | 349 | $gregorian_month -= $value; |
| 338 | 350 | } |
@@ -56,6 +56,10 @@ |
||
| 56 | 56 | * |
| 57 | 57 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
| 58 | 58 | */ |
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @param string $path |
|
| 62 | + */ |
|
| 59 | 63 | private function fetch( $path ) { |
| 60 | 64 | |
| 61 | 65 | $this->events = include( $path ); |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | /** |
| 101 | 101 | * check the ghamari year is leap or not |
| 102 | 102 | * @since Oct, 24 2015 |
| 103 | - * @return boolean |
|
| 103 | + * @return integer|null |
|
| 104 | 104 | */ |
| 105 | 105 | public function ghamariLeapYear() { |
| 106 | 106 | |
@@ -341,6 +341,10 @@ |
||
| 341 | 341 | return $file; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $class |
|
| 346 | + * @param string $ext |
|
| 347 | + */ |
|
| 344 | 348 | private function findFileWithExtension($class, $ext) |
| 345 | 349 | { |
| 346 | 350 | // PSR-4 lookup |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $leap = new Datium\Tools\Leap( $year ); |
| 36 | 36 | |
| 37 | - if( $leap->get() && $month > 11 ) $temp_day++; |
|
| 37 | + if( $leap->get() && $month > 11 ) { |
|
| 38 | + $temp_day++; |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
| 40 | 42 | |
@@ -110,7 +112,9 @@ discard block |
||
| 110 | 112 | |
| 111 | 113 | foreach ( $config['month_days_number'] as $month => $value ) { |
| 112 | 114 | |
| 113 | - if( $month > $month ) $days_of_year += $value; |
|
| 115 | + if( $month > $month ) { |
|
| 116 | + $days_of_year += $value; |
|
| 117 | + } |
|
| 114 | 118 | |
| 115 | 119 | } |
| 116 | 120 | |
@@ -138,7 +138,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -358,11 +358,13 @@ |
||
| 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 | |
@@ -51,17 +51,19 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $leap = new Leap( $year ); |
| 53 | 53 | |
| 54 | - if( $leap->get() && $month > 2 ) $temp_day++; |
|
| 54 | + if( $leap->get() && $month > 2 ) { |
|
| 55 | + $temp_day++; |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | if ( $temp_day <= 79 ) { |
| 57 | 59 | |
| 58 | - if( ( $year - 1 ) % 4 == 0 ) |
|
| 59 | - |
|
| 60 | + if( ( $year - 1 ) % 4 == 0 ) { |
|
| 61 | + |
|
| 60 | 62 | $temp_day = $temp_day + 11; |
| 61 | - |
|
| 62 | - else |
|
| 63 | - |
|
| 63 | + } else { |
|
| 64 | + |
|
| 64 | 65 | $temp_day = $temp_day + 10; |
| 66 | + } |
|
| 65 | 67 | |
| 66 | 68 | $year = $year - 622; |
| 67 | 69 | |
@@ -71,9 +73,7 @@ discard block |
||
| 71 | 73 | |
| 72 | 74 | $day = 30; |
| 73 | 75 | |
| 74 | - } |
|
| 75 | - |
|
| 76 | - else { |
|
| 76 | + } else { |
|
| 77 | 77 | |
| 78 | 78 | $month = ( $temp_day / 30 ) + 10; |
| 79 | 79 | |
@@ -81,9 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - } |
|
| 85 | - |
|
| 86 | - else { |
|
| 84 | + } else { |
|
| 87 | 85 | |
| 88 | 86 | $year = $year - 621; |
| 89 | 87 | |
@@ -96,18 +94,14 @@ discard block |
||
| 96 | 94 | $month = ( $temp_day / 31 ); |
| 97 | 95 | |
| 98 | 96 | $day = 31; |
| 99 | - } |
|
| 100 | - |
|
| 101 | - else { |
|
| 97 | + } else { |
|
| 102 | 98 | |
| 103 | 99 | $month = ( $temp_day / 31 ) + 1; |
| 104 | 100 | |
| 105 | 101 | $day = ( $temp_day % 31 ); |
| 106 | 102 | } |
| 107 | 103 | |
| 108 | - } |
|
| 109 | - |
|
| 110 | - else { |
|
| 104 | + } else { |
|
| 111 | 105 | |
| 112 | 106 | $temp_day = $temp_day - 186; |
| 113 | 107 | |
@@ -117,9 +111,7 @@ discard block |
||
| 117 | 111 | |
| 118 | 112 | $day = 30; |
| 119 | 113 | |
| 120 | - } |
|
| 121 | - |
|
| 122 | - else { |
|
| 114 | + } else { |
|
| 123 | 115 | |
| 124 | 116 | $month = ( $temp_day / 30 ) + 7; |
| 125 | 117 | |
@@ -159,7 +151,9 @@ discard block |
||
| 159 | 151 | |
| 160 | 152 | foreach ( $config['month_days_number'] as $mon => $value ) { |
| 161 | 153 | |
| 162 | - if( $month > $mon ) $days_of_year += $value; |
|
| 154 | + if( $month > $mon ) { |
|
| 155 | + $days_of_year += $value; |
|
| 156 | + } |
|
| 163 | 157 | |
| 164 | 158 | } |
| 165 | 159 | |
@@ -175,9 +169,7 @@ discard block |
||
| 175 | 169 | |
| 176 | 170 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 621 ) / 4 ) ); |
| 177 | 171 | |
| 178 | - } |
|
| 179 | - |
|
| 180 | - elseif ( ( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) { |
|
| 172 | + } elseif ( ( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) { |
|
| 181 | 173 | |
| 182 | 174 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 622 ) / 4 ) ); |
| 183 | 175 | |
@@ -191,7 +183,9 @@ discard block |
||
| 191 | 183 | |
| 192 | 184 | foreach ( $config['month_days_number'] as $month => $value ) { |
| 193 | 185 | |
| 194 | - if ( $gregorian_month < $value ) break; |
|
| 186 | + if ( $gregorian_month < $value ) { |
|
| 187 | + break; |
|
| 188 | + } |
|
| 195 | 189 | |
| 196 | 190 | $gregorian_month -= $value; |
| 197 | 191 | } |
@@ -302,7 +296,9 @@ discard block |
||
| 302 | 296 | |
| 303 | 297 | foreach( $config['month_days_number'] as $_month => $value ) { |
| 304 | 298 | |
| 305 | - if ( $_month < $month ) $result += $value; |
|
| 299 | + if ( $_month < $month ) { |
|
| 300 | + $result += $value; |
|
| 301 | + } |
|
| 306 | 302 | |
| 307 | 303 | } |
| 308 | 304 | |
@@ -137,7 +137,9 @@ discard block |
||
| 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 |
||
| 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 | |