@param Dependency[]|false $children

@return Dependency
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;
    }
431719
public function children($path)
    {
        $children = $this->children[(string)$path] ?? [];

        return new Collection($children, [], $this);
    }
584051
private function fixDependencies(array $tests)
    {
        $tests_dependencies = $tests_methods = [];

        foreach ($tests as $i => $test) {
            $reflected = new \ReflectionObject($test);
            $name_field = $dependencies_field = null;

            while ($reflected = $reflected->getParentClass()) {
                try {
                    if (empty($dependencies_field)) {
                        $dependencies_field = $reflected->getProperty('dependencies');
                        $dependencies_field->setAccessible(true);
                    }
                    if (empty($name_field)) {
                        $name_field = $reflected->getProperty('name');
                        $name_field->setAccessible(true);
                    }
                } catch (\ReflectionException $e ){
                    //do nothing
                }
            }

            if (empty($name_field)) {
                return $tests;
            }

            $tests_methods[$name_field->getValue($test)] = $i;

            if (empty($dependencies = $dependencies_field->getValue($test))){
                continue;
            }
            foreach ($dependencies as $dependency) {
                $tests_dependencies[$name_field->getValue($test)] = $dependency;
            }
        }

        if (empty($tests_dependencies)) {
            return $tests;
        }

        $new_order = $this->setOrder($tests_dependencies, $tests_methods);
        $new_tests_order = [];
        foreach ($new_order as $test_name) {
            $new_tests_order[] = $tests[$tests_methods[$test_name]];
        }

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

        return $this;
    }
859147
public function addChildren(Collection $children)
    {
        foreach ($children as $child) {
                $this->addChild($child);
        }

        return $this;
    }
23906
public function loadChildren()
    {
        $loader = new CollectionLoader([
            'logger'  => $this->logger,
            'factory' => $this->modelFactory()
        ]);
        $loader->setModel($this);

        $loader->addFilter([
            'property' => 'master',
            'value'      => $this->id()
        ]);
        $loader->addFilter([
            'property' => 'active',
            'value'      => true
        ]);

        $loader->addOrder([
            'property' => 'position',
            'mode'     => 'asc'
        ]);

        return $loader->load();
    }
834437
public function withDependencies(array $lookups)
        {
            $endPoint =& $this->_getEndPoint();
            $endPoint['args'] = array();
            foreach ($lookups as $lookup) {
                $this->addConstructorLookup($lookup);
            }

            return $this;
        }
374810
protected function applyDependencies($sources, \Traversable $dependencies, callable $insert)
    {
        foreach ($dependencies as $query => $subDependencies) {
            $joinedCode = '';
            foreach ($subDependencies as $file) {
                $joinedCode .= $insert($file);
            }
            $sources = str_replace($query, $joinedCode, $sources);
        }

        return $sources;
    }
434906
public function getChildDependencies($moduleName, $convertPackageNameToNamespace = true, $getOnlyActiveModules = true)
    {
        $modules = $this->getAllModules();
        $matchModule = $convertPackageNameToNamespace ? $moduleName : $this->convertToPackageName($moduleName);
        $dependents = [];

        foreach ($modules as $module) {
            $dependencies = $this->getDependencies($module, $convertPackageNameToNamespace);

            if ($dependencies) {
                if (in_array($matchModule, $dependencies)) {
                    $dependents[] = $convertPackageNameToNamespace ? $module : $this->convertToPackageName($module);
                }
            }
        }

        if (true === $getOnlyActiveModules) {

            $activeModules = $this->getActiveModules();
            $modules = [];

            foreach ($dependents as $module) {
                $modules[] = $module;
            }

            $dependents = $modules;
        }

        return $dependents;
    }
333429
public function setChildren($children, $mapper = null)
    {
        $element = clone $this;

        $element->children = new Collection();

        return $element->addChildren($children, $mapper);
    }
