This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the EasyBanglaDate package. |
||
5 | * |
||
6 | * Copyright (c) 2015 Roni Saha |
||
7 | * |
||
8 | * This source file is subject to the MIT license that is bundled |
||
9 | * with this source code in the file LICENSE. |
||
10 | */ |
||
11 | |||
12 | namespace EasyBanglaDate\Common; |
||
13 | |||
14 | |||
15 | abstract class BaseDateTime extends \DateTime |
||
16 | { |
||
17 | protected static $enDigit = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); |
||
18 | |||
19 | protected static $bnDigit = array('০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯'); |
||
20 | |||
21 | protected static $enArray = array( |
||
22 | 'l' => array('Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'), |
||
23 | 'D' => array('Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'), |
||
24 | 'F' => array('January','February','March','April','May','June','July','August','September','October','November','December'), |
||
25 | 'M' => array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') |
||
26 | ); |
||
27 | |||
28 | protected static $bnArray = array( |
||
29 | 'l' => array('শনিবার', 'রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহঃস্পতিবার', 'শুক্রবার'), |
||
30 | 'D' => array('শনি', 'রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহ', 'শুক্র'), |
||
31 | 'F' => array('জানুয়ারী','ফেব্রুয়ারি','মার্চ','এপ্রিল','মে','জুন','জুলাই','আগস্ট','সেপ্টেম্বর','অক্টোবর','নভেম্বর','ডিসেম্বর'), |
||
32 | 'M' => array('জানু','ফেব্রু','মার্চ','এপ্রিল','মে','জুন','জুলাই','আগস্ট','সেপ্টে','অক্টো','নভে','ডিসে') |
||
33 | ); |
||
34 | |||
35 | protected static $enAmPm = array('am', 'pm'); |
||
36 | |||
37 | protected static $bnAmPM = array('পূর্বাহ্ন', 'অপরাহ্ন'); |
||
38 | protected static $bnSuffix = array('', 'লা', 'রা', 'রা', 'ঠা', 'ই', 'শে'); |
||
39 | protected static $bnPrefix = array('ভোর', 'সকাল', 'দুপুর', 'বিকাল', 'সন্ধ্যা', 'রাত'); |
||
40 | protected static $enTimeSlot = array('Dawn', 'Morning', 'Noon', 'Afternoon', 'Evening', 'Night'); |
||
41 | |||
42 | public function __construct($time = 'now', \DateTimeZone $timezone = null) |
||
43 | { |
||
44 | parent::__construct($time, $timezone); |
||
45 | } |
||
46 | |||
47 | protected function translateNumbers($number) |
||
48 | { |
||
49 | return str_replace(BaseDateTime::$enDigit, BaseDateTime::$bnDigit, $number); |
||
50 | } |
||
51 | |||
52 | protected function replaceSuffix($format) |
||
53 | { |
||
54 | return str_replace('S', $this->getBnSuffix($this->_format('j')), $format); |
||
55 | } |
||
56 | |||
57 | protected function _format($format) { |
||
58 | return parent::format($format); |
||
0 ignored issues
–
show
|
|||
59 | } |
||
60 | |||
61 | protected function getBnSuffix($date) |
||
62 | { |
||
63 | $index = (int)$date; |
||
64 | |||
65 | if ($index < 19 && $index > 4) { |
||
66 | $index = 5; |
||
67 | } elseif($index > 18) { |
||
68 | $index = 6; |
||
69 | } |
||
70 | |||
71 | return BaseDateTime::$bnSuffix[$index]; |
||
72 | } |
||
73 | |||
74 | protected function replaceTimes($format) |
||
75 | { |
||
76 | $numbersItems = array('G', 'g', 'H', 'h', 'i', 's'); |
||
77 | $out = $format; |
||
78 | |||
79 | foreach ($numbersItems as $item) { |
||
80 | $out = str_replace($item, $this->_format($item), $out); |
||
81 | } |
||
82 | |||
83 | return $out; |
||
84 | } |
||
85 | |||
86 | protected function getAmPm() |
||
87 | { |
||
88 | return str_replace(BaseDateTime::$enAmPm, BaseDateTime::$bnAmPM, $this->_format('a')); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @param $format |
||
93 | * @param $items |
||
94 | * @return mixed |
||
95 | */ |
||
96 | protected function getInBengali($format, $items) |
||
97 | { |
||
98 | foreach ($items as $item) { |
||
99 | $format = str_replace( |
||
100 | $item, |
||
101 | str_replace(BaseDateTime::$enArray[$item], BaseDateTime::$bnArray[$item], $this->_format($item)), |
||
102 | $format |
||
103 | ); |
||
104 | } |
||
105 | |||
106 | return $format; |
||
107 | } |
||
108 | |||
109 | protected function replaceMeridian($str) |
||
110 | { |
||
111 | |||
112 | $mValue = $this->getAmPm(); |
||
113 | |||
114 | $str = str_replace('a', $mValue, $str); |
||
115 | $str = str_replace('A', $mValue, $str); |
||
116 | |||
117 | return $str; |
||
118 | } |
||
119 | |||
120 | protected function replaceDays($format) |
||
121 | { |
||
122 | return $this->getInBengali($format, array('D', 'l')); |
||
123 | } |
||
124 | |||
125 | protected function replaceTimePrefix($str) |
||
126 | { |
||
127 | return str_replace('b', $this->getTimePrefix(), $str); |
||
128 | } |
||
129 | |||
130 | protected function getTimePrefix() |
||
131 | { |
||
132 | return BaseDateTime::$bnPrefix[$this->getPrefixIndex()]; |
||
133 | } |
||
134 | |||
135 | protected function getPrefixIndex() |
||
136 | { |
||
137 | $hour = (int)$this->_format('G'); |
||
138 | $items = count(self::$enTimeSlot) - 1; |
||
139 | |||
140 | for ($i = 0; $i < $items; $i++) { |
||
141 | if ($this->isInTimeSlot(self::$enTimeSlot[$i], $hour)) { |
||
142 | return $i; |
||
143 | } |
||
144 | } |
||
145 | |||
146 | return $i; |
||
147 | } |
||
148 | |||
149 | |||
150 | /** |
||
151 | * @param $hour |
||
152 | * @return bool |
||
153 | */ |
||
154 | protected function isDawn($hour) |
||
155 | { |
||
156 | return $hour < 6 && $hour > 3; |
||
157 | } |
||
158 | |||
159 | /** |
||
160 | * @param $hour |
||
161 | * @return bool |
||
162 | */ |
||
163 | protected function isMorning($hour) |
||
164 | { |
||
165 | return $hour < 12 && $hour > 5; |
||
166 | } |
||
167 | |||
168 | /** |
||
169 | * @param $hour |
||
170 | * @return bool |
||
171 | */ |
||
172 | protected function isNoon($hour) |
||
173 | { |
||
174 | return $hour < 15 && $hour > 11; |
||
175 | } |
||
176 | |||
177 | /** |
||
178 | * @param $hour |
||
179 | * @return bool |
||
180 | */ |
||
181 | protected function isAfternoon($hour) |
||
182 | { |
||
183 | return $hour < 18 && $hour > 14; |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * @param $hour |
||
188 | * @return bool |
||
189 | */ |
||
190 | protected function isEvening($hour) |
||
191 | { |
||
192 | return $hour < 20 && $hour > 17; |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * @param $slot |
||
197 | * @param $hour |
||
198 | * @return mixed |
||
199 | */ |
||
200 | protected function isInTimeSlot($slot, $hour) |
||
201 | { |
||
202 | return call_user_func(array($this, "is{$slot}"), $hour); |
||
203 | } |
||
204 | } |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.