Return a property value (type and tag name dependent)

@param \DOMElement $element DOM element
@return string Property value
177152
protected function getPropertyStringValue(\DOMElement $element)
    {
        // If HTML mode is active
        if ($this->html) {
            $value = $this->getPropertyContentAttrValue($element);
            if ($value === null) {
                $value = $this->getPropertyHtmlValue($element);
            }
            if ($value !== null) {
                return $value;
            }
        }

        // Return the text content
        return $element->textContent;
    }
723228
public function getContentForElement(Element $element) : string
    {
        if ($element instanceof HasChildren && $element instanceof HasContent) {
            throw new InvalidArgumentException('An element can only implement one of HasChildren and HasContent');
        }

        if ($element instanceof HasChildren) {
            $renderedChildren = array_map(function(Element $element) {
                return $this->renderElement($element);
            }, $element->getChildren());

            return implode('', $renderedChildren);
        }

        if ($element instanceof HasContent) {
            return $element->getContent();
        }

        return '';
    }
772898
public function getNamespaces(\DOMElement $element = null)
    {
        if ($this->xpath === null) {
            $this->xpath = new \DOMXPath($this);
        }

        if ($element === null) {
            $nodes = $this->xpath->query('namespace::*');
        } else {
            $nodes = $this->xpath->query('namespace::*', $element);
        }

        $ns = array();

        if ($nodes) {
            foreach ($nodes as $node) {
                $arr = $element->getAttribute($node->nodeName);

                if ($arr) {
                    $ns[$node->nodeName] = $arr;
                }
            }

            $nodes = null;
        }

        return $ns;
    }
8857
protected function weightAttribute(\DOMElement $element, $attribute)
    {
        if (!$element->hasAttribute($attribute)) {
            return 0;
        }
        $weight = 0;

        // $attributeValue = trim($element->getAttribute('class')." ".$element->getAttribute('id'));
        $attributeValue = trim($element->getAttribute($attribute));

        if ('' !== $attributeValue) {
            if (preg_match($this->regexps['negative'], $attributeValue)) {
                $weight -= 25;
            }
            if (preg_match($this->regexps['positive'], $attributeValue)) {
                $weight += 25;
            }
            if (preg_match($this->regexps['unlikelyCandidates'], $attributeValue)) {
                $weight -= 5;
            }
            if (preg_match($this->regexps['okMaybeItsACandidate'], $attributeValue)) {
                $weight += 5;
            }
        }

        return $weight;
    }
649330
private function getOptionValue(\DOMElement $option)
    {
        if ($option->hasAttribute('value')) {
            return $option->getAttribute('value');
        }

        if (!empty($option->nodeValue)) {
            return $option->nodeValue;
        }

        return '1'; // DomCrawler uses 1 by default if there is no text in the option
    }
321952
private function prepareTextValue(DOMElement $xml, array $attributes = null)
    {
        $text = static::getElementText($xml, true);

        return (isset($attributes['type']) && 'text' === $attributes['type']) ?
            static::clearValue($text) :
            static::getPhpValue($text, null, $this);
    }
394276
public function inlineCssOnElement(\DOMElement $element, array $properties)
    {
        if (empty($properties)) {
            return $element;
        }

        $cssProperties = array();
        $inlineProperties = array();

        foreach ($this->getInlineStyles($element) as $property) {
            $inlineProperties[$property->getName()] = $property;
        }

        foreach ($properties as $property) {
            if (!isset($inlineProperties[$property->getName()])) {
                $cssProperties[$property->getName()] = $property;
            }
        }

        $rules = array();
        foreach (array_merge($cssProperties, $inlineProperties) as $property) {
            $rules[] = $property->toString();
        }
        $element->setAttribute('style', implode(' ', $rules));

        return $element;
    }
633610
protected function getIndexKey($element)
    {
        $key = $element->getFullyQualifiedStructuralElementName();

        // properties should have an additional $ before the property name
        if ($element instanceof PropertyInterface) {
            list($fqcn, $propertyName) = explode('::', $key);
            $key = $fqcn . '::$' . $propertyName;
        }

        return $key;
    }
183512
public function retriveAttributeVisibility(\DOMElement $element)
    {
        $name = $this->engine->query($element->getNodePath() . '/dia:attribute[@name="visibility"]/dia:enum');
        $propertyVisibility = $name->item(0)->attributes->getNamedItem('val')->nodeValue;

        return self::$propertyVisibilityTypes[$propertyVisibility];
    }
