Resolve value by uses as attribute.

@param  \SimpleXMLElement  $content
@param  string  $use
@param  mixed  $default

@return mixed
194049
protected function getValueAttribute(SimpleXMLElement $content, string $use, $default = null)
    {
        return $this->castValue($this->getRawValueAttribute($content, $use, $default));
    }
542737
public function load($resolveXInclude = false){
        
        $returnValue = null;

        if(!$this->valid){
            libxml_use_internal_errors(true); //retrieve errors if no validation has been done previously
        }

        //load it using the DOMDocument library
        $xml = new DOMDocument();
        
        switch($this->sourceType){
            case self::SOURCE_FLYFILE:
                if ($this->source->exists()) {
                    $xml->load($this->source->read());
                }
                break;
            case self::SOURCE_FILE:
                $xml->load($this->source);
                break;
            case self::SOURCE_URL:
                $xmlContent = tao_helpers_Request::load($this->source, true);
                $xml->loadXML($xmlContent);
                break;
            case self::SOURCE_STRING:
                $xml->loadXML($this->source);
                break;
        }

        if($xml !== false){

            $basePath = '';
            if($this->sourceType == self::SOURCE_FILE || $this->sourceType == self::SOURCE_URL){
                $basePath = dirname($this->source).'/';
            }
            //build the item from the xml
            $parserFactory = new ParserFactory($xml, $basePath);
            try{
                $returnValue = $parserFactory->load();
            }catch(UnsupportedQtiElement $e){
                $this->addError($e);
            }

            if(!$this->valid){
                $this->valid = true;
                libxml_clear_errors();
            }
        }else if(!$this->valid){
            $this->addErrors(libxml_get_errors());
            libxml_clear_errors();
        }

        return $returnValue;
    }
760254
public function get(/*# string */ $id, $default = null)
    {
        if ($this->has($id)) {
            return $this->getRealContainer()->get(static::getRawId($id));
        } else {
            return $default;
        }
    }
1256634
public function getValue($name, $default = null)
    {
        return isset($this->data[$name]) ? $this->data[$name] : $default;
    }
1218926
protected function insertDefaultMenu( $content )
    {
        $root = $this->insertIntoTable(
            'menu',
            array(
                'type'  => 'container',
                'left'  => 1,
                'right' => 4,
            ),
            true
        );

        $this->insertIntoTable(
            'menu_label',
            array(
                'menuId'    => $root,
                'locale'    => 'en',
                'label'     => 'Default menu',
            )
        );

        $menuContent = $this->insertIntoTable(
            'menu',
            array(
                'type'  => 'content',
                'left'  => 2,
                'right' => 3,
            ),
            true
        );

        $this->insertIntoTable(
            'menu_label',
            array(
                'menuId'    => $menuContent,
                'locale'    => 'en',
                'label'     => 'Home',
            )
        );

        $this->insertIntoTable(
            'menu_property',
            array(
                'menuId'    => $menuContent,
                'name'      => 'contentId',
                'value'     => $content,
            )
        );

        return $root;
    }
652687
public static function referString($name, $default = null)
    {
        $res = self::getReferParams($name);
        if (!is_null($res)) return self::parseInputToString($res);
        return $default;
    }
1318660
function get($name, $default=null) {
    $map = array_map(function($name) use($default){
      if ($this->__isset($name)) {
        return $this->__attributes[$name]['value'];
      } elseif ($this->propertyExists($name, 'default')) {
        return $this->__attributes[$name]['default'];
      }

      return (null === $default) ? null : $default;
    }, (array) $name);

    return count($map) > 1 ? $map : $map[0];
  }
209733
private function resolveContent($content, array $matches)
    {
        if (3 < count($matches) && $content instanceof ContentSet) {
            return $this->resolveContentSet($content, $matches);
        }

        if (1 < count($matches) && is_object($content)) {
            $property = $matches[1];
            try {
                return $content->$property;
            } catch (\Exception $e) {
                return new Text();
            }
        }

        return $content;
    }
1006782
function usedCharset()
    {
        $charset = $this->contentCharset();
        if ( $this->isAllowedCharset( $charset ) )
            return $charset;
        return $this->outputCharset();
    }
1005639
public function resolve($key, $default = null)
    {
        $toReturn = $default;
        $dotted = explode(".", $key);

        if (count($dotted) > 1) {
            $currentDepthData = $this->source;

            foreach ($dotted as $paramKey) {
                if (array_key_exists($paramKey, $currentDepthData)) {
                    $currentDepthData = $currentDepthData[$paramKey];
                } else {
                    return $this->wrapIfNecessary($default);
                }
            }

            return $this->wrapIfNecessary($currentDepthData);
        }
        elseif (array_key_exists($key, $this->source)) {
            $toReturn = $this->source[$key];
        }

        return $this->wrapIfNecessary($toReturn);
    }
812068
public function resolve($string, $default = false)
    {
        if (strpos($string, '@') !== false) {
            list(, $key) = explode('@', $string, 2);

            $string = $this->translate($this->fullkey('vocabulary.'.$key), $default);
        }

        return $string;
    }
488864
public function getAttribute($name, $default = null)
    {
        $value = $default;
        if ($this->hasAttribute($name)) {
            $value = $this->attributes->get($name);
        }
        return $value;
    }
1352906
public function session($name = null, $default = null) {
        if (null === $name) {
            return $_SESSION;
        }
        if (isset($_SESSION[$name])) {
            return $_SESSION[$name];
        }
        return $default;
    }
244762
public function attr($key = null, $default = null)
    {
        return is_null($key) ? $this->attributes : array_get($this->attributes, $key, $default);
    }
273954
protected function getValueData(SimpleXMLElement $content, ?string $use, $default = null)
    {
        $value = $this->castValue(data_get($content, $use));

        if (empty($value) && ! \in_array($value, ['0'])) {
            return $default;
        }

        return $value;
    }
936717
public function getAttribute($key, $default = null)
	{
		$this->_fetchAttributes();
		$getter = 'get' . $key;
		if (method_exists($this, $getter)) {
			return $this->$getter();
		} else {
			return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
		}
	}
1226169
public function tidy($use_default = true)
    {
        if ($use_default) {
            return isset($this->tidy) ? $this->tidy : $this->default_tidy;
        }

        return $this->tidy;
    }