$string = 'prefixRest'; $withoutPrefix = Strings::removePrefix($string, 'prefix');
Rest
/** * @test */ public function shouldRemovePrefixWhenStringIsEqualToPrefix() { //given $string = 'prefix'; //when $withoutPrefix = Strings::removePrefix($string, 'prefix'); //then $this->assertEquals('', $withoutPrefix); }
public static function all() { //this implementation is for PHP where function getallheaders() doesn't exists in CLI $headers = array(); foreach ($_SERVER as $name => $value) { if (Strings::startsWith($name, 'HTTP_')) { $headerName = Strings::removePrefix($name, 'HTTP_'); $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $headerName)))); $headers[$key] = $value; } } return $headers; }
private function _removePrefix($string) { return Strings::removePrefix($string, self::_prefixSystem()); }
public static function removePrefix($prefix) { return function ($string) use($prefix) { return Strings::removePrefix($string, $prefix); }; }
public static function add($name, $path) { $prefixSystem = Config::getValue('global', 'prefix_system'); $pathWithoutPrefix = $prefixSystem ? Strings::removePrefix($path, $prefixSystem) : $path; self::$breadcrumbsMap[] = new self($name, $pathWithoutPrefix); }
public static function addPrefixIfNeeded($url) { $prefix = Config::getValue('global', 'prefix_system'); $url = Strings::removePrefix($url, $prefix); return $prefix . $url; }