Returns the first five abilities whose name begins by a given
string, excluding abilities linked to a particular competency.

@param string     $name
@param Competency $excludedParent

@return array
553858
public function findFirstByName($name, Competency $excludedParent)
    {
        $qb = $this->createQueryBuilder('a');
        $qb2 = $this->_em->createQueryBuilder();
        $qb2->select('a2')
            ->from('HeVinci\CompetencyBundle\Entity\CompetencyAbility', 'ca')
            ->join('ca.ability', 'a2')
            ->where($qb2->expr()->eq('ca.competency', ':parent'));

        return $qb->select('a')
            ->where($qb->expr()->like('a.name', ':name'))
            ->andWhere($qb->expr()->notIn('a', $qb2->getDQL()))
            ->orderBy('a.name')
            ->setMaxResults(5)
            ->setParameter(':name', $name.'%')
            ->setParameter(':parent', $excludedParent)
            ->getQuery()
            ->getResult();
    }
335861
protected function isExcluded($_name)
    {
        for ($i = 0, $excludesCount = count($this->excludes); $i < $excludesCount; $i++) {
            if ($this->matchPath($this->excludes[$i], $_name, $this->isCaseSensitive)) {
                return true;
            }
        }

        return false;
    }
503184
public function allowsElement($name)
    {
        if (!empty($this->currentNesting)) {
            $parent_token = array_pop($this->currentNesting);
            $this->currentNesting[] = $parent_token;
            $parent = $this->htmlDefinition->info[$parent_token->name];
        } else {
            $parent = $this->htmlDefinition->info_parent_def;
        }
        if (!isset($parent->child->elements[$name]) || isset($parent->excludes[$name])) {
            return false;
        }
        // check for exclusion
        for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
            $node = $this->currentNesting[$i];
            $def  = $this->htmlDefinition->info[$node->name];
            if (isset($def->excludes[$name])) {
                return false;
            }
        }
        return true;
    }
1335312
public function getRulesByCategory($name, array $except = []) {
        if (!isset($this->categories[$name])) {
            throw new ParserException('Category with ' . $name . ' not found');
        }

        if (count($except) === 0) {
            return $this->categories[$name];
        }

        $rules = [];
        foreach ($this->categories[$name] as $rule) {
            if (!in_array($rule->getName(), $except)) {
                $rules[] = $rule;
            }
        }

        return $rules;
    }
444474
public function getAncestors($ignoreSelf = false)
    {
        $ancestors = [];

        if (false === $ignoreSelf) {
            $ancestors[$this->name] = $this->appName;
        }

        /** @var $parent Node */
        foreach ($this->parent as $parent) {
            $parentAncenstors = $parent->getAncestors();

            $ancestors = array_merge($parentAncenstors, $ancestors);
        }

        return $ancestors;
    }
1240353
function(excludeSelf) {
			var path = [],
				sep = this.tree.options.keyPathSeparator;
			this.visitParents(function(n) {
				if (n.parent) {
					path.unshift(n.key);
				}
			}, !excludeSelf);
			return sep + path.join(sep);
		}
29380
public function getParameter(string $name, bool &$contained = NULL) {
        if(isset($this->parameters[$name])) {
            $contained = true;
            return $this->parameters[$name];
        }
        $contained = false;
        return NULL;
    }
1092050
private function getChildren(\DOMNode $node, $name)
    {
        $children = [];
        foreach ($node->childNodes as $child) {
            if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) {
                $children[] = $child;
            }
        }

        return $children;
    }
104938
private function getEscapedSortorder($name, $prefix = 'r')
    {
        $order = '';

        $separatedOrders = $this->getOrderBys($name);

        $totalOrderByElements = count($separatedOrders);

        foreach ($separatedOrders as $index => $name) {
            list($name, $asc) = $this->getSortOrder($name);

            // If we don't have a name, we can't determine a sortorder.
            if (empty($name)) {
                return false;
            }
            if (strpos($name, 'RAND') !== false) {
                $order .= $name;
            } elseif ($prefix !== false) {
                $order .= $this->app['db']->quoteIdentifier($prefix . '.' . $name);
            } else {
                $order .= $this->app['db']->quoteIdentifier($name);
            }

            if (! $asc) {
                $order .= ' DESC';
            }

            if ($this->isNotLastItemInArray($totalOrderByElements, $index)) {
                $order .= ',';
            }
        }

        return $order;
    }
