/** * Default constructor for directory base * @param string $path */ function __construct($path) { if (!Str::endsWith($path, '/')) { $path .= '/'; } if (!Str::startsWith($path, '/')) { $path = '/' . $path; } $cwd = getcwd(); if (strpos($path, $cwd) === false) { $path = $cwd . $path; } $path = Str::flipDS($path); $this->path = $path; }
function testStartEndsWith() { $str = 'hello world'; $this->assertTrue(\qtil\StringUtil::startsWith($str, 'hello')); $this->assertTrue(\qtil\StringUtil::endsWith($str, 'world')); }