本文整理汇总了PHP中Symfony\Component\DependencyInjection\Container::hasParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::hasParameter方法的具体用法?PHP Container::hasParameter怎么用?PHP Container::hasParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DependencyInjection\Container
的用法示例。
在下文中一共展示了Container::hasParameter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: param
public function param($key)
{
if ($this->container->hasParameter($key)) {
return $this->container->getParameter($key);
}
throw new Exception("Brak parametru w parameters.yml o nazwie '" . $key . "'");
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
self::$client = static::createClient();
self::$container = self::$client->getContainer();
self::$hasDefinitions = self::$container->hasParameter('featureTypes');
self::$definitions = self::$hasDefinitions ? self::$container->getParameter('featureTypes') : array();
if (!self::$hasDefinitions) {
self::markTestSkipped("No feature declaration found");
return;
}
self::$featureType = self::$container->get('features')->get(key(self::$definitions));
self::$fieldName = current(self::$featureType->getFields());
}
示例3: supports
/**
* {@inheritdoc}
*/
public function supports(ConfigurationInterface $configuration)
{
if (!$configuration instanceof ParamConverter) {
return false;
}
if (null === $configuration->getClass()) {
return false;
}
if (!$this->container->hasParameter($configuration->getClass())) {
return false;
}
$properConfiguration = $this->getProperConfiguration($configuration);
return $this->paramConverter->supports($properConfiguration);
}
示例4: qrcodeDataUriFunction
/**
* Creates the QR code data corresponding to the given message.
*
* @param $text
* @param int $size
* @param int $padding
* @param string $extension
* @param mixed $errorCorrectionLevel
* @param array $foregroundColor
* @param array $backgroundColor
* @param string $label
* @param string $labelFontSize
* @param string $labelFontPath
*
* @return string
*/
public function qrcodeDataUriFunction($text, $size = null, $padding = null, $extension = null, $errorCorrectionLevel = null, array $foregroundColor = null, array $backgroundColor = null, $label = null, $labelFontSize = null, $labelFontPath = null)
{
if ($size === null && $this->container->hasParameter('endroid_qrcode.size')) {
$size = $this->container->getParameter('endroid_qrcode.size');
}
if ($padding === null && $this->container->hasParameter('endroid_qrcode.padding')) {
$padding = $this->container->getParameter('endroid_qrcode.padding');
}
if ($extension === null && $this->container->hasParameter('endroid_qrcode.extension')) {
$extension = $this->container->getParameter('endroid_qrcode.extension');
}
if ($errorCorrectionLevel === null && $this->container->hasParameter('endroid_qrcode.error_correction_level')) {
$errorCorrectionLevel = $this->container->getParameter('endroid_qrcode.error_correction_level');
}
if ($foregroundColor === null && $this->container->hasParameter('endroid_qrcode.foreground_color')) {
$foregroundColor = $this->container->getParameter('endroid_qrcode.foreground_color');
}
if ($backgroundColor === null && $this->container->hasParameter('endroid_qrcode.background_color')) {
$backgroundColor = $this->container->getParameter('endroid_qrcode.background_color');
}
if ($label === null && $this->container->hasParameter('endroid_qrcode.label')) {
$label = $this->container->getParameter('endroid_qrcode.label');
}
if ($labelFontSize === null && $this->container->hasParameter('endroid_qrcode.label_font_size')) {
$labelFontSize = $this->container->getParameter('endroid_qrcode.label_font_size');
}
if ($labelFontPath === null && $this->container->hasParameter('endroid_qrcode.label_font_path')) {
$labelFontPath = $this->container->getParameter('endroid_qrcode.label_font_path');
}
$qrCode = new QrCode();
$qrCode->setText($text);
if ($size !== null) {
$qrCode->setSize($size);
}
if ($padding !== null) {
$qrCode->setPadding($padding);
}
if ($extension !== null) {
$qrCode->setExtension($extension);
}
if ($errorCorrectionLevel !== null) {
$qrCode->setErrorCorrection($errorCorrectionLevel);
}
if ($foregroundColor !== null) {
$qrCode->setForegroundColor($foregroundColor);
}
if ($backgroundColor !== null) {
$qrCode->setBackgroundColor($backgroundColor);
}
if ($label != null) {
$qrCode->setLabel($label);
}
if ($labelFontSize != null) {
$qrCode->setLabelFontSize($labelFontSize);
}
if ($labelFontPath != null) {
$qrCode->setLabelFontPath($labelFontPath);
}
return $qrCode->getDataUri();
}
示例5: getGlobals
public function getGlobals()
{
$supported_locales = array();
$supported_full_locales = array();
if ($this->container->hasParameter('t73_biz_translocation.supported_locales')) {
$supported_locales = $this->container->getParameter('t73_biz_translocation.supported_locales');
foreach ($supported_locales as $locale) {
$supported_full_locales[$locale] = locale_get_display_language($locale);
}
}
$default_locale = array('code' => 'en', 'name' => locale_get_display_language('en'));
if ($this->container->hasParameter('framework.default_locale')) {
$locale = $this->container->getParameter('framework.default_locale');
$default_locale = array('code' => $locale, 'name' => locale_get_display_language($locale));
}
return array('default_locale' => $default_locale, 'supported_locales' => $supported_locales, 'supported_full_locales' => $supported_full_locales);
}
示例6: createDaemon
/**
* Creates and Initializes the daemon
*/
protected final function createDaemon()
{
$this->daemon = $this->container->get('uecode.daemon_service');
$daemonName = strtolower(str_replace(':', '_', $this->getName()));
if (!$this->container->hasParameter($daemonName . '.daemon.options')) {
throw new \Exception(sprintf("Couldnt find a daemon for %s", $daemonName . '.daemon.options'));
}
$this->daemon->initialize($this->container->getParameter($daemonName . '.daemon.options'));
}
示例7: getLocalesConfig
/**
* Retourne les locales du back et de la config
*
* @param bool $published
* @return array
*/
public function getLocalesConfig($published = true)
{
$tabLocale = [];
// On regarde si il y a une configuration pour le bundle ter_translate
if ($this->container->hasParameter('ter_translate')) {
$locales = $this->getLocales(true);
$terTranslate = $this->container->getParameter('ter_translate');
foreach ($terTranslate['host_name'] as $host => $locale) {
if (array_search($locale, $locales) !== false) {
$request = $this->container->get('request');
$envUrl = '/';
if ($this->container->get('kernel')->getEnvironment() != "prod") {
$envUrl = "/app_" . $this->container->get('kernel')->getEnvironment() . ".php/";
}
$tabLocale[$locale] = array('code' => $locale, 'host' => $request->getScheme() . "://" . $host . $envUrl);
}
}
}
return $tabLocale;
}
示例8: getCustomRouteName
/**
* @param string $name
* @param null|string $fromLocale
* @param null|string $toLocale
*
* @return string
*/
public function getCustomRouteName($name, $fromLocale = null, $toLocale = null)
{
if (!$fromLocale) {
$fromLocale = $this->router->getContext()->getParameter('_locale');
}
if (!$toLocale) {
$toLocale = $fromLocale;
}
if (!$this->container->hasParameter('custom_locale_routes')) {
return $name;
}
$customLocaleRoutes = $this->container->getParameter('custom_locale_routes');
if (isset($customLocaleRoutes[$name]) && isset($customLocaleRoutes[$name][$toLocale])) {
return $customLocaleRoutes[$name][$toLocale];
}
if ($fromLocale !== $toLocale) {
foreach ($customLocaleRoutes as $route => $locales) {
if (isset($locales[$fromLocale]) && $locales[$fromLocale] == $name) {
return $route;
}
}
}
return $name;
}
示例9: loadDefinitions
/**
* @param Container $container
*/
protected static function loadDefinitions(Container $container)
{
if (empty(self::$definitions)) {
if (!$container->hasParameter('debug.container.dump')) {
throw new \BadMethodCallException('Class autodetection works only with "debug" enabled');
}
$dump = $container->getParameter('debug.container.dump');
$xml = simplexml_load_file($dump);
foreach ($xml->services->service as $service) {
$attributes = $service->attributes();
$id = (string) $attributes['id'];
$class = (string) $attributes['class'];
if (!empty($class)) {
self::$definitions[$id] = $class;
}
}
}
}