当前位置: 首页>>代码示例>>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;未经允许,请勿转载。