| Conditions | 5 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function Nice() { |
||
| 12 | $date = new DateTime($this->value); |
||
| 13 | //if the current user has set a timezone that is not the default then use that |
||
| 14 | $member = Member::currentUser(); |
||
| 15 | if ($member && $member->exists() && $member->Timezone && $member->Timezone != date_default_timezone_get()) { |
||
| 16 | $date->setTimezone(new DateTimeZone($member->Timezone)); |
||
| 17 | } |
||
| 18 | //return timestamp in "Nice" format + the user's timezone |
||
| 19 | return $date->Format('d/m/Y g:ia'); |
||
| 20 | } |
||
| 21 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.