本文整理汇总了PHP中Sylius\Bundle\ThemeBundle\Model\ThemeInterface::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeInterface::getTitle方法的具体用法?PHP ThemeInterface::getTitle怎么用?PHP ThemeInterface::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Bundle\ThemeBundle\Model\ThemeInterface
的用法示例。
在下文中一共展示了ThemeInterface::getTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_throws_an_exception_if_settings_schema_does_not_exist(ThemeInterface $theme)
{
$theme->getTitle()->willReturn('Candy shop');
$theme->getName()->willReturn('candy/shop');
$theme->getPath()->willReturn($this->vfsStream->url());
$this->shouldThrow(new \InvalidArgumentException(sprintf('Could not find settings schema of theme "Candy shop" (candy/shop) in file "%s"', $this->vfsStream->url() . '/Settings.php')))->during('getSchema', [$theme]);
}
示例2: getScreenshotPath
/**
* @param ThemeInterface $theme
* @param int $screenshotNumber
*
* @return string
*/
private function getScreenshotPath(ThemeInterface $theme, $screenshotNumber)
{
$screenshots = $theme->getScreenshots();
if (!isset($screenshots[$screenshotNumber])) {
throw new NotFoundHttpException(sprintf('Theme "%s" does not have screenshot #%d', $theme->getTitle(), $screenshotNumber));
}
$screenshotRelativePath = $screenshots[$screenshotNumber];
return rtrim($theme->getPath(), \DIRECTORY_SEPARATOR) . \DIRECTORY_SEPARATOR . $screenshotRelativePath;
}
示例3: getSchema
/**
* {@inheritdoc}
*/
public function getSchema(ThemeInterface $theme)
{
$schemaPath = sprintf('%s/Settings.php', $theme->getPath());
if (!file_exists($schemaPath)) {
throw new \InvalidArgumentException(sprintf('Could not find settings schema of theme "%s" (%s) in file "%s"', $theme->getTitle(), $theme->getName(), $schemaPath));
}
$schema = (require $schemaPath);
if (!$schema instanceof SchemaInterface) {
throw new \InvalidArgumentException(sprintf('File "%s" must return an instance of "%s"', $schemaPath, SchemaInterface::class));
}
return $schema;
}