Возвращает/устанавливает значение атрибута в зависимости от аргументов.
**force** — задать значение атрибута даже если оно было задано ранее.
@param string $key
@param string [$value]
@param boolean [$force]
@return string|null|Context
767302
public function attr($key, $value = null, $force = false)
    {
        $attrs = $this->ctx->attrs ?: ($this->ctx->attrs = []);
        if (func_num_args() === 1) {
            return isset($attrs[$key]) ? $attrs[$key] : null;
        }

        $this->ctx->attrs[$key] = !array_key_exists($key, $attrs) || $force ? $value : $attrs[$key];

        return $this;
    }
1092108
public function leave(bool $force = false)
    {
        $url = $this->url.'/leave?'.http_build_query(['force' => $force]);

        return $this->curl->post($url);
    }
916307
public function getConnection($key, $force = false)
    {
        if ($force || !isset($this->connections[$key])) {
            if (!isset($this->config[$key])) {
                throw new \LogicException(sprintf('No set %s database', $key));
            }
            $config = $this->config[$key];
            $this->connections[$key] = new Database(
                [
                    'database_type' => isset($config['adapter']) ? $config['adapter'] : 'mysql',
                    'database_name' => $config['name'],
                    'server' => $config['host'],
                    'username' => $config['user'],
                    'password' => $config['pass'],
                    'charset' => isset($config['charset']) ? $config['charset'] : 'utf8',
                    'port' => isset($config['port']) ? $config['port'] : 3306,
                    'prefix' => isset($config['prefix']) ? $config['prefix'] : '',
                    'option' => isset($config['option']) ? $config['option'] : [],
                    'command' => isset($config['command']) ? $config['command'] : [],
                ]
            );
        }

        return $this->connections[$key];
    }
1294236
public static function getValue(string $key)
    {
        $key = \mb_strtolower($key);
        if(isset(self::$_data[$key])) {
            return self::$_data[$key];
        }
        return null;
    }
713835
public function getValue($key)
    {
        if (!isset($this->values[$key])) {
            return null;
        }
        return $this->values[$key];
    }
828652
public function value($field, $default = null, $force = false)
    {
        if (isset($this->options['field'])) {
            unset($this->options['field']);
        }
        $pdo = $this->field($field)->limit(1)->getPdo();
        if (is_string($pdo)) {
            // 返回SQL语句
            return $pdo;
        }
        $result = $pdo->fetchColumn();
        if ($force) {
            $result = is_numeric($result) ? $result + 0 : $result;
        }
        return false !== $result ? $result : $default;
    }
351309
public function getCTAs($force = false)
    {
        if ($this->nb_site_target_cta_list->isEmpty() || $force) {
            $this->nb_site_target_cta_list->clear();
            $this->nb_site_target_cta_list->merge(CNabuSiteTargetCTA::getSiteTargetCTAs($this));
            $translations = CNabuSiteTargetCTALanguage::getCTATranslationsForSiteTarget($this);
            if (is_array($translations) && count($translations) > 0) {
                foreach ($translations as $translation) {
                    $nb_site_target_cta = $this->nb_site_target_cta_list->getItem($translation->getSiteTargetCTAId());
                    if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
                        $nb_site_target_cta->setTranslation($translation);
                    }
                }
            }
            $roles = CNabuSiteTargetCTARole::getCTARolesForSiteTarget($this);
            if (is_array($roles) && count($roles) > 0) {
                foreach ($roles as $role) {
                    $nb_site_target_cta = $this->nb_site_target_cta_list->getItem($role->getSiteTargetCTAId());
                    if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
                        $nb_site_target_cta->addRole($role);
                    }
                }
            }
        }

        return $this->nb_site_target_cta_list;
    }
395308
public function GetValue($key) {
        $resources = $this->GetList();
        $actionLower = strtolower($this->ActionValue);
        $keyLower = strtolower($key);
        $actionExists = array_key_exists($actionLower, $resources);
        $keyExist = $actionExists ?
                array_key_exists($keyLower, $resources[$actionLower]) :
                false;
        if ($keyExist) {
            return $resources[$actionLower][$keyLower][F_controller_resource::F_CONTROLLER_RESOURCE_VALUE];
        } else {
//            $errMsg = 
//                    "The resource value doesn't exist. Module => " . 
//                    $this->ModuleValue . 
//                    " ; Action => " . 
//                    $this->ActionValue .
//                    "; Key => " . $key;
//            throw new Classes\ResourceNotFoundException($errMsg, ResourceErrors::RESOURCE_VALUE_NOT_FOUND, null);
            return "???";
        }
    }
249161
public static function get($key = false) {

        if (isset($_GET)) {

            if ($key) {

                return $_GET[$key];
            }

            return $_GET;
        }

        return false;
    }
810038
public static function getBoolean($key) {
		$ret = false;
		if (isset ( $_REQUEST [$key] )) {
			$ret = UString::isBooleanTrue ( $_REQUEST [$key] );
		}
		return $ret;
	}
289837
protected function getBoolValue( $key, $value = null )
	{
		$bool = $this->getValue( $key, $value );

		if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ))) {
			$bool = $this->postmeta->get( $bool );
		}
		return wp_validate_boolean( $bool );
	}
713501
public function getKey($key)
    {
        $tokens = explode('.', $key);


        $first = array_shift($tokens);
        $first = str_replace('POINT', '.', $first);

        $that = $this;

        $value = $that[$first];

        foreach($tokens as $k) {
            $k = str_replace('POINT', '.', $k);
            if (false === isset($value[$k])) {
                return null;
            }
            $value = $value[$k];
        }

        return $value;
    }
652556
public function isOnline( $force = FALSE ){
		if( $this->status === self::STATUS_UNKNOWN || $force )
			$this->check();
		return $this->status === self::STATUS_ONLINE;
	}
1110655
public static function pull(string $key)
  {
    if (Self::has($key)) {
      $value = Self::get($key);
      Self::forget($key);

      return $value;
    }

    return null;
  }
345268
public  function getBoolean( $key, bool $default_value = NULL )
    {
        $value = $this->getPropertyNodeValue( $key );

        // return default value if the element is null
        if ( NULL === $value ){
            return NULL === $default_value ? NULL : $default_value;
        }

        return boolval($value);
    }
796041
public function render($force = false) {

        if(empty($this->html) || $force) {

            if($this->selected) {
                $this->attributes['selected'] = 'selected';
            }
            else {
                unset($this->attributes['selected']);
            }

            $this->attributes['value'] = $this->getValue();

            $attr = [];

            foreach($this->attributes as $k => $v) {
                $attr[] = sprintf('%s="%s"', $k, $v);
            }

            $this->html = sprintf(
				'<option %s>%s</option>',
                implode(' ', $attr),
				$this->getLabel()->getLabelText()
			);
		}

		return $this->html;

	}
717641
protected function prepareSet($key, $force = false)
    {
        if (!$attribute = static::getMapper()->getAttribute($key)) {
            throw new Exception\UndefinedPropertyException(get_class($this) . ": Undefined property {$key}");
        }

        if ($attribute['deprecated']) {
            throw new Exception\DeprecatedPropertyException(get_class($this) . ": Property {$key} is deprecated");
        } elseif (!$force && $attribute['refuse_update'] && !$this->isFresh()) {
            throw new Exception\RefuseUpdatePropertyException(get_class($this) . ": Property {$key} refuse update");
        }

        return $attribute;
    }