Exemple #1
0
 /**
  * Test for Schwaen\Stdlib\StringUtils::startsWith
  */
 public function testStartsWith()
 {
     $this->assertEquals(false, StringUtils::startsWith('Hallo Welt', 'hallo'));
     $this->assertEquals(true, StringUtils::startsWith('Hallo Welt', 'Hallo'));
     $this->assertEquals(false, StringUtils::startsWith('Hallo Welt', 'Test'));
     $this->assertEquals(true, StringUtils::startsWith('Hallo Welt', ''));
 }
Exemple #2
0
 public function __call($name, $value)
 {
     if (StringUtils::startsWith($name, "set")) {
         $this->executeSetter($name, $value);
     } else {
         if (StringUtils::startsWith($name, "get")) {
             $this->executeGetter($name);
         }
     }
 }
Exemple #3
0
 public function __call($name, array $args)
 {
     if (StringUtils::startsWith($name, "get") && strlen($name) != 3) {
         $name = ucfirst(substr($name, 3));
         if (isset($this->_data[$name])) {
             return $this->_data[$name];
         }
         return null;
     }
     throw new Exception("Unknown method {$name}!");
 }
 protected function resolveURI($uri)
 {
     if (empty($uri) || StringUtils::startsWith($uri, '/')) {
         return rtrim($this->routerBase, '/') . '/' . ltrim($uri, '/');
     }
     //return $this->RequestContext->getSite()->getBaseURL().'/'.ltrim($uri, '/');
     return $uri;
 }
 /**
  * @covers StringUtils::startsWith
  */
 public function testStartsWithFail()
 {
     $haystack = "fruition sciences";
     $needle = "Fruit";
     $response = \StringUtils::startsWith($haystack, $needle);
     $this->assertFalse($response);
 }
 private static function detectMethodSignature($name)
 {
     require_once 'platform/stdlib/StringUtils.php';
     if (StringUtils::startsWith($name, self::METHOD_SIGNATURE_GET)) {
         return self::METHOD_SIGNATURE_GET;
     }
     if (StringUtils::startsWith($name, self::METHOD_SIGNATURE_SET)) {
         return self::METHOD_SIGNATURE_SET;
     }
     return null;
 }
Exemple #7
0
 function write_mind($message, $origin_id, $attach_pic = false, $autopost_fb = 0, $autopost_tw = 0)
 {
     $params = array('message' => $message, 'origin_id' => $origin_id, 'autopost_fb' => $autopost_fb, 'autopost_tw' => $autopost_tw, 'access_token' => $this->access_token, 'rf' => $this->rf);
     if ($attach_pic) {
         if (!StringUtils::startsWith($attach_pic, '@')) {
             $attach_pic = sprintf('%s%s', '@', $attach_pic);
         }
         $params['attach_pic'] = $attach_pic;
     }
     $conn = new Http('POST', $this->getApiHost('/post/write_mind'), $params);
     return $conn->execute();
 }