Strip element name from Fqsen to return the namespace only

@param Element $element
@return mixed
195850
public static function getNamespace(Element $element) {
        return substr($element->getFqsen(), 0, strlen($element->getFqsen())-strlen('\\'. $element->getName()));
        //return str_replace('\\' . $element->getName(), '', $element->getFqsen());
    }
301889
protected static function getName( ElementInterface $element )
    {
        $name = $element->getName();

        if ( $name === null || $name === '' )
        {
            throw new Exception\DomainException( sprintf(
                '%s requires that the element has an assigned name; none discovered',
                __METHOD__
            ) );
        }

        return $name . '[]';
    }
1152155
private function createElement($element)
    {
        if ($element instanceof FilterElementInformationInterface) {
            $panelElement = new DefaultFilterElement();
            return $panelElement->setPropertyName($element->getPropertyName());
        }
        if ($element instanceof LimitElementInformationInterface) {
            return new DefaultLimitElement();
        }
        if ($element instanceof SearchElementInformationInterface) {
            return $this->buildSearchElement($element);
        }
        if ($element instanceof SortElementInformationInterface) {
            return new DefaultSortElement();
        }
        if ($element instanceof SubmitElementInformationInterface) {
            return new DefaultSubmitElement();
        }

        return null;
    }
398792
public function validate($element) {
        $this->last_error = null;
        $celement   = realpath($element);
        $cvalidator = realpath($this->location.DIRECTORY_SEPARATOR.$this->type);
        $result = (empty($celement) || empty($cvalidator));
        if (!$result) {
            $xml_error = new libxml_errors_mgr();
            $doc = new DOMDocument();
            $doc->validateOnParse = false;
            $result = $doc->load($celement, LIBXML_NONET) &&
                      $doc->schemaValidate($cvalidator);
        }
        return $result;
    }
1298961
public function convert(ElementInterface $element)
    {
        $value = $element->getValue();

        $markdown = '';

        $lines = preg_split('/\r\n|\r|\n/', $value);

        foreach ($lines as $line)
        {
            /*
             * Some special characters need to be escaped based on the position that they appear
             * The following function will deal with those special cases.
             */

            $markdown .= $this->escapeSpecialCharacters($line);
            $markdown .= "\n";
        }

        return trim($markdown) !== '' ? "\n" . rtrim(ltrim($markdown)) . "\n" : '';
    }
1104795
protected function transform(DOMDocument $element)
    {
        foreach ($this->transformers as $transformer) {
            $transformer($element);
        }

        return $element;
    }
1047663
protected function formatKeywordElement(KeywordElement $element)
    {
        $name = $element->getName();
        $keyword = $this->getOption(['keywords', $name]);
        $result = call_user_func($keyword, $element->getValue(), $element, $name);

        if (is_string($result)) {
            $result = ['begin' => $result];
        }

        if (!is_array($result) && !($result instanceof \ArrayAccess)) {
            $this->throwException(
                "The keyword $name returned an invalid value type, string or array was expected.",
                $element
            );
        }

        foreach (['begin', 'end'] as $key) {
            $result[$key] = (isset($result[$key.'Php'])
                ? "<?php\n".$result[$key.'Php']."\n?>"
                : ''
            ).(isset($result[$key])
                ? $result[$key]
                : ''
            );
        }

        return implode('', array_filter([
            $result['begin'],
            $this->formatElementChildren($element),
            $result['end'],
        ]));
    }
397916
public static function getChildNodesOfName(\DOMElement $element, $elementName) {
    $result = [];
    foreach ($element->childNodes as $child) {
      if ($child->nodeName == $elementName) {
        $result[] = $child;
      }
    }
    return $result;
  }
130302
public function convert(ElementInterface $element)
    {
        $regex = '(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9]\.[^\s]{2,})';

        preg_match($regex, $value = $element->getValue(), $matches);

        if (! isset($matches[0]))
        {
            $value = mb_convert_case($value, MB_CASE_UPPER, 'UTF-8');
        }

        return "\n" . $value . "\n";
    }
215423
protected function prepareElement($element)
    {
        $options    = $this->getOptions();
        $currClass  = $element->getAttribute('class');
        $class      = $currClass . (null !== $currClass ? ' ' : '') . $options['class'];

        $element->setAttributes(array(
            'class'             => $class,
            'data-color'        => $options['color'],
            'data-color-format' => $options['format'],
        ));

        return $element;
    }
470585
protected static function r_implode($element)
    {
        $string = '';

        if (is_array($element)) {
            reset($element);
            foreach ($element as $value) {
                $string .= ' ' . self::r_implode($value);
            }
        }
        else {
            return $element;
        }

        return '(' . trim($string) . ')';
    }
175745
public function getValidationMessageFor($element)
    {
        $errorLabel = $this->getElement($element)->getParent()->find('css', '.sylius-validation-error');

        if (null === $errorLabel) {
            throw new ElementNotFoundException(
                $this->getSession(),
                'Validation message', 'css', '.sylius-validation-error')
            ;
        }

        return $errorLabel->getText();
    }
1071571
private function getFieldElement($element)
    {
        $element = $this->getElement($element);
        while (null !== $element && !$element->hasClass('field')) {
            $element = $element->getParent();
        }

        return $element;
    }
753906
public function detectNamespacesFromSimpleXmlElement( $element )
	{
		$namespaces	= self::getNamespacesFromSimpleXmlElement( $element );
		$this->namespaces	= array_merge( $this->namespaces, $namespaces );
		return count( $namespaces );
	}
287879
public function remove($element)
    {
        $hash = $this->hash($element);
        if (isset($this->hashTable[$hash])) {
            $i = array_search($element, $this->hashTable[$hash], true);
            if ($i !== false) {
                unset($this->hashTable[$hash][$i]);
                return true;
            }
        }
        return false;
    }
449145
public function getSpecification($element = '')
    {
        if (isset($element) && $element !== '') {
            $spec = $this->pattern->specification[$this->getOption('doctype')][$element];
        } else {
            $spec = $this->pattern->specification[$this->getOption('doctype')];
        }
        return $spec;
    }
1192993
protected function extractNodesFromElement($element)
    {
        $references = array();
        if ($this->isNodeChoiceAttribute($element)) {
            $references = array($this->extractNodeFromChoiceAttribute($element));
        } elseif (is_string($element) && $this->hasInternalLinkBBCode($element)) {
            $references = array_merge($references, $this->extractNodeFromBBCode($element));
        } elseif (is_array($element)) {
            foreach ($element as $item) {
                $references = array_merge($references, $this->extractNodesFromElement($item));
            }
        }
        return $references;
    }