Gets an an attribute from the cart.

@param $attribute
@param $defaultValue

@return mixed
344447
public function getAttribute($attribute, $defaultValue = null)
    {
        return array_get($this->cart->attributes, $attribute, $defaultValue);
    }
1181201
public function getNullableValue($defaultValue = self::NULLABLE_DEFAULT)
    {
        $isNullable = !$this->isNotNull();

        return $isNullable === $defaultValue ? ($this->isAlwaysNullable() ? $isNullable : null) : $isNullable;
    }
799526
public function getValue(string $key, $defaultValue = null)
    {
        if (isset($this->orgData[$key])) {
            if (isset($this->removeAttributes[$key])) {
                // 已经被删除
                return $defaultValue;
            } elseif (isset($this->updateAttributes[$key])) {
                // 被修改
                return $this->updateAttributes[$key];
            }
            return $this->orgData[$key];
        } else {
            if (isset($this->addAttributes[$key])) {
                return $this->addAttributes[$key];
            }
            return $defaultValue;
        }
    }
24193
public function get(string $key, $defaultValue = null)
    {
        $key = $this->prepareKey($key);
        return Arr::get($this->properties, $key, $defaultValue);
    }
556991
public function getAttribute($attribute)
    {
        switch ($attribute) {
            case self::PROPEL_ATTR_CACHE_PREPARES:
                return $this->isCachePreparedStatements;
                break;
            default:
                return $this->connection->getAttribute($attribute);
        }
    }
153865
public function getMetadataAttr(string $attr, $defaultValue = null, array $options = [])
    {
        return $this->getMetadata()->get($attr, $defaultValue, $options);
    }
555210
public function optionalItem($key, $defaultValue = null)
    {
        if (!$this->hasItem($key)) {
            return $defaultValue;
        }

        return $this->getItem($key);
    }
632411
public function getDbAttribute($attribute, $default = null)
    {
        return isset($this->_dbAttributes[$attribute]) ? $this->_dbAttributes[$attribute] : $default;
    }
537777
public function getValue(string $key, $defaultValue = null)
    {
        if ($this->offsetExists($key)) {
            return $this->offsetGet($key);
        } else {
            return $defaultValue;
        }
    }
317273
public function get($name, $default = null)
    {
        return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
    }
429035
private function getAttr(\DOMNode $node, $attr, $default = null)
    {
        $attr = $node->attributes->getNamedItem($attr);
        return isset($attr) ? $attr->nodeValue : $default;
    }
1298415
public synchronized boolean getAttribute(String key, boolean defaultValue)
	{
		if(attributes.containsKey(key))
		{
			Object obj = attributes.get(key);
			if(obj instanceof Boolean)
			{
				return (Boolean) obj;
			}
		}
		return defaultValue;
	}
255173
public function getObjectByPathOrDefault($path, array $defaultValue)
    {
        try {
            $object = $this->getObjectByPath($path);
        } catch (\InvalidArgumentException $e) {
            return $defaultValue;
        }

        if (!is_array($object)) {
            return $defaultValue;
        }

        return $object;
    }
711589
protected function getConfig($key, $defaultValue = null)
    {
        $config = $this->readConfig();
        
        return isset($config[$key]) ? $config[$key] : $defaultValue;
    }
715090
public function getAttribute($attribute)
    {
        switch ($attribute) {
            case self::PROPEL_ATTR_CACHE_PREPARES:
                return $this->cachePreparedStatements;
                break;
            case self::PROPEL_ATTR_CONNECTION_NAME:
                return $this->connectionName;
                break;
            default:
                return parent::getAttribute($attribute);
        }
    }
1165367
public function getValue($defaultValue = null)
    {
        if ($this->read === false) {
            if (isset($_COOKIE[$this->name])) {
                if ($this->useEncryption === true) {
                    return $this->value = $this->decrypt($_COOKIE[$this->name]);
                }

                return $this->value = $_COOKIE[$this->name];
            }

            return $defaultValue;
        }

        return $this->value;
    }
911204
public function getValueFor($name, $defaultValue = null)
    {
        if (!$this->hasParameter($name)) {
            return $defaultValue;
        }
        return $this->parameters[strtolower($name)]->getValue();
    }