751774
private function getAttrAsArray(\DOMElement $element)
    {
        $return = [];
        for ($i = 0; $i < $element->attributes->length; ++$i) {
            $return[$element->attributes->item($i)->nodeName] = $element->attributes->item($i)->nodeValue;
        }

        return $return;
    }
756450
private function getFieldValue($propertyName)
    {
        // get type of input data (where we must look it up)
        $inputType = Str::lowerCase($this->_sendMethod);
        $filterType = 'text';
        // get declared field sources and types
        $sources = $this->sources();
        $types = $this->types();
        // validate sources for current field
        if (array_key_exists($propertyName, $sources)) {
            $inputType = Str::lowerCase($sources[$propertyName]);
        }


        // check if field is array-nested element by dots and use first element as general
        $filterField = $propertyName;
        if (array_key_exists($filterField, $types)) {
            $filterType = Str::lowerCase($types[$filterField]);
        }

        // get clear field value
        $propertyValue = $this->getRequest($propertyName, $inputType);

        // apply security filter for input data
        if ($inputType !== 'file') {
            if ($filterType === 'html') {
                $propertyValue = App::$Security->secureHtml($propertyValue);
            } elseif ($filterType !== '!secure') {
                $propertyValue = App::$Security->strip_tags($propertyValue);
            }
        }

        return $propertyValue;
    }
1172600
protected function unmarshall(DOMElement $element)
    {
        try {
            $mapKey = $this->getDOMElementAttributeAs($element, 'mapKey');
            $mapKey = Utils::stringToDatatype($mapKey, $this->getBaseType());

            if (($mappedValue = $this->getDOMElementAttributeAs($element, 'mappedValue', 'float')) !== null) {

                $object = new MapEntry($mapKey, $mappedValue);

                if (Version::compare($this->getVersion(), '2.0.0', '>') && ($caseSensitive = $this->getDOMElementAttributeAs($element, 'caseSensitive', 'boolean')) !== null) {
                    $object->setCaseSensitive($caseSensitive);
                }

                return $object;
            } else {
                $msg = "The mandatory 'mappedValue' attribute is missing from element '" . $element->nodeName . "'.";
                throw new UnmarshallingException($msg, $element);
            }
        } catch (UnexpectedValueException $e) {
            $msg = "The value '${mapKey}' of the 'mapKey' attribute could not be converted to a '" . BaseType::getNameByConstant($this->getBaseType()) . "' value.";
            throw new UnmarshallingException($msg, $element, $e);
        }
    }
938355
public function getInlineStyles(\DOMElement $element)
    {
        $processor = new PropertyProcessor();

        return $processor->convertArrayToObjects(
            $processor->splitIntoSeparateProperties(
                $element->getAttribute('style')
            )
        );
    }
345183
protected function parseType(DOMElement $element, $flagRequired = true)
    {
        if ($flagRequired || (!$flagRequired && $element->hasAttribute('type'))) {
            $this->type = XmlUtil::getRequiredAttributeValue($element, 'type');
        }
    }
1337755
private function buildSearchElement($element)
    {
        $panelElement = new DefaultSearchElement();
        foreach ($element->getPropertyNames() as $propName) {
            $panelElement->addProperty($propName);
        }

        return $panelElement;
    }
569735
public function formElement(IElement $element)
    {
        if ($element instanceof Textarea) {
            return $this->formTextarea($element);
        } elseif ($element instanceof Select) {
            return $this->formSelect($element);
        } elseif ($element instanceof Submit) {
            return $this->formInput($element);
        } elseif ($element instanceof Button) {
            // todo: is it right?
            throw new InvalidArgumentException("Button element should be rendered without Helper.");
        } else {
            return $this->formInput($element);
        }
    }
558950
protected function elementIsBlock(DOMElement $element)
	{
		$style = $this->getStyle($element);
		if (preg_match('(\\bdisplay\\s*:\\s*block)i', $style))
		{
			return true;
		}
		if (preg_match('(\\bdisplay\\s*:\\s*(?:inli|no)ne)i', $style))
		{
			return false;
		}

		return ElementInspector::isBlock($element);
	}