@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param $year integer |
| 26 | 26 | * @since Aug, 21 2015 |
| 27 | 27 | */ |
| 28 | - public function __construct( $year, $type = 'gr' ) { |
|
| 28 | + public function __construct($year, $type = 'gr') { |
|
| 29 | 29 | |
| 30 | 30 | $this->year = $year; |
| 31 | 31 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function gregorinLeapYear() { |
| 45 | 45 | |
| 46 | - return ( ( ( $this->year % 4 ) == 0 ) && ( ( ( $this->year % 100 ) != 0 ) || ( ( $this->year % 400 ) == 0 ) ) ); |
|
| 46 | + return ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0))); |
|
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $shamsi_years = 0; |
| 58 | 58 | |
| 59 | - while ( $shamsi_years < ( $this->year - 128 ) ) { |
|
| 59 | + while ($shamsi_years < ($this->year - 128)) { |
|
| 60 | 60 | |
| 61 | 61 | $shamsi_years += 128; |
| 62 | 62 | |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $this->result -= $shamsi_years; |
| 69 | 69 | |
| 70 | - if ( $this->result >= 33 ) { |
|
| 70 | + if ($this->result >= 33) { |
|
| 71 | 71 | |
| 72 | 72 | $this->result = $this->result % 33; |
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( ( $this->result == 28 ) || ( $this->result == 27 ) ) { |
|
| 76 | + if (($this->result == 28) || ($this->result == 27)) { |
|
| 77 | 77 | |
| 78 | 78 | return $this->result; |
| 79 | 79 | |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $this->result -= $shamsi_years; |
| 86 | 86 | |
| 87 | - if ( $this->result >= 33 ) { |
|
| 87 | + if ($this->result >= 33) { |
|
| 88 | 88 | |
| 89 | 89 | $this->result = $this->result % 33; |
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if ( ( ( $this->result % 4 ) == 0 ) && ( $this->result != 28 ) ) { |
|
| 93 | + if ((($this->result % 4) == 0) && ($this->result != 28)) { |
|
| 94 | 94 | |
| 95 | 95 | return $this->result; |
| 96 | 96 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $this->result = $this->year % 30; |
| 108 | 108 | |
| 109 | - if ( ( 2 == $this->result ) || ( 5 == $this->result ) || ( 7 == $this->result ) || ( 10 == $this->result ) || ( 13 == $this->result ) || ( 16 == $this->result ) || ( 18 == $this->result ) || ( 21 == $this->result ) || ( 24 == $this->year ) || ( 26 == $this->result ) || ( 29 == $this->result ) ) { |
|
| 109 | + if ((2 == $this->result) || (5 == $this->result) || (7 == $this->result) || (10 == $this->result) || (13 == $this->result) || (16 == $this->result) || (18 == $this->result) || (21 == $this->result) || (24 == $this->year) || (26 == $this->result) || (29 == $this->result)) { |
|
| 110 | 110 | |
| 111 | 111 | return $this->result; |
| 112 | 112 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function get() { |
| 123 | 123 | |
| 124 | - switch ( $this->type ) { |
|
| 124 | + switch ($this->type) { |
|
| 125 | 125 | |
| 126 | 126 | case 'gr': |
| 127 | 127 | |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected $gregorian_DayofWeek; |
| 20 | 20 | |
| 21 | - protected $english_number = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ); |
|
| 21 | + protected $english_number = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); |
|
| 22 | 22 | |
| 23 | - public function __construct( $date_time, $calendar, $format, $gregorian_DayofWeek ){ |
|
| 23 | + public function __construct($date_time, $calendar, $format, $gregorian_DayofWeek) { |
|
| 24 | 24 | |
| 25 | - $this->translate = include( 'lang/fa/general.php' ); |
|
| 25 | + $this->translate = include('lang/fa/general.php'); |
|
| 26 | 26 | |
| 27 | - $this->config = include( 'config.php' ); |
|
| 27 | + $this->config = include('config.php'); |
|
| 28 | 28 | |
| 29 | 29 | $this->date_time = $date_time; |
| 30 | 30 | |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - protected function format( $calendar, $format ) { |
|
| 41 | + protected function format($calendar, $format) { |
|
| 42 | 42 | |
| 43 | - $this->date_time = $this->date_time->format( $format ); |
|
| 43 | + $this->date_time = $this->date_time->format($format); |
|
| 44 | 44 | |
| 45 | - if( in_array( $calendar, $this->config['calendar'] ) ) { |
|
| 45 | + if (in_array($calendar, $this->config['calendar'])) { |
|
| 46 | 46 | |
| 47 | - switch( $calendar ){ |
|
| 47 | + switch ($calendar) { |
|
| 48 | 48 | |
| 49 | 49 | case 'ir': |
| 50 | 50 | |
@@ -74,25 +74,25 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | protected function translateToPersian() { |
| 76 | 76 | |
| 77 | - $this->date_time = str_replace( $this->config['month']['english'], $this->config['month']['persian'], $this->date_time ); |
|
| 77 | + $this->date_time = str_replace($this->config['month']['english'], $this->config['month']['persian'], $this->date_time); |
|
| 78 | 78 | |
| 79 | - $this->date_time = str_replace( $this->config['week_days_name']['english'], $this->config['week_days_name']['persian'][$this->gregorian_DayofWeek], $this->date_time ); |
|
| 79 | + $this->date_time = str_replace($this->config['week_days_name']['english'], $this->config['week_days_name']['persian'][$this->gregorian_DayofWeek], $this->date_time); |
|
| 80 | 80 | |
| 81 | - $this->date_time = str_replace( $this->english_number , $this->translate['number'], $this->date_time ); |
|
| 81 | + $this->date_time = str_replace($this->english_number, $this->translate['number'], $this->date_time); |
|
| 82 | 82 | |
| 83 | - $this->date_time = str_replace( $this->config['month']['persian'], $this->translate['month'], $this->date_time ); |
|
| 83 | + $this->date_time = str_replace($this->config['month']['persian'], $this->translate['month'], $this->date_time); |
|
| 84 | 84 | |
| 85 | - $this->date_time = str_replace( $this->config['week_days_name']['persian'], $this->translate['week_days_name'], $this->date_time ); |
|
| 85 | + $this->date_time = str_replace($this->config['week_days_name']['persian'], $this->translate['week_days_name'], $this->date_time); |
|
| 86 | 86 | |
| 87 | - $this->date_time = str_replace( 'th', 'ام', $this->date_time ); |
|
| 87 | + $this->date_time = str_replace('th', 'ام', $this->date_time); |
|
| 88 | 88 | |
| 89 | - $this->date_time = str_replace( 'AM', 'قبل از ظهر', $this->date_time ); |
|
| 89 | + $this->date_time = str_replace('AM', 'قبل از ظهر', $this->date_time); |
|
| 90 | 90 | |
| 91 | - $this->date_time = str_replace( 'am', 'ق.ظ', $this->date_time ); |
|
| 91 | + $this->date_time = str_replace('am', 'ق.ظ', $this->date_time); |
|
| 92 | 92 | |
| 93 | - $this->date_time = str_replace( 'PM', 'بعد از ظهر', $this->date_time ); |
|
| 93 | + $this->date_time = str_replace('PM', 'بعد از ظهر', $this->date_time); |
|
| 94 | 94 | |
| 95 | - $this->date_time = str_replace( 'pm', 'ب.ظ', $this->date_time ); |
|
| 95 | + $this->date_time = str_replace('pm', 'ب.ظ', $this->date_time); |
|
| 96 | 96 | |
| 97 | 97 | return $this->date_time; |
| 98 | 98 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | protected function translateToArabic() { |
| 102 | 102 | |
| 103 | - $this->date_time = str_replace( $this->config['month']['english'], $this->config['month']['islamic'], $this->date_time ); |
|
| 103 | + $this->date_time = str_replace($this->config['month']['english'], $this->config['month']['islamic'], $this->date_time); |
|
| 104 | 104 | |
| 105 | - $this->date_time = str_replace( $this->config['week_days_name']['english'], $this->config['week_days_name']['islamic'][$this->gregorian_DayofWeek], $this->date_time ); |
|
| 105 | + $this->date_time = str_replace($this->config['week_days_name']['english'], $this->config['week_days_name']['islamic'][$this->gregorian_DayofWeek], $this->date_time); |
|
| 106 | 106 | |
| 107 | 107 | return $this->date_time; |
| 108 | 108 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function get() |
| 118 | 118 | { |
| 119 | - return $this->format( $this->calendar, $this->format ); |
|
| 119 | + return $this->format($this->calendar, $this->format); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'nowruz' => 'عید نوروز', |
|
| 5 | + 'events' => array('nowruz' => 'عید نوروز', |
|
| 6 | 6 | |
| 7 | 7 | 'iran_national_day' => 'روز جمهوری اسلامی', |
| 8 | 8 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | 'شنبه', |
| 35 | 35 | ), |
| 36 | 36 | |
| 37 | - 'number' => array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'), |
|
| 37 | + 'number' => array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'), |
|
| 38 | 38 | |
| 39 | 39 | ); |
| 40 | 40 | |
@@ -3,65 +3,65 @@ |
||
| 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( 'src/autoload.php' ); |
|
| 9 | -var_dump( Datium::now()->to( 'shamsi' )->get() ); |
|
| 10 | -var_dump( Datium::create( Datium::now()->object() )->get() ); |
|
| 8 | +require_once('src/autoload.php'); |
|
| 9 | +var_dump(Datium::now()->to('shamsi')->get()); |
|
| 10 | +var_dump(Datium::create(Datium::now()->object())->get()); |
|
| 11 | 11 | echo '<br>this year:<br>'; |
| 12 | -var_dump( Datium::now()->toShamsi()->get( 'l jS F Y h:i:s A' ) ); |
|
| 12 | +var_dump(Datium::now()->toShamsi()->get('l jS F Y h:i:s A')); |
|
| 13 | 13 | echo "<br>"; |
| 14 | -var_dump( Datium::now()->toShamsi()->sub('3 year')->get() ); |
|
| 14 | +var_dump(Datium::now()->toShamsi()->sub('3 year')->get()); |
|
| 15 | 15 | echo "<br>"; |
| 16 | -var_dump( Datium::now()->toShamsi()->add('3 year')->get() ); |
|
| 16 | +var_dump(Datium::now()->toShamsi()->add('3 year')->get()); |
|
| 17 | 17 | echo "<br>"; |
| 18 | -var_dump( Datium::now()->toGregorian()->get( 'l jS F Y h:i:s A' ) ); |
|
| 18 | +var_dump(Datium::now()->toGregorian()->get('l jS F Y h:i:s A')); |
|
| 19 | 19 | echo "<br>Leap year "; |
| 20 | -var_dump( Datium::now()->leap()->get() ); |
|
| 20 | +var_dump(Datium::now()->leap()->get()); |
|
| 21 | 21 | echo "<br>Create new DateTime: "; |
| 22 | -var_dump( Datium::create(2000, 1, 1, 0, 0, 0)->get() ); |
|
| 22 | +var_dump(Datium::create(2000, 1, 1, 0, 0, 0)->get()); |
|
| 23 | 23 | echo "<br>"; |
| 24 | 24 | echo 'Is next year leap? '; |
| 25 | -var_dump( Datium::now()->add('1 year')->leap()->get() ); |
|
| 25 | +var_dump(Datium::now()->add('1 year')->leap()->get()); |
|
| 26 | 26 | echo "<br>"; |
| 27 | 27 | echo "Day of Year in gregorian:"; |
| 28 | 28 | echo "<br>"; |
| 29 | -var_dump( Datium::now()->toGregorian()->dayOf()->year() ); |
|
| 29 | +var_dump(Datium::now()->toGregorian()->dayOf()->year()); |
|
| 30 | 30 | echo "<br>"; |
| 31 | 31 | echo "Day of Year in shamsi:"; |
| 32 | 32 | echo "<br>"; |
| 33 | -var_dump( Datium::now()->toShamsi()->dayOf()->year() ); |
|
| 33 | +var_dump(Datium::now()->toShamsi()->dayOf()->year()); |
|
| 34 | 34 | echo "<br>"; |
| 35 | 35 | echo "Day of Year in ghamari:"; |
| 36 | 36 | echo "<br>"; |
| 37 | -var_dump( Datium::now()->toGhamari()->dayOf()->year() ); |
|
| 37 | +var_dump(Datium::now()->toGhamari()->dayOf()->year()); |
|
| 38 | 38 | echo "<br>"; |
| 39 | 39 | echo "Day of Week"; |
| 40 | 40 | echo "<br>"; |
| 41 | -var_dump( Datium::now()->dayOf()->week() ); |
|
| 41 | +var_dump(Datium::now()->dayOf()->week()); |
|
| 42 | 42 | echo "<br>"; |
| 43 | 43 | echo "Change date form gregorian to shamsi with method: "; |
| 44 | -var_dump( Datium::create( 1989, 10, 27 )->toShamsi()->get( 'l jS F Y h:i:s A' ) ); |
|
| 44 | +var_dump(Datium::create(1989, 10, 27)->toShamsi()->get('l jS F Y h:i:s A')); |
|
| 45 | 45 | echo "<br>"; |
| 46 | -var_dump( Datium::now()->toGhamari()->get( 'l jS F Y h:i:s A' ) ); |
|
| 46 | +var_dump(Datium::now()->toGhamari()->get('l jS F Y h:i:s A')); |
|
| 47 | 47 | echo "<br>"; |
| 48 | 48 | echo "Change date form shamsi to gregorian with method: "; |
| 49 | -var_dump( Datium::create( 1357, 11, 22 )->toGregorian('ir')->get( 'l jS F Y h:i:s A' ) ); |
|
| 49 | +var_dump(Datium::create(1357, 11, 22)->toGregorian('ir')->get('l jS F Y h:i:s A')); |
|
| 50 | 50 | echo "<br>"; |
| 51 | 51 | echo "Change date form ghamari to gregorian with method: "; |
| 52 | -var_dump( Datium::create( 1437, 1, 1 )->toGregorian('gh')->get( 'l jS F Y h:i:s A' ) ); |
|
| 52 | +var_dump(Datium::create(1437, 1, 1)->toGregorian('gh')->get('l jS F Y h:i:s A')); |
|
| 53 | 53 | echo "<br>is persian holiday? "; |
| 54 | -var_dump( Datium::between( Datium::now()->object() , Datium::now()->add( '3 month' )->object() )->events()->local( 'us' )->local( 'ir' )->get() ); |
|
| 54 | +var_dump(Datium::between(Datium::now()->object(), Datium::now()->add('3 month')->object())->events()->local('us')->local('ir')->get()); |
|
| 55 | 55 | echo 'return international days'; |
| 56 | -var_dump( Datium::between( Datium::now()->object() , Datium::now()->add('4 month')->object() )->events()->international()->get() ); |
|
| 56 | +var_dump(Datium::between(Datium::now()->object(), Datium::now()->add('4 month')->object())->events()->international()->get()); |
|
| 57 | 57 | // echo 'Today\'s events:'; |
| 58 | 58 | // var_dump( Datium::now()->events()->local( 'ir' )->get() ); |
| 59 | 59 | echo 'Date diff'; |
| 60 | -$diff = Datium::diff( Datium::now()->object(), Datium::now()->add('5 day')->object() ); |
|
| 61 | -var_dump( $diff->days ); |
|
| 60 | +$diff = Datium::diff(Datium::now()->object(), Datium::now()->add('5 day')->object()); |
|
| 61 | +var_dump($diff->days); |
|
| 62 | 62 | |
| 63 | -} catch (Exception $e ) { |
|
| 63 | +} catch (Exception $e) { |
|
| 64 | 64 | |
| 65 | - var_dump( $e ); |
|
| 65 | + var_dump($e); |
|
| 66 | 66 | |
| 67 | 67 | } |