Completed
Push — master ( 884d53...078d33 )
by mehdi
02:37
created
src/Leap.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Translate.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/lang/fa/general.php 1 patch
Spacing   +2 added lines, -2 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( 'nowruz' => 'عید نوروز',
5
+       'events' => array('nowruz' => 'عید نوروز',
6 6
 
7 7
                           'iran_national_day' => 'روز جمهوری اسلامی',
8 8
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                                     'شنبه',
35 35
                                   ),
36 36
 
37
-        'number' => array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'),
37
+        'number' => array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'),
38 38
 
39 39
   );
40 40
 
Please login to merge, or discard this patch.
test.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -3,66 +3,66 @@
 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' );
8
+require_once('vendor/autoload.php');
9 9
 
10
-var_dump( Datium::now()->to( 'shamsi' )->get() );
11
-var_dump( Datium::create( Datium::now()->object() )->get() );
10
+var_dump(Datium::now()->to('shamsi')->get());
11
+var_dump(Datium::create(Datium::now()->object())->get());
12 12
 echo '<br>this year:<br>';
13
-var_dump( Datium::now()->toShamsi()->get( 'l jS F Y h:i:s A' ) );
13
+var_dump(Datium::now()->toShamsi()->get('l jS F Y h:i:s A'));
14 14
 echo "<br>";
15
-var_dump( Datium::now()->toShamsi()->sub('3 year')->get() );
15
+var_dump(Datium::now()->toShamsi()->sub('3 year')->get());
16 16
 echo "<br>";
17
-var_dump( Datium::now()->toShamsi()->add('3 year')->get() );
17
+var_dump(Datium::now()->toShamsi()->add('3 year')->get());
18 18
 echo "<br>";
19
-var_dump( Datium::now()->toGregorian()->get( 'l jS F Y h:i:s A' ) );
19
+var_dump(Datium::now()->toGregorian()->get('l jS F Y h:i:s A'));
20 20
 echo "<br>Leap year ";
21
-var_dump( Datium::now()->leap()->get() );
21
+var_dump(Datium::now()->leap()->get());
22 22
 echo "<br>Create new DateTime: ";
23
-var_dump( Datium::create(2000, 1, 1, 0, 0, 0)->get() );
23
+var_dump(Datium::create(2000, 1, 1, 0, 0, 0)->get());
24 24
 echo "<br>";
25 25
 echo 'Is next year leap? ';
26
-var_dump( Datium::now()->add('1 year')->leap()->get() );
26
+var_dump(Datium::now()->add('1 year')->leap()->get());
27 27
 echo "<br>";
28 28
 echo "Day of Year in gregorian:";
29 29
 echo "<br>";
30
-var_dump( Datium::now()->toGregorian()->dayOf()->year() );
30
+var_dump(Datium::now()->toGregorian()->dayOf()->year());
31 31
 echo "<br>";
32 32
 echo "Day of Year in shamsi:";
33 33
 echo "<br>";
34
-var_dump( Datium::now()->toShamsi()->dayOf()->year() );
34
+var_dump(Datium::now()->toShamsi()->dayOf()->year());
35 35
 echo "<br>";
36 36
 echo "Day of Year in ghamari:";
37 37
 echo "<br>";
38
-var_dump( Datium::now()->toGhamari()->dayOf()->year() );
38
+var_dump(Datium::now()->toGhamari()->dayOf()->year());
39 39
 echo "<br>";
40 40
 echo "Day of Week";
41 41
 echo "<br>";
42
-var_dump( Datium::now()->dayOf()->week() );
42
+var_dump(Datium::now()->dayOf()->week());
43 43
 echo "<br>";
44 44
 echo "Change date form gregorian to shamsi with method: ";
45
-var_dump( Datium::create( 1989, 10, 27 )->toShamsi()->get( 'l jS F Y h:i:s A' ) );
45
+var_dump(Datium::create(1989, 10, 27)->toShamsi()->get('l jS F Y h:i:s A'));
46 46
 echo "<br>";
47
-var_dump( Datium::now()->toGhamari()->get( 'l jS F Y h:i:s A' ) );
47
+var_dump(Datium::now()->toGhamari()->get('l jS F Y h:i:s A'));
48 48
 echo "<br>";
49 49
 echo "Change date form shamsi to gregorian with method: ";
50
-var_dump( Datium::create( 1357, 11, 22 )->toGregorian('ir')->get( 'l jS F Y h:i:s A' ) );
50
+var_dump(Datium::create(1357, 11, 22)->toGregorian('ir')->get('l jS F Y h:i:s A'));
51 51
 echo "<br>";
52 52
 echo "Change date form ghamari to gregorian with method: ";
53
-var_dump( Datium::create( 1437, 1, 1 )->toGregorian('gh')->get( 'l jS F Y h:i:s A' ) );
53
+var_dump(Datium::create(1437, 1, 1)->toGregorian('gh')->get('l jS F Y h:i:s A'));
54 54
 echo "<br>is persian holiday? ";
55
-var_dump(  Datium::between( Datium::now()->object() , Datium::now()->add( '3 month' )->object() )->events()->local( 'us' )->local( 'ir' )->get() );
55
+var_dump(Datium::between(Datium::now()->object(), Datium::now()->add('3 month')->object())->events()->local('us')->local('ir')->get());
56 56
 echo 'return international days';
57
-var_dump(  Datium::between( Datium::now()->object() , Datium::now()->add('4 month')->object() )->events()->international()->get() );
57
+var_dump(Datium::between(Datium::now()->object(), Datium::now()->add('4 month')->object())->events()->international()->get());
58 58
 // echo 'Today\'s events:';
59 59
 // var_dump( Datium::now()->events()->local( 'ir' )->get() );
60 60
 echo 'Date diff';
61
-$diff = Datium::diff( Datium::now()->object(), Datium::now()->add('5 day')->object() );
62
-var_dump( $diff->days );
61
+$diff = Datium::diff(Datium::now()->object(), Datium::now()->add('5 day')->object());
62
+var_dump($diff->days);
63 63
 
64
-} catch (Exception $e ) {
64
+} catch (Exception $e) {
65 65
 
66
-  var_dump( $e );
66
+  var_dump($e);
67 67
 
68 68
 }
Please login to merge, or discard this patch.