BugReporter::getFileWithoutPath PHP Method

getFileWithoutPath() public method

Return the name of the error-file, not including the path.
public getFileWithoutPath ( ) : string
return string The name of the file, not including the path.
    public function getFileWithoutPath()
    {
        if (preg_match("/\\/\$/", $this->m_file)) {
            trigger_error($this->invalidParam);
        }
        return preg_replace("/.*\\/([^\\/]*)/", "\$1", $this->m_file);
    }

Usage Example

 function test_trailingSlashInFile()
 {
     $reporter = new BugReporter (2, "bad bad error", "/non-dir/file.php", 3, "Campsite", "2.5.0");
     $reporter->m_file .= "/";
     $reporter->getFileWithoutPath();
     $this->assertError();
 }