本文整理汇总了PHP中Collection::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::has方法的具体用法?PHP Collection::has怎么用?PHP Collection::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection::has方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHasNotStrict
public function testHasNotStrict()
{
$collection = new Collection(['1']);
$this->assertTrue($collection->has('1', false));
$this->assertTrue($collection->has(1, false));
$this->assertFalse($collection->has(2, false));
}
示例2: prepareRequestUri
protected function prepareRequestUri()
{
$requestUri = '';
if ($this->headers->has('X_REWRITE_URL') && false !== stripos(PHP_OS, 'WIN')) {
// check this first so IIS will catch
$requestUri = $this->headers->get('X_REWRITE_URL');
} elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {
// IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
$requestUri = $this->server->get('UNENCODED_URL');
} elseif ($this->server->has('REQUEST_URI')) {
$requestUri = $this->server->get('REQUEST_URI');
// HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
$schemeAndHttpHost = $this->getScheme() . '://' . $this->getHttpHost();
if (strpos($requestUri, $schemeAndHttpHost) === 0) {
$requestUri = substr($requestUri, strlen($schemeAndHttpHost));
}
} elseif ($this->server->has('ORIG_PATH_INFO')) {
// IIS 5.0, PHP as CGI
$requestUri = $this->server->get('ORIG_PATH_INFO');
if ($this->server->get('QUERY_STRING')) {
$requestUri .= '?' . $this->server->get('QUERY_STRING');
}
}
return $requestUri;
}
示例3: encode
public function encode($script)
{
$this->search($script);
$this->words->sort();
$encoded = new Collection();
// a dictionary of base62 -> base10
$size = $this->words->size();
for ($i = 0; $i < $size; $i++) {
$encoded->put(Packer::encode62($i), $i);
}
$index = 0;
foreach ($this->words as $word) {
if ($encoded->has($word)) {
$word->index = $encoded->get($word);
$word->clear();
} else {
while ($this->words->has(Packer::encode62($index))) {
$index++;
}
$word->index = $index++;
if ($word->count == 1) {
$word->clear();
}
}
$word->replacement = Packer::encode62($word->index);
if (strlen($word->replacement) == strlen($word)) {
$word->clear();
}
}
// sort by encoding
$this->words->sort(array('Base62', 'sorter'));
// trim unencoded words
$this->words = $this->words->slice(0, preg_match_all('/\\|/', $this->getKeyWords(), $matches) + 1);
$script = preg_replace_callback($this->getPattern(), array(&$this, '_word_replacement'), $script);
/* build the packed script */
$p = $this->escape($script);
$a = '[]';
$c = max($this->words->size(), 1);
$k = $this->getKeyWords();
$e = $this->getEncoder();
$d = $this->getDecoder();
// the whole thing
return $this->format(Base62::$UNPACK, $p, $a, $c, $k, $e, $d);
}
示例4: getOldOnce
/**
* @param string $name
* @param string $def
* @return string
*/
public function getOldOnce($name, $def = '')
{
if ($this->storage) {
$old_once = $this->storage->get(OldValue::OLD_ONCE_KEY);
$old_once = new Collection($old_once);
if ($old_once->has($name)) {
$v = $old_once->get($name);
$old_once->delete($name);
$this->storage->set(OldValue::OLD_ONCE_KEY, $old_once->get());
return $v;
}
}
return $def;
}
示例5: test7_Deletion
public function test7_Deletion()
{
# deletion
static::$collection->delete('part2.item2', 'name');
$this->assertTrue(!static::$collection->has('part2.item2.name'));
}
示例6: has
/**
* Does this collection have a given header?
*
* @param string $key The case-insensitive header name
*
* @return bool
*/
public function has($key)
{
return parent::has($this->normalizeKey($key));
}
示例7: has
/**
* @inheritDoc
*/
public function has($name)
{
return parent::has($this->normalizeName($name));
}
示例8: has
/**
* Checks if a page is in a set of children
*
* @param Page | string $page
* @return boolean
*/
public function has($page)
{
$uri = is_string($page) ? $page : $page->id();
return parent::has($uri);
}
示例9: has
/**
* /
* @param [type] $id [description]
* @return boolean [description]
*/
public function has($id)
{
$newId = str_replace('.', '_', $id);
return parent::has($newId);
}