示例#1
0
 public function testStartsWith()
 {
     $this->assertTrue(StringUtil::startsWith('Hello World', 'H'));
     $this->assertTrue(StringUtil::startsWith('Hello World', 'Hello'));
     $this->assertTrue(StringUtil::startsWith('Hello World', 'Hello World'));
     $this->assertFalse(StringUtil::startsWith('Hello World', 'World'));
     $this->assertFalse(StringUtil::startsWith('Hello World', ' Hello'));
 }
 private static function completeBaseUrl($originalBaseUrl)
 {
     $baseUrl = $originalBaseUrl;
     if (StringUtil::endsWith($baseUrl, '/') == false) {
         $baseUrl .= '/';
     }
     $baseUrlPath = parse_url($baseUrl, PHP_URL_PATH);
     if (StringUtil::endsWith($baseUrlPath, '/api/v3/')) {
         return $baseUrl;
     }
     return $baseUrl . 'api/v3/';
 }