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


PHP ThemeInterface::getParents方法代码示例

本文整理汇总了PHP中Sylius\Bundle\ThemeBundle\Model\ThemeInterface::getParents方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeInterface::getParents方法的具体用法?PHP ThemeInterface::getParents怎么用?PHP ThemeInterface::getParents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Bundle\ThemeBundle\Model\ThemeInterface的用法示例。


在下文中一共展示了ThemeInterface::getParents方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 /**
  * {@inheritdoc}
  */
 public function check(ThemeInterface $theme, array $previousThemes = [])
 {
     if (0 === count($theme->getParents())) {
         return;
     }
     $previousThemes = array_merge($previousThemes, [$theme]);
     foreach ($theme->getParents() as $parent) {
         if (in_array($parent, $previousThemes, true)) {
             throw new CircularDependencyFoundException(array_merge($previousThemes, [$parent]));
         }
         $this->check($parent, $previousThemes);
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:16,代码来源:CircularDependencyChecker.php

示例2: getThemeHierarchy

 /**
  * {@inheritdoc}
  */
 public function getThemeHierarchy(ThemeInterface $theme = null)
 {
     if (null === $theme) {
         return [];
     }
     $parents = [];
     foreach ($theme->getParents() as $parent) {
         $parents = array_merge($parents, $this->getThemeHierarchy($parent));
     }
     return array_merge([$theme], $parents);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:14,代码来源:ThemeHierarchyProvider.php

示例3:

 function it_finds_circular_dependency_if_theme_parents_are_cycled(ThemeInterface $firstTheme, ThemeInterface $secondTheme, ThemeInterface $thirdTheme, ThemeInterface $fourthTheme)
 {
     $firstTheme->getParents()->willReturn([$secondTheme, $thirdTheme]);
     $secondTheme->getParents()->willReturn([$thirdTheme]);
     $thirdTheme->getParents()->willReturn([$fourthTheme]);
     $fourthTheme->getParents()->willReturn([$secondTheme]);
     $firstTheme->getName()->willReturn('first/theme');
     $secondTheme->getName()->willReturn('second/theme');
     $thirdTheme->getName()->willReturn('third/theme');
     $fourthTheme->getName()->willReturn('fourth/theme');
     $this->shouldThrow(CircularDependencyFoundException::class)->during('check', [$firstTheme]);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:12,代码来源:CircularDependencyCheckerSpec.php

示例4:

 function it_ensures_cohesion_between_parent_themes(ThemeLoaderInterface $themeLoader, ThemeRepositoryInterface $themeRepository, ThemeMergerInterface $themeMerger, ThemeInterface $loadedTheme, ThemeInterface $loadedParentTheme, ThemeInterface $existingParentTheme)
 {
     $themeRepository->findAll()->willReturn([$existingParentTheme]);
     $existingParentTheme->getName()->willReturn('parent-theme/name');
     $themeLoader->load()->willReturn([$loadedTheme, $loadedParentTheme]);
     $loadedTheme->getName()->willReturn('theme/name');
     $loadedTheme->getParents()->willReturn([$loadedParentTheme]);
     $themeRepository->findOneByName('theme/name')->willReturn(null);
     $loadedParentTheme->getName()->willReturn('parent-theme/name');
     $loadedParentTheme->getParents()->willReturn([]);
     $themeRepository->findOneByName('parent-theme/name')->willReturn($existingParentTheme);
     $loadedTheme->removeParent($loadedParentTheme)->shouldBeCalled();
     $loadedTheme->addParent($existingParentTheme)->shouldBeCalled();
     $themeMerger->merge($existingParentTheme, $loadedParentTheme)->willReturn($existingParentTheme);
     $themeRepository->add($loadedTheme)->shouldBeCalled();
     $themeRepository->add($existingParentTheme)->shouldBeCalled();
     $themeRepository->add($loadedParentTheme)->shouldNotBeCalled();
     $this->synchronize();
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:19,代码来源:ThemeSynchronizerSpec.php

示例5:

 function it_returns_theme_list_in_hierarchized_order(ThemeInterface $firstTheme, ThemeInterface $secondTheme)
 {
     $firstTheme->getParents()->willReturn([$secondTheme]);
     $secondTheme->getParents()->willReturn([]);
     $this->getThemeHierarchy($firstTheme)->shouldReturn([$firstTheme, $secondTheme]);
 }
开发者ID:Sylius,项目名称:SyliusThemeBundle,代码行数:6,代码来源:ThemeHierarchyProviderSpec.php


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