@@ -63,8 +63,8 @@ |
||
63 | 63 | /** |
64 | 64 | * Read ago config file |
65 | 65 | * |
66 | - * @param integer $date date index in ago config file |
|
67 | 66 | * @param string $type duration type on ago config file |
67 | + * @param integer $value |
|
68 | 68 | */ |
69 | 69 | public function read( $value, $type ) |
70 | 70 | { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use OpenCafe\Tools\Lang; |
6 | 6 | use OpenCafe\Datium; |
7 | -use stdClass; |
|
8 | 7 | |
9 | 8 | /** |
10 | 9 | * Calculate Time ago with current date difference |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | private $output; |
21 | 21 | |
22 | 22 | /** |
23 | - * TimeAgo Class constructure |
|
24 | - * |
|
25 | - * @param DateTime $time_difference The time to calculate with now |
|
26 | - * @param string $lang Language |
|
27 | - */ |
|
23 | + * TimeAgo Class constructure |
|
24 | + * |
|
25 | + * @param DateTime $time_difference The time to calculate with now |
|
26 | + * @param string $lang Language |
|
27 | + */ |
|
28 | 28 | public function __construct($time_difference, $lang ) |
29 | 29 | { |
30 | 30 | |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * Return difference period as an object |
|
53 | - * |
|
54 | - * @return object |
|
55 | - */ |
|
52 | + * Return difference period as an object |
|
53 | + * |
|
54 | + * @return object |
|
55 | + */ |
|
56 | 56 | public function all() |
57 | 57 | { |
58 | 58 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * Read ago config file |
|
65 | - * |
|
66 | - * @param integer $date date index in ago config file |
|
67 | - * @param string $type duration type on ago config file |
|
68 | - */ |
|
64 | + * Read ago config file |
|
65 | + * |
|
66 | + * @param integer $date date index in ago config file |
|
67 | + * @param string $type duration type on ago config file |
|
68 | + */ |
|
69 | 69 | public function read( $value, $type ) |
70 | 70 | { |
71 | 71 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * Show priority of duration |
|
88 | - * |
|
89 | - * @param integer $date date index in ago config file |
|
90 | - * @param string $type duration type on ago config file |
|
91 | - */ |
|
87 | + * Show priority of duration |
|
88 | + * |
|
89 | + * @param integer $date date index in ago config file |
|
90 | + * @param string $type duration type on ago config file |
|
91 | + */ |
|
92 | 92 | public function priority( $date, $type ) |
93 | 93 | { |
94 | 94 | |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
108 | - * Return fainal TimeAgo result |
|
109 | - * |
|
110 | - * @return string |
|
111 | - */ |
|
108 | + * Return fainal TimeAgo result |
|
109 | + * |
|
110 | + * @return string |
|
111 | + */ |
|
112 | 112 | public function get() |
113 | 113 | { |
114 | 114 |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param DateTime $time_difference The time to calculate with now |
26 | 26 | * @param string $lang Language |
27 | 27 | */ |
28 | - public function __construct($time_difference, $lang ) |
|
28 | + public function __construct($time_difference, $lang) |
|
29 | 29 | { |
30 | 30 | |
31 | 31 | $this->language = $lang; |
32 | 32 | |
33 | - $now = Datium::now()->object(); |
|
33 | + $now = Datium::now()->object(); |
|
34 | 34 | |
35 | - $this->output = Datium::diff( $now, $time_difference ); |
|
35 | + $this->output = Datium::diff($now, $time_difference); |
|
36 | 36 | |
37 | 37 | $this->year = $this->output->year; |
38 | 38 | |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | * @param integer $date date index in ago config file |
67 | 67 | * @param string $type duration type on ago config file |
68 | 68 | */ |
69 | - public function read( $value, $type ) |
|
69 | + public function read($value, $type) |
|
70 | 70 | { |
71 | 71 | |
72 | 72 | $config = include 'config/ago.php'; |
73 | 73 | |
74 | - if( array_key_exists( $value, $config[ $type ] ) ) { |
|
74 | + if (array_key_exists($value, $config[$type])) { |
|
75 | 75 | |
76 | - return Lang::get( $this->language, $config[ $type ][ $value ] ); |
|
76 | + return Lang::get($this->language, $config[$type][$value]); |
|
77 | 77 | |
78 | 78 | } else { |
79 | 79 | |
80 | - return $value . " " . Lang::get( $this->language, $config[ $type ][ '*' ] ); |
|
80 | + return $value." ".Lang::get($this->language, $config[$type]['*']); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | * @param integer $date date index in ago config file |
90 | 90 | * @param string $type duration type on ago config file |
91 | 91 | */ |
92 | - public function priority( $date, $type ) |
|
92 | + public function priority($date, $type) |
|
93 | 93 | { |
94 | 94 | |
95 | - if( $date != 0 ) { |
|
95 | + if ($date != 0) { |
|
96 | 96 | |
97 | - return $this->read( $date, $type ); |
|
97 | + return $this->read($date, $type); |
|
98 | 98 | |
99 | 99 | } else { |
100 | 100 | |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | 'second' => $this->second |
122 | 122 | ]; |
123 | 123 | |
124 | - foreach( $duration as $index => $value ) { |
|
124 | + foreach ($duration as $index => $value) { |
|
125 | 125 | |
126 | - if( $this->priority( $value, $index ) != false ) { |
|
126 | + if ($this->priority($value, $index) != false) { |
|
127 | 127 | |
128 | - return $this->priority( $value, $index ); |
|
128 | + return $this->priority($value, $index); |
|
129 | 129 | |
130 | 130 | } |
131 | 131 |
@@ -20,9 +20,9 @@ |
||
20 | 20 | 'default_calendar' => 'gregorian', |
21 | 21 | |
22 | 22 | |
23 | - 'date_interval' => [ 'D', 'M', 'Y', 'HT', 'MT', 'ST' ], |
|
23 | + 'date_interval' => ['D', 'M', 'Y', 'HT', 'MT', 'ST'], |
|
24 | 24 | |
25 | 25 | |
26 | - 'date_simple' => [ 'day', ' month', ' year', ' hour', ' minute', ' second' ], |
|
26 | + 'date_simple' => ['day', ' month', ' year', ' hour', ' minute', ' second'], |
|
27 | 27 | |
28 | 28 | ]; |