Completed
Push — master ( eaa02d...91cedd )
by mehdi
02:17
created
src/Events/Events.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php namespace Datium;
2 2
 
3 3
 use Datium\Tools\Convert;
4
-use Datium\Tools\DayOf;
5 4
 use DateTime;
6 5
 use DateInterval;
7 6
 use DatePeriod;
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -58,6 +58,10 @@
 block discarded – undo
58 58
     *
59 59
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
60 60
     */
61
+
62
+    /**
63
+     * @param string $path
64
+     */
61 65
     private function fetch( $path ) 
62 66
     {
63 67
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
         $this->period = new DatePeriod(Events::$date_start, $this->interval, Events::$date_end);
65 65
 
66 66
         foreach ($this->period as $dt) {
67
-            if (isset($this->events[ 'events' ][ intval($dt->format('m')) ][ intval($dt->format('d')) ])) {
68
-                $this->result[ $dt->format('Y-m-d') ][] = $this->events[ 'events' ][ intval($dt->format('m')) ][ intval($dt->format('d')) ];
67
+            if (isset($this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))])) {
68
+                $this->result[$dt->format('Y-m-d')][] = $this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))];
69 69
             }
70 70
         }
71 71
 
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
     public function get()
84 84
     {
85 85
 
86
-        if (! empty($this->result)) {
86
+        if ( ! empty($this->result)) {
87 87
             foreach ($this->result as $key => $day) {
88
-                if (! ( $key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d') )) {
89
-                    unset($this->result[ $key ]);
88
+                if ( ! ($key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d'))) {
89
+                    unset($this->result[$key]);
90 90
                 }
91 91
             }
92 92
         } else {
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
          */
116 116
         $country_code = strtolower($country_code = 'ir');
117 117
 
118
-        $this->local = include 'Localization/' . $country_code . '.php';
118
+        $this->local = include 'Localization/'.$country_code.'.php';
119 119
 
120
-        foreach ($this->local[ 'events' ] as $month => $events) {
120
+        foreach ($this->local['events'] as $month => $events) {
121 121
             foreach ($events as $day => $event) {
122 122
                 $this->date_time = new DateTime();
123 123
 
124 124
                 $this->date_time->setDate(Events::$date_start->format('Y'), $month, $day);
125 125
 
126
-                switch ($this->local[ 'default_calendar' ]) {
126
+                switch ($this->local['default_calendar']) {
127 127
                     case 'jalali':
128 128
                         $this->date_time->setDate(1394, $month, $day);
129 129
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                         break;
138 138
                 }
139 139
 
140
-                $this->result[ $this->date_time->format('Y-m-d') ][] =  $event;
140
+                $this->result[$this->date_time->format('Y-m-d')][] = $event;
141 141
             }
142 142
         }
143 143
 
Please login to merge, or discard this patch.
src/Leap.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -7,42 +7,42 @@  discard block
 block discarded – undo
7 7
 {
8 8
 
9 9
     /**
10
-   * @param integer store year value
11
-   */
10
+     * @param integer store year value
11
+     */
12 12
     protected $year;
13 13
 
14 14
     /**
15
-   * @param string store type of year value
16
-   */
15
+     * @param string store type of year value
16
+     */
17 17
     protected $type;
18 18
 
19 19
     /**
20
-   * @param boolean store result of leap functions
21
-   */
20
+     * @param boolean store result of leap functions
21
+     */
22 22
     protected $result;
23 23
 
24 24
 
25 25
     /**
26
-   * @param $year integer
27
-   * @since Aug, 21 2015
28
-   */
26
+     * @param $year integer
27
+     * @since Aug, 21 2015
28
+     */
29 29
     public function __construct( $year, $type = 'gregorian' ) 
30 30
     {
31 31
 
32
-         $this->year = $year;
32
+          $this->year = $year;
33 33
 
34
-         $this->type = $type;
34
+          $this->type = $type;
35 35
 
36
-         return $this;
36
+          return $this;
37 37
 
38 38
     }
39 39
 
40 40
     /**
41
-   * check the gregorian year is leap or not
42
-   *
43
-   * @since  Oct, 24 2015
44
-   * @return boolean
45
-   */
41
+     * check the gregorian year is leap or not
42
+     *
43
+     * @since  Oct, 24 2015
44
+     * @return boolean
45
+     */
46 46
     public function gregorinLeapYear() 
47 47
     {
48 48
 
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     /**
54
-   * check the jalali year is leap or not
55
-   *
56
-   * @since  Oct, 24 2015
57
-   * @return boolean
58
-   */
54
+     * check the jalali year is leap or not
55
+     *
56
+     * @since  Oct, 24 2015
57
+     * @return boolean
58
+     */
59 59
     public function jalaliLeapYear() 
60 60
     {
61 61
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
     /**
106
-   * check the hijri year is leap or not
107
-   *
108
-   * @since  Oct, 24 2015
109
-   * @return boolean
110
-   */
106
+     * check the hijri year is leap or not
107
+     *
108
+     * @since  Oct, 24 2015
109
+     * @return boolean
110
+     */
111 111
     public function hijriLeapYear() 
112 112
     {
113 113
 
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
     }
123 123
 
124 124
     /**
125
-   * return the year is leap or not
126
-   *
127
-   * @since  Aug, 21 2015
128
-   * @return boolean
129
-   */
125
+     * return the year is leap or not
126
+     *
127
+     * @since  Aug, 21 2015
128
+     * @return boolean
129
+     */
130 130
     public function get() 
131 131
     {
132 132
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function gregorinLeapYear()
47 47
     {
48 48
 
49
-        return ( ( ( $this->year % 4 ) == 0 ) && ( ( ( $this->year % 100 ) != 0 ) || ( ( $this->year % 400 ) == 0 ) ) );
49
+        return ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0)));
50 50
 
51 51
     }
52 52
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         $jalali_years = 0;
63 63
 
64
-        while ($jalali_years < ( $this->year - 128 )) {
64
+        while ($jalali_years < ($this->year - 128)) {
65 65
             $jalali_years += 128;
66 66
         }
67 67
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $this->result = $this->result % 33;
75 75
         }
76 76
 
77
-        if (( $this->result == 28 ) || ( $this->result == 27 )) {
77
+        if (($this->result == 28) || ($this->result == 27)) {
78 78
             return $this->result;
79 79
         }
80 80
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             $this->result = $this->result % 33;
88 88
         }
89 89
 
90
-        if (( ( $this->result % 4 ) == 0 ) && ( $this->result != 28 )) {
90
+        if ((($this->result % 4) == 0) && ($this->result != 28)) {
91 91
             return $this->result;
92 92
         }
93 93
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
         $this->result = $this->year % 30;
105 105
 
106
-        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 )) {
106
+        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)) {
107 107
             return $this->result;
108 108
         }
109 109
 
Please login to merge, or discard this patch.
src/Events/Global/global.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      * @link http://www.un.org/en/sections/observances/international-days/
14 14
      */
15 15
     'events' => array(
16
-      1 => array( 27 => 'International Day of Commemoration in Memory of the Victims of the Holocaust' ),
16
+      1 => array(27 => 'International Day of Commemoration in Memory of the Victims of the Holocaust'),
17 17
       2 => array(
18 18
         4 => 'World Cancer Day',
19 19
         6 => 'International Day of Zero Tolerance to Female Genital Mutilation',
Please login to merge, or discard this patch.
src/Events/Localization/ir.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
      * as a arraye value
13 13
      */
14 14
     'events' => array(
15
-      1 => array( 1 => 'nowruz', 2 => 'nowruz', 3 => 'nowruz', 5 => 'nowruz' ),
16
-      10 => array( 22 => 'Iran revelution day' ),
17
-      12 => array( 29 => 'Iran oil national day' )
15
+      1 => array(1 => 'nowruz', 2 => 'nowruz', 3 => 'nowruz', 5 => 'nowruz'),
16
+      10 => array(22 => 'Iran revelution day'),
17
+      12 => array(29 => 'Iran oil national day')
18 18
     ),
19 19
 
20 20
 );
Please login to merge, or discard this patch.
src/Events/Localization/us.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 
10 10
   'events' => array(
11 11
 
12
-    4  => array( 22 => 'Earth day' ),
12
+    4  => array(22 => 'Earth day'),
13 13
 
14
-    12 => array( 25 => 'Christmas' )
14
+    12 => array(25 => 'Christmas')
15 15
 
16 16
   )
17 17
 
Please login to merge, or discard this patch.
src/lang/fa/general.php 2 patches
Indentation   +11 added lines, -11 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
 
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
         'month' => array(
13 13
                           'فروردین',
14 14
                           'اردیبهشت',
15
-                           'خرداد',
16
-                           'تیر',
17
-                           'مرداد',
18
-                           'شهریور',
19
-                           'مهر',
20
-                           'آبان',
21
-                           'آذر',
22
-                           'دی',
23
-                           'بهمن',
24
-                           'اسفند',
15
+                            'خرداد',
16
+                            'تیر',
17
+                            'مرداد',
18
+                            'شهریور',
19
+                            'مهر',
20
+                            'آبان',
21
+                            'آذر',
22
+                            'دی',
23
+                            'بهمن',
24
+                            'اسفند',
25 25
                         ),
26 26
 
27 27
         'week_days_name' => 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( 'nowruz' => 'عید نوروز',
5
+       'events' => array('nowruz' => 'عید نوروز',
6 6
 
7 7
                           'iran_national_day' => 'روز جمهوری اسلامی',
8 8
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
         'pm_time' => 'ب.ظ',
42 42
 
43
-        'end_of_days' => array( "" ),
43
+        'end_of_days' => array(""),
44 44
 
45
-        'numbers' => array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' ),
45
+        'numbers' => array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'),
46 46
         '0' => '۰',
47 47
         '1' => '۱',
48 48
         '2' => '۲',
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/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.
src/CalendarSettings/Gregorian.php 3 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 OpenCafe\Datium as Datium;
4
-
5 3
  return array (
6 4
 
7 5
  'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
- use OpenCafe\Datium as Datium;
3
+  use OpenCafe\Datium as Datium;
4 4
 
5
- return [
5
+  return [
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,11 +22,11 @@  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
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
       'December'
88 88
 
89
-     ),
89
+      ),
90 90
 
91 91
     /************************************************************
92 92
     *                        Days of Week
@@ -99,28 +99,28 @@  discard block
 block discarded – undo
99 99
     */
100 100
     'days_of_week' => array (
101 101
 
102
-       'Monday',
103
-       'Tuesday',
104
-       'Wednesday',
105
-       'Thursday',
106
-       'Friday',
107
-       'Saturday',
108
-       'Sunday',
102
+        'Monday',
103
+        'Tuesday',
104
+        'Wednesday',
105
+        'Thursday',
106
+        'Friday',
107
+        'Saturday',
108
+        'Sunday',
109 109
     ),
110 110
 
111 111
 
112 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 ),
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 126
     'day_of_year' => function ($date_time) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 
5 5
  return [
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,10 +120,10 @@  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
 
@@ -147,7 +147,7 @@  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 152
         $config = include 'Gregorian.php';
153 153
 
@@ -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.