hasParameter() public method

Checks if $paramName exists in $namespace.
public hasParameter ( string $paramName, string $namespace = null, string $scope = null ) : boolean
$paramName string
$namespace string If null, the default namespace should be used.
$scope string The scope you need $paramName value for.
return boolean
Esempio n. 1
0
 /**
  * Returns the parameter value from config resolver.
  *
  * @param string $parameterName
  * @param string $namespace
  * @param mixed $defaultValue
  *
  * @return mixed
  */
 protected function getParameter($parameterName, $namespace, $defaultValue = null)
 {
     if ($this->configResolver->hasParameter($parameterName, $namespace)) {
         return $this->configResolver->getParameter($parameterName, $namespace);
     }
     return $defaultValue;
 }
Esempio n. 2
0
 public function getParameter($parameterName, $defaultValue = null)
 {
     if ($this->configResolver->hasParameter($parameterName)) {
         return $this->configResolver->getParameter($parameterName);
     }
     return $defaultValue;
 }
 /**
  * Returns the YUI loader configuration.
  *
  * @param string $configObject
  *
  * @return string
  */
 public function yuiConfigLoaderFunction($configObject = '')
 {
     $modules = array_fill_keys($this->configResolver->getParameter('yui.modules', 'ez_platformui'), true);
     $yui = ['filter' => $this->configResolver->getParameter('yui.filter', 'ez_platformui'), 'modules' => []];
     $combine = $this->configResolver->getParameter('yui.combine', 'ez_platformui');
     if ($combine === true) {
         $yui['combine'] = true;
         $yui['root'] = '';
         $yui['comboBase'] = $this->router->generate('yui_combo_loader') . '?';
     }
     foreach (array_keys($modules) as $module) {
         if (!isset($yui['modules'][$module]['requires'])) {
             $yui['modules'][$module]['requires'] = [];
         }
         // Module dependencies
         if ($this->configResolver->hasParameter("yui.modules.{$module}.requires", 'ez_platformui')) {
             $yui['modules'][$module]['requires'] = array_merge($yui['modules'][$module]['requires'], $this->configResolver->getParameter("yui.modules.{$module}.requires", 'ez_platformui'));
         }
         // Reverse dependencies
         if ($this->configResolver->hasParameter("yui.modules.{$module}.dependencyOf", 'ez_platformui')) {
             foreach ($this->configResolver->getParameter("yui.modules.{$module}.dependencyOf", 'ez_platformui') as $dep) {
                 // Add reverse dependency only if referred module is declared in the modules list.
                 if (!isset($modules[$dep])) {
                     if ($this->logger) {
                         $this->logger->error("'{$module}' is declared to be a dependency of undeclared module '{$dep}'. Ignoring.");
                     }
                     continue;
                 }
                 $yui['modules'][$dep]['requires'][] = $module;
             }
         }
         if ($combine === true) {
             $yui['modules'][$module]['combine'] = true;
         }
         if ($this->configResolver->getParameter("yui.modules.{$module}.type", 'ez_platformui') === 'template') {
             $yui['modules'][$module]['requires'][] = 'template';
             $yui['modules'][$module]['requires'][] = 'handlebars';
             $yui['modules'][$module]['fullpath'] = $this->router->generate('template_yui_module', ['module' => $module]);
         } else {
             $yui['modules'][$module]['fullpath'] = $this->asset($this->configResolver->getParameter("yui.modules.{$module}.path", 'ez_platformui'));
         }
     }
     // Now ensure that all requirements are unique
     foreach ($yui['modules'] as &$moduleConfig) {
         $moduleConfig['requires'] = array_unique($moduleConfig['requires']);
     }
     $res = '';
     if ($configObject != '') {
         $res = $configObject . ' = ';
     }
     return $res . (defined('JSON_UNESCAPED_SLASHES') ? json_encode($yui, JSON_UNESCAPED_SLASHES) : json_encode($yui)) . ';';
 }
Esempio n. 4
0
 /**
  * Returns configured template reference for the given embed parameters.
  *
  * @param $resourceType
  * @param $isInline
  * @param $isDenied
  *
  * @return null|string
  */
 protected function getEmbedTemplateName($resourceType, $isInline, $isDenied)
 {
     $configurationReference = $this->embedConfigurationNamespace;
     if ($resourceType === static::RESOURCE_TYPE_CONTENT) {
         $configurationReference .= '.content';
     } else {
         $configurationReference .= '.location';
     }
     if ($isInline) {
         $configurationReference .= '_inline';
     }
     if ($isDenied) {
         $configurationReference .= '_denied';
     }
     if ($this->configResolver->hasParameter($configurationReference)) {
         $configuration = $this->configResolver->getParameter($configurationReference);
         return $configuration['template'];
     }
     if (isset($this->logger)) {
         $this->logger->warning("Embed tag configuration '{$configurationReference}' was not found");
     }
     $configurationReference = $this->embedConfigurationNamespace;
     $configurationReference .= '.default';
     if ($isInline) {
         $configurationReference .= '_inline';
     }
     if ($this->configResolver->hasParameter($configurationReference)) {
         $configuration = $this->configResolver->getParameter($configurationReference);
         return $configuration['template'];
     }
     if (isset($this->logger)) {
         $this->logger->warning("Embed tag default configuration '{$configurationReference}' was not found");
     }
     return null;
 }
 /**
  * Returns if the provided siteaccess is running in legacy mode.
  *
  * @param string $siteAccessName
  *
  * @return bool
  */
 protected function isLegacyModeSiteAccess($siteAccessName)
 {
     if (!$this->configResolver->hasParameter('legacy_mode', 'ezsettings', $siteAccessName)) {
         return false;
     }
     return $this->configResolver->getParameter('legacy_mode', 'ezsettings', $siteAccessName);
 }
 /**
  * Returns value for $paramName, in $namespace.
  *
  * @param string $paramName The parameter name, without $prefix and the current scope (i.e. siteaccess name).
  * @param string $namespace Namespace for the parameter name. If null, the default namespace should be used.
  * @param string $scope The scope you need $paramName value for.
  *
  * @return mixed
  */
 public function configResolverGetParameter($paramName, $namespace = 'ezsettings')
 {
     $scope = null;
     if ($this->configResolver->hasParameter($paramName, $namespace, $scope)) {
         return $this->configResolver->getParameter($paramName, $namespace, $scope);
     } else {
         return null;
     }
 }
 /**
  * Creates additional tables specified in a configuration
  *
  * @throws \Exception
  */
 protected function createAdditionalSchema()
 {
     if (!$this->configResolver->hasParameter('sql_schema', 'siso_eshop')) {
         return;
     }
     $sqlSchema = $this->configResolver->getParameter('sql_schema', 'siso_eshop');
     foreach ($sqlSchema as $sqlFile) {
         $this->executeSqlFile($sqlFile);
     }
 }
 /**
  * @Given /^a pagelayout is configured$/
  */
 public function aPagelayoutIsConfigured()
 {
     $this->configResolver->hasParameter('pagelayout');
 }