| Conditions | 6 |
| Paths | 32 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed'); |
||
| 9 | public function report(string $text, $userID = NULL, $url = NULL) : bool { |
||
| 10 | $this->load->library('email'); |
||
| 11 | |||
| 12 | //This is pretty barebones issue reporting, and honestly not a great way to do it, but it works for now (until the Github is public). |
||
| 13 | $body = "". |
||
| 14 | (!is_null($url) && !empty($url) ? "URL: ".htmlspecialchars(substr($url, 0, 255))."<br>\n" : ""). |
||
| 15 | "Submitted by: ".$this->input->ip_address().(!is_null($userID) ? "| {$userID}" : "")."<br>\n". |
||
| 16 | "<br>Bug report: ".htmlspecialchars(substr($text, 0, 1000)); |
||
| 17 | |||
| 18 | $success = TRUE; |
||
| 19 | $this->email->from('[email protected]', $this->config->item('site_title', 'ion_auth')); |
||
| 20 | if($this->User->id) { |
||
| 21 | $this->email->reply_to($this->User->email); |
||
| 22 | } |
||
| 23 | $this->email->to('[email protected]'); |
||
| 24 | $this->email->subject($this->config->item('site_title', 'ion_auth')." - Issue Report"); |
||
| 25 | $this->email->message($body); |
||
| 26 | if(!$this->email->send()) { |
||
|
|
|||
| 27 | $success = FALSE; |
||
| 28 | } |
||
| 29 | return $success; |
||
| 30 | } |
||
| 31 | |||
| 33 |
If an expression can have both
false, andnullas possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.