original_string: public function set($name, $value)
      {
          try {
              if (is_string($name) && (is_string($value) || $value === null)) {
                  if ($value === null) {
                      if (!array_key_exists($name, $this->defaults)) {
                          return false;
                      }
                      $value = $this->defaults[$name];
                  }
                  if ((new Query)->from(static::tableName())->where(['name' => $name])->exists()) {
                      Podium::getInstance()->db->createCommand()->update(
                          static::tableName(), ['value' => $value], ['name' => $name]
                      )->execute();
                  } else {
                      Podium::getInstance()->db->createCommand()->insert(
                          static::tableName(), ['name' => $name, 'value' => $value]
                      )->execute();
                  }
                  $this->cache->set('config', $this->notCached);
                  $this->_config = null;
                  return true;
              }
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code: public function set($name, $value)
      {
          try {
              if (is_string($name) && (is_string($value) || $value === null)) {
                  if ($value === null) {
                      if (!array_key_exists($name, $this->defaults)) {
                          return false;
                      }
                      $value = $this->defaults[$name];
                  }
                  if ((new Query)->from(static::tableName())->where(['name' => $name])->exists()) {
                      Podium::getInstance()->db->createCommand()->update(
                          static::tableName(), ['value' => $value], ['name' => $name]
                      )->execute();
                  } else {
                      Podium::getInstance()->db->createCommand()->insert(
                          static::tableName(), ['name' => $name, 'value' => $value]
                      )->execute();
                  }
                  $this->cache->set('config', $this->notCached);
                  $this->_config = null;
                  return true;
              }
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code_tokens: public function set ( $ name , $ value ) { try { if ( is_string ( $ name ) && ( is_string ( $ value ) || $ value === null ) ) { if ( $ value === null ) { if ( ! array_key_exists ( $ name , $ this -> defaults ) ) { return false ; } $ value = $ this -> defaults [ $ name ] ; } if ( ( new Query ) -> from ( static :: tableName ( ) ) -> where ( [ 'name' => $ name ] ) -> exists ( ) ) { Podium :: getInstance ( ) -> db -> createCommand ( ) -> update ( static :: tableName ( ) , [ 'value' => $ value ] , [ 'name' => $ name ] ) -> execute ( ) ; } else { Podium :: getInstance ( ) -> db -> createCommand ( ) -> insert ( static :: tableName ( ) , [ 'name' => $ name , 'value' => $ value ] ) -> execute ( ) ; } $ this -> cache -> set ( 'config' , $ this -> notCached ) ; $ this -> _config = null ; return true ; } } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
docstring: Sets configuration value of the given name.
  Every change automatically updates the cache.
  Set value to null to restore default one.
  @param string $name configuration key
  @param string $value configuration value
  @return bool
docstring_tokens: Sets configuration value of the given name . Every change automatically updates the cache . Set value to null to restore default one .