687984
public static function getList(DOMElement $parent) : array
    {
        $ret = [];
        /** @var \DOMElement $node */
        foreach (Utils::xpQuery($parent, './saml_protocol:Extensions/*') as $node) {
            $ret[] = new Chunk($node);
        }

        return $ret;
    }
1262696
protected function getElementPositionInTable(string $name, ?string $contentType = null): int
    {
        if ($this->context->isElementVisible($this->fields['noItems'])) {
            return 0;
        }

        $isElementNamePresentInTable = strpos($this->context->findElement($this->fields['list'])->getText(), $name) !== false;
        if (!$isElementNamePresentInTable) {
            return 0;
        }

        $matchingListElementsPositions = $this->getAllElementsPositionsByText($name, $this->fields['listElement']);
        $matchingCount = count($matchingListElementsPositions);
        for ($i = 0; $i < $matchingCount; ++$i) {
            if ($contentType === null || $this->context->findElement(sprintf($this->fields['listElementType'], $matchingListElementsPositions[$i]))->getText() === $contentType) {
                return $matchingListElementsPositions[$i];
            }
        }

        return 0;
    }
775247
protected function parseItem(Container $container, $name)
    {
        try {
            $element = $container[$name];
        } catch (\Exception $e) {
            if (array_key_exists($name, $this->outOfRequestScopeTypes)) {
                return [
                  'name' => $name,
                  'type' => 'class',
                  'value' => $this->outOfRequestScopeTypes[$name],
                ];
            }
            return null;
        }

        if (is_object($element)) {
            if ($element instanceof \Closure) {
                $type = 'closure';
                $value = '';
            } elseif ($element instanceof Container) {
                $type = 'container';
                $value = $this->parseContainer($element);
            } else {
                $type = 'class';
                $value = get_class($element);
            }
        } elseif (is_array($element)) {
            $type = 'array';
            $value = '';
        } elseif (is_string($element)) {
            $type = 'string';
            $value = $element;
        } elseif (is_int($element)) {
            $type = 'int';
            $value = $element;
        } elseif (is_float($element)) {
            $type = 'float';
            $value = $element;
        } elseif (is_bool($element)) {
            $type = 'bool';
            $value = $element;
        } elseif ($element === null) {
            $type = 'null';
            $value = '';
        } else {
            $type = 'unknown';
            $value = gettype($element);
        }

        return [
          'name' => $name,
          'type' => $type,
          'value' => $value,
        ];
    }
964595
private function getClassContentByCategory($name, $start, $count)
    {
        return $this->findContentsByCriteria($this->getClassContentClassnamesByCategory($name), $start, $count);
    }
689561
public function get_parent_contexts($includeself = false) {
        if (!$contextids = $this->get_parent_context_ids($includeself)) {
            return array();
        }

        // Preload the contexts to reduce DB calls.
        context_helper::preload_contexts_by_id($contextids);

        $result = array();
        foreach ($contextids as $contextid) {
            $parent = context::instance_by_id($contextid, MUST_EXIST);
            $result[$parent->id] = $parent;
        }

        return $result;
    }
1340503
public function getAllChildren($includeSelf = false)
    {
        return call_user_func("$this->ownerClassName::find")
            ->where([
                $this->primaryKey => $this->getChildrenId($includeSelf),
            ])
            ->orderBy("$this->parentIdField ASC, $this->sortField ASC, $this->primaryKey ASC");
    }
495220
public function parents($depth = null) {
        $condition = [
            'and',
            [$this->leftAttribute => ['$lt' => $this->owner->getAttribute($this->leftAttribute)]],
            [$this->rightAttribute => ['$gt' => $this->owner->getAttribute($this->rightAttribute)]],
        ];

        if ($depth !== null) {
            $condition[] = [$this->depthAttribute => ['$gte' => $this->owner->getAttribute($this->depthAttribute) - $depth]];
        }

        $this->applyTreeAttributeCondition($condition);

        return $this->owner->find()->andWhere($condition)->addOrderBy([$this->leftAttribute => SORT_ASC]);
    }
1145238
public function getRoles($name, ...$domain)
    {
        if (1 == \count($domain)) {
            $name = $domain[0].'::'.$name;
        } elseif (\count($domain) > 1) {
            throw new CasbinException('error: domain should be 1 parameter');
        }

        if (!$this->hasRole($name)) {
            return [];
        }

        $roles = $this->createRole($name)->getRoles();
        if (1 == \count($domain)) {
            foreach ($roles as $key => $value) {
                $roles[$key] = \array_slice($roles[$key], \strlen($domain[0]) + 2);
            }
        }

        return $roles;
    }