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


PHP ThemeInterface::getCode方法代碼示例

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


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

示例1: __construct

 /**
  * @param ThemeInterface $theme
  * @param string $filepath
  */
 public function __construct(ThemeInterface $theme, $filepath)
 {
     $this->name = $filepath;
     $parts = explode('.', basename($filepath), 3);
     if (3 !== count($parts)) {
         throw new \InvalidArgumentException(sprintf('Could not create a translation resource with filepath "%s".', $filepath));
     }
     $this->domain = $parts[0];
     $this->locale = $parts[1] . '_' . $theme->getCode();
     $this->format = $parts[2];
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:15,代碼來源:ThemeTranslationResource.php

示例2:

 function it_throws_an_invalid_argument_exception_if_failed_to_instantiate_with_given_filepath(ThemeInterface $theme)
 {
     $theme->getCode()->willReturn('themecode');
     $this->beConstructedWith($theme, 'one.dot');
     $this->shouldThrow(\InvalidArgumentException::class)->duringInstantiation();
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:6,代碼來源:ThemeTranslationResourceSpec.php

示例3:

 function it_returns_modified_path_if_its_referencing_bundle_asset(ThemeInterface $theme)
 {
     $theme->getCode()->willReturn("dead42beef");
     $this->resolve('bundles/asset.min.js', $theme)->shouldReturn('bundles/_dead42beef/asset.min.js');
 }
開發者ID:benakacha,項目名稱:Sylius,代碼行數:5,代碼來源:PathResolverSpec.php

示例4:

 function it_returns_resources_locales_while_using_one_nested_theme(TranslationFilesFinderInterface $translationFilesFinder, ThemeRepositoryInterface $themeRepository, ThemeHierarchyProviderInterface $themeHierarchyProvider, ThemeInterface $mainTheme, ThemeInterface $parentTheme)
 {
     $themeRepository->findAll()->willReturn([$mainTheme]);
     $themeHierarchyProvider->getThemeHierarchy($mainTheme)->willReturn([$mainTheme, $parentTheme]);
     $mainTheme->getPath()->willReturn('/main/theme/path');
     $mainTheme->getCode()->willReturn('mainthemecode');
     $parentTheme->getPath()->willReturn('/parent/theme/path');
     $parentTheme->getCode()->willReturn('parentthemecode');
     $translationFilesFinder->findTranslationFiles('/main/theme/path')->willReturn(['/main/theme/path/messages.en.yml']);
     $translationFilesFinder->findTranslationFiles('/parent/theme/path')->willReturn(['/parent/theme/path/messages.en.yml']);
     $this->getResourcesLocales()->shouldReturn(['en_mainthemecode']);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:12,代碼來源:ThemeTranslatorResourceProviderSpec.php

示例5: resolve

 /**
  * {@inheritdoc}
  */
 public function resolve($path, ThemeInterface $theme)
 {
     return str_replace('bundles/', 'bundles/_' . $theme->getCode() . '/', $path);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:7,代碼來源:PathResolver.php


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