@param null|HtmlElement[] $children

@throws Exception\InvalidArgumentException
@return string
517413
public function renderChildren($children = null)
    {
        if (null === $children) {
            $children = $this->getChildren();
        }

        if (!is_array($children)) {
            throw new Exception\InvalidArgumentException(
                'Invalid children type supplied. Expected array or null.'
            );
        }

        $content = '';

        /* @var $child HtmlElement */
        foreach ($children as $child) {
            $content .= $child->render();
        }

        return $content;
    }
780753
protected static function deserializeVarsRec( $children, &$element )
	{
		foreach( $children as $child )
		{
			$name		= $child->getAttribute( 'name' );
			$vartype	= $child->getNodeName();
			if( is_object( $element ) )
			{
				if( !isset( $element->$name ) )
					$element->$name	= NULL;
				$pointer	=& $element->$name;
			}
			else
			{
				if( !isset( $element->$name ) )
					$element[$name]	= NULL;
				$pointer	=& $element[$name];
			}
			
			switch( $vartype )
			{
				case 'boolean':
					$pointer	= (bool) $child->getContent();
					break;
				case 'string':
					$pointer	= utf8_decode( $child->getContent() );
					break;
				case 'integer':
					$pointer	= (int) $child->getContent();
					break;
				case 'double':
					$pointer	= (double) $child->getContent();
					break;
				case 'array':
					$pointer	= array();
					self::deserializeVarsRec( $child->getChildren(), $pointer );
					break;
				case 'object':
					$class		= $child->getAttribute( 'class' );
					$pointer	= new $class();
					self::deserializeVarsRec( $child->getChildren(), $pointer );
					break;
				default:
					$pointer	= NULL;
					break;
			}
		}
	}
744740
private function outputChildren($children, $depth)
    {
        if ($children) {
            foreach ($children as $childNode) {
                if ($childNode->getInfo() === 'Prototype') {
                    $childNode->setInfo('');
                    $hasChildren = !$childNode instanceof ArrayNode || !$childNode->getChildren();
                    $this->writeNode($childNode, $depth + 1, $hasChildren);
                } else {
                    $this->writeNode($childNode, $depth + 1);
                }
            }
        }

        if ($children || $this->example || $this->defaultArray) {
            $this->writeLine('],', $depth * 4);
        }
    }
643883
private function buildChildrenErrors(array $childrenErrors, $msg)
    {
        if (!empty($childrenErrors)) {
            $msg .= PHP_EOL.'- children:';

            foreach ($childrenErrors as $child => $errors) {
                $msg .= sprintf('%s  - %s', PHP_EOL, $child);
                $msg .= sprintf('%s    - errors:', PHP_EOL);

                foreach ($errors as $error) {
                    $msg .= sprintf('%s      - %s', PHP_EOL, $error);
                }
            }
        }

        return $msg;
    }
716697
protected static function wrapChildren($item, $children){
        if((is_string($item['child_wrap']) || is_array($item['child_wrap'])) && !empty($item['child_wrap'])){
            return (is_array($item['child_wrap']) ? '<'.$item['child_wrap'][0].' class="'.$item['child_wrap'][1].'">' : '<'.$item['child_wrap'].'>').$children.(is_array($item['child_wrap']) ? '</'.$item['child_wrap'][0].'>' : '</'.$item['child_wrap'].'>');
        }
        return $children;
    }
641155
public function findHierarchiesByParentsAndChildren(User $user, array $parents, array $children)
    {
        if (count($parents) === 0 || count($children) === 0) {
            throw new \InvalidArgumentException('Array argument cannot be empty');
        }

        $parentIndex = 0;
        $eol = PHP_EOL;
        $parentsTest = '(';

        foreach ($parents as $parent) {
            $parentsTest .= $parentIndex > 0 ? '    OR ' : '    ';
            $parentsTest .= "p.id = {$parent}{$eol}";
            $parentIndex++;
        }
        $parentsTest .= "){$eol}";

        $childrenIndex = 0;
        $childrenTest = '(';

        foreach ($children as $child) {
            $childrenTest .= $childrenIndex > 0 ? '    OR ' : '    ';
            $childrenTest .= "t.id = {$child}{$eol}";
            $childrenIndex++;
        }
        $childrenTest .= "){$eol}";

        $dql = "
            SELECT h
            FROM Claroline\CoreBundle\Entity\Workspace\WorkspaceTagHierarchy h
            JOIN h.parent p
            JOIN h.tag t
            WHERE h.user = :user
            AND h.level > 0
            AND {$parentsTest}
            AND {$childrenTest}
        ";
        $query = $this->_em->createQuery($dql);
        $query->setParameter('user', $user);

        return $query->getResult();
    }
1307253
private function createElement($type, $children = array(), array $attributes = array(), $text = null)
    {
        $element = new NodeElement();
        $element->openTag($type);

        if (!empty($attributes)) {
            $element->addAttributes($attributes);
        }

        if (!empty($children)) {
            if ($children instanceof NodeElement) {
                $children = array($children);
            }

            $element->appendChildren($children);
        }

        if ($text !== null) {
            $element->setText($text);
        }

        $element->closeTag();

        return $element;
    }
