1 | <?php |
||
18 | class BnDateTime extends BaseDateTime |
||
19 | { |
||
20 | /** @var DateTime */ |
||
21 | private $_dateTime; |
||
22 | |||
23 | /** @var \DateTime */ |
||
24 | private $_phpDateTime; |
||
25 | |||
26 | protected static $bnMonths = array( |
||
27 | 'F' => array('বৈশাখ','জ্যৈষ্ঠ','আষাঢ়','শ্রাবণ','ভাদ্র','আশ্বিন','কার্তিক','অগ্রহায়ণ','পৌষ','মাঘ','ফাল্গুন','চৈত্র'), |
||
28 | 'M' => array('বৈশাখ','জ্যৈষ্ঠ','আষাঢ়','শ্রাবণ','ভাদ্র','আশ্বিন','কার্তিক','অগ্র','পৌষ','মাঘ','ফাল্গুন','চৈত্র') |
||
29 | ); |
||
30 | |||
31 | protected static $enMonths = array( |
||
32 | 'F' => array('Boishakh','Joishtha','Ashar','Srabon','Bhadra','Ashwin','Kartik','Ogrohayon','Poush','Magh','Falgun','Choitra'), |
||
33 | 'M' => array('Boi','Joi','Ash','Sra','Bha','Ash','Kar','Ogr','Pou','Mag','Fal','Cho') |
||
34 | ); |
||
35 | protected static $daysInMonth = array('', 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30); |
||
36 | protected static $enSuffix = array('th', 'st', 'nd', 'rd'); |
||
37 | |||
38 | protected static $parameterList = array('a', 'A', 'l', 'D'); |
||
39 | |||
40 | private $morning = 6; |
||
41 | |||
42 | public static function create($time = 'now') |
||
61 | |||
62 | public function __construct($time = 'now', \DateTimeZone $timezone = null) |
||
68 | |||
69 | public function format($format) |
||
83 | |||
84 | public function enFormat($format) |
||
96 | |||
97 | /** |
||
98 | * @param int $morning |
||
99 | */ |
||
100 | public function setMorning($morning) |
||
104 | |||
105 | public function setDate($year, $month, $day) |
||
117 | |||
118 | /** |
||
119 | * @return DateTime |
||
120 | */ |
||
121 | public function getDateTime() |
||
128 | |||
129 | private function replaceToPlaceHolders($out) { |
||
138 | |||
139 | private function replacePlaceHolders($out) { |
||
147 | |||
148 | /** |
||
149 | * @param $format |
||
150 | * @param $bnDate |
||
151 | * @return mixed |
||
152 | */ |
||
153 | protected function replaceBnSuffix($format, $bnDate) |
||
157 | |||
158 | protected function replaceDateNumbers($format, $bnDate = array()) |
||
170 | |||
171 | /** |
||
172 | * @return \DateTime |
||
173 | */ |
||
174 | private function getNativeDateTimeObject() |
||
181 | |||
182 | private function getBengaliDateMonthYear() |
||
186 | |||
187 | private function getDayInMonth($month) |
||
195 | |||
196 | protected function getEnSuffix($num) { |
||
206 | |||
207 | /** |
||
208 | * @param $template |
||
209 | * @param $bnDate |
||
210 | * @param $monthArray |
||
211 | * @param $keyTemplate |
||
212 | * @return mixed |
||
213 | */ |
||
214 | protected function replaceMonthString($template, $bnDate, $monthArray, $keyTemplate) |
||
222 | |||
223 | /** |
||
224 | * @param $num |
||
225 | * @return int |
||
226 | */ |
||
227 | protected function getSuffixArrayIndexFromNumber($num) |
||
235 | } |