23505
public function setChildren(array $children, $compoundLevel = null)
    {
        // TODO: Try to refactor this logic
        $compoundLevel = $compoundLevel ?? $this->getCompoundLevel($children);
        $immediateChildren = [];
        $grandchildren = [];
        $newContentType = $this->userContentType;

        foreach ($children as $child) {
            $level = $this->getNeededChildLevel($child, $compoundLevel);
            if (empty($immediateChildren)) {
                //first iteration
                $immediateChildren = [$child];
            } else {
                $nextLevel = $this->getNeededChildLevel($immediateChildren[0], $compoundLevel);
                if ($nextLevel == $level) {
                    $immediateChildren[] = $child;
                } elseif ($level < $nextLevel) {
                    // Re-assign immediateChildren to grandchildren
                    $grandchildren = array_merge($grandchildren, $immediateChildren);
                    // Set new children
                    $immediateChildren = [$child];
                } else {
                    $grandchildren[] = $child;
                }
            }
        }

        if ($immediateChildren) {
            $lowestLevel = $this->getNeededChildLevel($immediateChildren[0], $compoundLevel);

            // Determine which composite media type is needed to accommodate the
            // immediate children
            foreach ($this->compositeRanges as $mediaType => $range) {
                if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) {
                    $newContentType = $mediaType;

                    break;
                }
            }

            // Put any grandchildren in a subpart
            if (!empty($grandchildren)) {
                $subentity = $this->createChild();
                $subentity->setNestingLevel($lowestLevel);
                $subentity->setChildren($grandchildren, $compoundLevel);
                array_unshift($immediateChildren, $subentity);
            }
        }

        $this->immediateChildren = $immediateChildren;
        $this->children = $children;
        $this->setContentTypeInHeaders($newContentType);
        $this->fixHeaders();
        $this->sortChildren();

        return $this;
    }
1184139
public static function buildDependencies(DependencyBuilder $dependencies)
    {
        $classes = [
            // guarantee DoctrineBundle
            DoctrineBundle::class,
            // guarantee ORM
            Column::class,
        ];

        foreach ($classes as $class) {
            $dependencies->addClassDependency(
                $class,
                'orm'
            );
        }
    }
507949
public function addChildren(array $children)
    {
        if ($this->isVoid) {
            throw new Exception\RuntimeException(
                'Void elements can\'t have child elements.'
            );
        }

        foreach ($children as $child) {
            $this->addChild($child);
        }

        return $this;
    }
1003488
private function loadPrivatePEM(array $children)
    {
        $this->verifyVersion($children[0]);
        $x = null;
        $y = null;
        $d = $this->getD($children[1]);
        $this->getXAndY($children[3], $x, $y);

        Assertion::isInstanceOf($children[2], ExplicitlyTaggedObject::class, 'Unable to load the key');
        Assertion::isArray($children[2]->getContent(), 'Unable to load the key');
        Assertion::isInstanceOf($children[2]->getContent()[0], ObjectIdentifier::class, 'Unable to load the key');

        $curve = $children[2]->getContent()[0]->getContent();

        $this->private = true;
        $this->values['kty'] = 'EC';
        $this->values['crv'] = $this->getCurve($curve);
        $this->values['d'] = Base64Url::encode(hex2bin($d));
        $this->values['x'] = Base64Url::encode(hex2bin($x));
        $this->values['y'] = Base64Url::encode(hex2bin($y));
    }
475714
public function with($packages)
    {
        $packages = is_array($packages) ? $packages : func_get_args();

        $this->dependency = $packages;

        return $this;
    }
550143
private function regenerateDependencyMap () : DependencyMap
    {
        $loader = new DependencyLoader($this->namespaceRegistry, $this->logger);

        foreach ($this->dependencyFiles as $dependencyFile)
        {
            $loader->importFile($dependencyFile);
        }

        return new DependencyMap(
            $loader->getDependencyMap()
        );
    }
738085
public function populate($model, $children)
    {
        $allChildren = ($children === true) ? true : false;
        $children = (is_array($children)) ? $children : [];

        foreach ($this->getReferenceMap() as $name => $options) {
            if ($allChildren || in_array($name, $children)) {

                $service        = $this->getRelatedService($name);
                $getIdMethod    = 'get' . ucfirst($options['refCol']);
                $setMethod      = $options['setMethod'] ?? 'set' . ucfirst($name);
                $getMethod      = $options['getMethod'] ?? 'getById';
                $childModel     = $service->$getMethod($model->$getIdMethod(), $options['refCol']);

                if ($childModel instanceof HydratingResultSet) {
                    $childModelObjects = [];

                    foreach ($childModel as $row) {
                        $childModelObjects[] = $row;
                    }

                    $childModel = $childModelObjects;
                }

                $model->$setMethod($childModel);
            }
        }

        return $model;
    }