/** * Returns the basename for this file * * The basename is the combined filename and extension. If no filename * has been set, this will always return null. * * @return String|Null Returns null if no filename has been set */ public function getBasename() { if (!$this->filenameExists()) { return null; } if (!$this->extExists()) { return $this->getFilename(); } return \r8\str\weld($this->getFilename(), $this->getExt(), "."); }
public function testWeld() { $this->assertEquals('/dir/file', \r8\str\weld('/dir', 'file', '/')); $this->assertEquals('/dir/file', \r8\str\weld('/dir/', 'file', '/')); $this->assertEquals('/dir/file', \r8\str\weld('/dir', '/file', '/')); $this->assertEquals('/dir/file', \r8\str\weld('/dir/', '/file', '/')); $this->assertEquals('onEleven', \r8\str\weld('one', 'eleven', 'E')); $this->assertEquals('onEleven', \r8\str\weld('one', 'eleven', 'E', TRUE)); $this->assertEquals('oneEeleven', \r8\str\weld('one', 'eleven', 'E', FALSE)); }