本文整理汇总了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];
}
示例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();
}
示例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');
}
示例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']);
}
示例5: resolve
/**
* {@inheritdoc}
*/
public function resolve($path, ThemeInterface $theme)
{
return str_replace('bundles/', 'bundles/_' . $theme->getCode() . '/', $path);
}