410537
public static function getChildByArray(array $keys, array $values, $default = null) {
		switch (count($keys)) {
			case 0:
				return $values;
			case 1:
				return array_key_exists($keys[0], $values) ? $values[$keys[0]] : $default;
			case 2:
				return isset($values[$keys[0]][$keys[1]]) ? $values[$keys[0]][$keys[1]] : $default;
			case 3:
				return isset($values[$keys[0]][$keys[1]][$keys[2]]) ? $values[$keys[0]][$keys[1]][$keys[2]] : $default;
			case 4:
				return isset($values[$keys[0]][$keys[1]][$keys[2]][$keys[3]]) ? $values[$keys[0]][$keys[1]][$keys[2]][$keys[3]] : $default;
			default:
				return isset($values[$keys[0]]) ? self::getChildByArray(array_slice($keys, 1), $values[$keys[0]], $default) : $default;
		}
	}
874851
public static function filterOutElements($children, $lookup)
    {
        if (!is_array($lookup)) {
            $lookup = array($lookup => true);
        }

        // backward compatibility - ensure provided array is a lookup
        foreach ($lookup as $key => $value) {
            if (!is_string($key)) {
                unset($lookup[$key]);
                $lookup[$value] = true;
            }
        }

        $result = array();
        foreach ((array) $children as $child) {
            if ($child instanceof HTMLPurifier_Node_Element) {
                $filteredChildren = self::filterOutElements($child->children, $lookup);
                if (isset($lookup[$child->name])) {
                    // don't add removed element, only its children
                    foreach ($filteredChildren as $c) {
                        $result[] = $c;
                    }
                    continue;
                }
                $child->children = $filteredChildren;
            }
            $result[] = $child;
        }

        return $result;
    }
970800
public function setChildren($children)
    {
        if (is_array($children)) {
            $c = [];
            foreach ($children as $name => $child) {
                list($package, $link, $children) = $child;
                $c[] = new self($name, $this->type, $package, $link, $children);
            }

            $this->children = $c;
        }

        return $this;
    }
1271067
private function loadPKCS8(array $children)
    {
        $binary = hex2bin($children[2]->getContent());
        $asnObject = ASNObject::fromBinary($binary);
        Assertion::isInstanceOf($asnObject, Sequence::class);

        return $asnObject->getChildren();
    }
338085
public function removeChildren($children)
    {
        array_splice($this->children, $children[0]->getIndex(), count($children));
        $this->flush();

        return $this;
    }
1040896
protected function sortChildrenByPosition($parent, $childrenPropertyPath)
    {
        $collection = $this->getPropertyAccessor()->getValue($parent, $childrenPropertyPath);

        if ($collection instanceOf PersistentCollection) {
            /** @var PersistentCollection $collection */
            if (false === $collection->isInitialized()) {
                $collection->initialize();
            }
            $collection = $collection->unwrap();
        }

        if (!$collection instanceOf ArrayCollection) {
            throw new \InvalidArgumentException('Expected ArrayCollection.');
        }

        /** @var ArrayCollection $collection */
        $iterator = $collection->getIterator();
        $iterator->uasort(function (SortableInterface $a, SortableInterface $b) {
            return
                ($a->getPosition() == $b->getPosition()) ? 0 :
                    ($a->getPosition() < $b->getPosition()) ? -1 : 1;
        });

        $collection->clear();
        foreach ($iterator as $key => $item) {
            $collection->set($key, $item);
        }
    }
1324204
protected function getElementByTagInChildren(array $children, $tagName)
    {
        $elements = array();

        foreach ($children as $child) {
            if ($child instanceof BBcodeElementNode) {
                if ($tagName === $child->getTagName()) {
                    $elements[] = $child;
                }
                array_merge($elements, $this->getElementByTagInChildren($child->getChildren(), $tagName));
            }
        }

        return $elements;
    }
963279
public static function getChildWithStar($keys, array $values, $default = null, $link = '.') {
		$keys = explode($link, $keys, 2);
		$results = null;
		if ($keys[0] === '*') {
			$results = $values;
		} else {
			$results = array_key_exists($keys[0], $values) ? $values[$keys[0]] : $default;
		}
		if (count($keys) == 1) {
			return $results;
		}
		return self::getChildWithStar($keys[1], $results, $default, $link);
	}
134870
public function class($classes): Htmlable
    {
        if ($classes instanceof Collection) {
            $classes = $classes->toArray();
        }

        $attributes = new Attributes();
        $attributes->addClass($classes);

        return new HtmlString(
            $attributes->render()
        );
    }
723883
final String childrenToString(final WComponent... children) {
		if (!(this instanceof Container)) {
			return "";
		}

		if (children == null || children.length == 0) {
			return "[]";
		}

		StringBuffer buf = new StringBuffer("\n[");

		for (int i = 0; i < children.length; i++) {
			buf.append(i == 0 ? "\n   " : ",\n   ");
			buf.append(children[i].toString().replaceAll("\n", "\n   "));
		}

		buf.append("\n]");
		return buf.toString();
	}