当前位置: 首页>>代码示例>>PHP>>正文


PHP Collection::has方法代码示例

本文整理汇总了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));
 }
开发者ID:Raphhh,项目名称:trex-collection,代码行数:7,代码来源:CollectionValueAccessorTraitTest.php

示例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;
 }
开发者ID:phpalchemy,项目名称:http,代码行数:25,代码来源:Request.php

示例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);
 }
开发者ID:saarze,项目名称:base2,代码行数:44,代码来源:Base62.php

示例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;
 }
开发者ID:wwtg99,项目名称:flight2wwu,代码行数:19,代码来源:OldValue.php

示例5: test7_Deletion

 public function test7_Deletion()
 {
     # deletion
     static::$collection->delete('part2.item2', 'name');
     $this->assertTrue(!static::$collection->has('part2.item2.name'));
 }
开发者ID:anctemarry27,项目名称:cogs,代码行数:6,代码来源:CollectionTest.php

示例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));
 }
开发者ID:slimphp,项目名称:Slim-Http,代码行数:11,代码来源:Headers.php

示例7: has

 /**
  * @inheritDoc
  */
 public function has($name)
 {
     return parent::has($this->normalizeName($name));
 }
开发者ID:scaleddynamics,项目名称:Opulence,代码行数:7,代码来源:Headers.php

示例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);
 }
开发者ID:kgchoy,项目名称:main-portfolio-website,代码行数:11,代码来源:pages.php

示例9: has

 /**
  * /
  * @param  [type]  $id [description]
  * @return boolean     [description]
  */
 public function has($id)
 {
     $newId = str_replace('.', '_', $id);
     return parent::has($newId);
 }
开发者ID:pedrokoblitz,项目名称:maltz,代码行数:10,代码来源:CookieJar.php


注:本文中的Collection::has方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。