當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArrayCollection::containsKey方法代碼示例

本文整理匯總了PHP中Doctrine\Common\Collections\ArrayCollection::containsKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayCollection::containsKey方法的具體用法?PHP ArrayCollection::containsKey怎麽用?PHP ArrayCollection::containsKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\Common\Collections\ArrayCollection的用法示例。


在下文中一共展示了ArrayCollection::containsKey方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: find

 /**
  * @param string $name
  *
  * @return Blog|null
  */
 public function find($name)
 {
     if ($this->blogs->containsKey($name)) {
         return $this->blogs[$name];
     }
     return null;
 }
開發者ID:Rybbow,項目名稱:symfony-blog,代碼行數:12,代碼來源:InMemoryBlogRepository.php

示例2: getType

 /**
  * @param string $class
  * @return ColumnTypeInterface
  */
 public function getType(string $class)
 {
     if ($this->types->containsKey($class)) {
         return $this->types[$class];
     }
     return null;
 }
開發者ID:vardius,項目名稱:list-bundle,代碼行數:11,代碼來源:ColumnTypePool.php

示例3: remove

 /**
  * @inheritdoc
  */
 public function remove(User $user)
 {
     if (!$this->collection->containsKey((string) $user->getId())) {
         throw new UserNotFoundException();
     }
     return $this->collection->removeElement($user);
 }
開發者ID:xtreamwayz,項目名稱:zend-expressive-app-poc,代碼行數:10,代碼來源:InMemoryUserRepository.php

示例4: addModel

 public function addModel(BaseModel $model)
 {
     if (!$this->models->containsKey($model->name)) {
         $model->bundle = $this;
         $this->models->set($model->name, $model);
     }
     return $this;
 }
開發者ID:mattcrowe,項目名稱:ginny,代碼行數:8,代碼來源:BaseBundle.php

示例5: addBundle

 public function addBundle(BaseBundle $bundle)
 {
     if (!$this->bundles->containsKey($bundle->name)) {
         $bundle->map = $this;
         $this->bundles->set($bundle->name, $bundle);
     }
     return $this;
 }
開發者ID:mattcrowe,項目名稱:ginny,代碼行數:8,代碼來源:BaseMap.php

示例6: getAuditEntryFieldClass

 /**
  * @param AbstractUser $user
  * @return string
  */
 public function getAuditEntryFieldClass(AbstractUser $user)
 {
     $userClass = ClassUtils::getRealClass($user);
     if (!$this->entryFieldMap->containsKey($userClass)) {
         throw new \InvalidArgumentException(sprintf('Audit entry field not found for "%s"', $userClass));
     }
     return $this->entryFieldMap->get($userClass);
 }
開發者ID:anyt,項目名稱:platform,代碼行數:12,代碼來源:AuditEntityMapper.php

示例7: getDefault

 /**
  *
  * @param string $key
  * @param string $section
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 public function getDefault($key, $section = "default")
 {
     $data = null;
     if ($this->defaults->containsKey($section . '.' . $key)) {
         $data = $this->defaults->get($section . '.' . $key);
     }
     return $data;
 }
開發者ID:symbb,項目名稱:symbb,代碼行數:14,代碼來源:ConfigManager.php

示例8: find

 /**
  * @param BlogId $id
  *
  * @return Blog|null
  */
 public function find(BlogId $id)
 {
     $key = (string) $id;
     if (!$this->storage->containsKey($key)) {
         return null;
     }
     return $this->storage[$key];
 }
開發者ID:Rybbow,項目名稱:x-blog,代碼行數:13,代碼來源:InMemoryBlogRepository.php

示例9: addChannelType

 /**
  * Set registered types
  *
  * @param string               $typeName
  * @param IntegrationInterface $type
  *
  * @throws \LogicException
  * @return $this
  */
 public function addChannelType($typeName, IntegrationInterface $type)
 {
     if (!$this->integrationTypes->containsKey($typeName)) {
         $this->integrationTypes->set($typeName, $type);
     } else {
         throw new LogicException(sprintf('Trying to redeclare integration type "%s".', $typeName));
     }
     return $this;
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:18,代碼來源:TypesRegistry.php

示例10: addActivity

 /**
  * Add activity
  *
  * @param Activity $activity
  * @return Student
  */
 public function addActivity(Activity $activity)
 {
     $key = $activity->getMachineName();
     if ($this->activities->containsKey($key)) {
         throw new \InvalidArgumentException('This Student already belongs to this Activity');
     }
     $this->activities->set($key, $activity);
     return $this;
 }
開發者ID:AlexEvesDeveloper,項目名稱:teachers.beta,代碼行數:15,代碼來源:Student.php

示例11: getAuditEntryFieldClass

 /**
  * @param DiamanteUser|null $user
  *
  * @return string
  */
 public function getAuditEntryFieldClass(DiamanteUser $user = null)
 {
     if ($user === null) {
         return $this->entryFieldMap->first();
     }
     $userClass = ClassUtils::getRealClass($user);
     if (!$this->entryFieldMap->containsKey($userClass)) {
         throw new \InvalidArgumentException(sprintf('Audit entry field not found for "%s"', $userClass));
     }
     return $this->entryFieldMap->get($userClass);
 }
開發者ID:gitter-badger,項目名稱:diamantedesk-application,代碼行數:16,代碼來源:AuditEntityMapper.php

示例12: getPosition

 /**
  * Get a Key/Value position by Key, if it exists - returns false if the
  * key does not exist
  *
  * @param  mixed  $key The key to search the index for
  *
  * @return integer|bool
  */
 private function getPosition($key)
 {
     if ($this->index->containsKey($key)) {
         return $this->index->get($key);
     }
     return false;
 }
開發者ID:kmfk,項目名稱:slowdb,代碼行數:15,代碼來源:Collection.php

示例13: getPreviewImage

 /**
  * Get preview image
  *
  * @return Image
  */
 public function getPreviewImage()
 {
     if ($this->images->containsKey($this->previewImageKey)) {
         return $this->images->get($this->previewImageKey);
     }
     return $this->images->first();
 }
開發者ID:nathix86,項目名稱:bcp-website,代碼行數:12,代碼來源:Post.php

示例14: getParameter

 /**
  * Get parameter.
  *
  * @param string $parameter
  * @param mixed  $default
  *
  * @return mixed
  */
 public function getParameter($parameter, $default = null)
 {
     if (!$this->parameters instanceof ArrayCollection) {
         return $default;
     }
     return $this->parameters->containsKey($parameter) ? $this->parameters->get($parameter) : $default;
 }
開發者ID:juliangut,項目名稱:tify,代碼行數:15,代碼來源:ParameterTrait.php

示例15: startProviderEmulation

 /**
  * @param string $providerAlias
  */
 public function startProviderEmulation($providerAlias)
 {
     if (!$this->providers->containsKey($providerAlias)) {
         throw new \InvalidArgumentException(sprintf('Provider with "%s" alias not registered', $providerAlias));
     }
     $this->emulatedProvider = $this->providers->get($providerAlias);
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:10,代碼來源:ChainMetadataProvider.php


注:本文中的Doctrine\Common\Collections\ArrayCollection::containsKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。