1 | <?php |
||
15 | class TimeAgo |
||
16 | { |
||
17 | |||
18 | private $language; |
||
19 | |||
20 | private $output; |
||
21 | |||
22 | /** |
||
23 | * TimeAgo Class constructure |
||
24 | * |
||
25 | * @param DateTime $time_difference The time to calculate with now |
||
26 | * @param string $lang Language |
||
27 | */ |
||
28 | public function __construct($time_difference, $lang ) |
||
50 | |||
51 | /** |
||
52 | * Return difference period as an object |
||
53 | * |
||
54 | * @return object |
||
55 | */ |
||
56 | public function all() |
||
62 | |||
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 | */ |
||
69 | public function read( $value, $type ) |
||
85 | |||
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 | */ |
||
92 | public function priority( $date, $type ) |
||
106 | |||
107 | /** |
||
108 | * Return fainal TimeAgo result |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function get() |
||
135 | } |
||
136 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: