removePrefix() public static method

Example: $string = 'prefixRest'; $withoutPrefix = Strings::removePrefix($string, 'prefix'); Result: Rest
public static removePrefix ( string $string, string $prefix ) : string
$string string
$prefix string
return string
示例#1
0
 /**
  * @test
  */
 public function shouldRemovePrefixWhenStringIsEqualToPrefix()
 {
     //given
     $string = 'prefix';
     //when
     $withoutPrefix = Strings::removePrefix($string, 'prefix');
     //then
     $this->assertEquals('', $withoutPrefix);
 }
示例#2
0
 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;
 }
示例#3
0
 private function _removePrefix($string)
 {
     return Strings::removePrefix($string, self::_prefixSystem());
 }
示例#4
0
 public static function removePrefix($prefix)
 {
     return function ($string) use($prefix) {
         return Strings::removePrefix($string, $prefix);
     };
 }
示例#5
0
 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);
 }
示例#6
0
文件: Uri.php 项目: letsdrink/ouzo
 public static function addPrefixIfNeeded($url)
 {
     $prefix = Config::getValue('global', 'prefix_system');
     $url = Strings::removePrefix($url, $prefix);
     return $prefix . $url;
 }