Exemple #1
0
 /**
  * Sets default context, should be used only while bootstrapping the system
  *
  * @param string|\Spryker\Shared\Library\Context $context
  *
  * @return void
  */
 public static function setDefaultContext($context = self::CONTEXT_SHARED)
 {
     if ($context instanceof self) {
         static::$defaultContext = $context->_contextName;
     } else {
         static::$defaultContext = $context;
     }
 }
Exemple #2
0
 /**
  * Sets a variable or array of variables to the specified value(s)
  * in the default View context.  Any variables declared with this function
  * will be available to any view loaded using the {@link #load}
  * function.
  *
  * @param string|array $keyOrArray A variable name to set, or an
  * 		associative array of varName => value pairs.
  * @param mixed $value The value for the specified key.  If keyOrArray
  * 		is an associative array, this value is not used.
  */
 public static function setVar($keyOrArray, $value = false)
 {
     if (!static::$defaultContext) {
         static::$defaultContext = new ContextStack();
     }
     if (is_array($keyOrArray)) {
         static::$defaultContext->setArray($keyOrArray);
     } else {
         static::$defaultContext->set($keyOrArray, $value);
     }
 }