Has at least one parent context got one of the caps $caps?

@param array $caps capability
@return boolean
187075
public function have_one_cap($caps) {
        foreach ($caps as $cap) {
            if ($this->have_cap($cap)) {
                return true;
            }
        }
        return false;
    }
122202
public function canEvaluate($context)
    {
        if (count($context) === 0) {
            return true;
        }

        foreach ($context as $contextNode) {
            if (!$contextNode instanceof NodeInterface) {
                return false;
            }
        }
        return true;
    }
965052
public function has($tableName)
    {
        $capsules = $this->all();

        foreach ($capsules as $capsule) {
            if ($capsule->tableName == $tableName) {
                return true;
            }
        }

        return false;
    }
1230031
public function hasTag($tags): bool
    {
        // Single tag slug
        if (is_string($tags)) {
            return $this->tags->contains('slug', $tags);
        }

        // Single tag id
        if (is_int($tags)) {
            return $this->tags->contains('id', $tags);
        }

        // Single tag model
        if ($tags instanceof Tag) {
            return $this->tags->contains('slug', $tags->slug);
        }

        // Array of tag slugs
        if (is_array($tags) && isset($tags[0]) && is_string($tags[0])) {
            return ! $this->tags->pluck('slug')->intersect($tags)->isEmpty();
        }

        // Array of tag ids
        if (is_array($tags) && isset($tags[0]) && is_int($tags[0])) {
            return ! $this->tags->pluck('id')->intersect($tags)->isEmpty();
        }

        // Collection of tag models
        if ($tags instanceof Collection) {
            return ! $tags->intersect($this->tags->pluck('slug'))->isEmpty();
        }

        return false;
    }
1100153
public function get_capabilities( $caps ) {

		$caps = array_merge(
			$caps, array(
				'edit_' . $this->capability_type,
				'read_' . $this->capability_type,
				'delete_' . $this->capability_type,
				'edit_' . $this->capability_type . 's',
				'edit_others_' . $this->capability_type . 's',
				'publish_' . $this->capability_type . 's',
				'read_private_' . $this->capability_type . 's',
				'edit_' . $this->capability_type . 's',
			)
		);

		return $caps;
	}
1311637
public function can_change_parent($newparentcat) {
        if (!has_capability('moodle/category:manage', $this->get_context())) {
            return false;
        }
        if (is_object($newparentcat)) {
            $newparentcat = self::get($newparentcat->id, IGNORE_MISSING);
        } else {
            $newparentcat = self::get((int)$newparentcat, IGNORE_MISSING);
        }
        if (!$newparentcat) {
            return false;
        }
        if ($newparentcat->id == $this->id || in_array($this->id, $newparentcat->get_parents())) {
            // Can not move to itself or it's own child.
            return false;
        }
        if ($newparentcat->id) {
            return has_capability('moodle/category:manage', context_coursecat::instance($newparentcat->id));
        } else {
            return has_capability('moodle/category:manage', context_system::instance());
        }
    }
1116179
public static function has(array $array, ...$keys): bool
    {
        $key = array_shift($keys);

        if (!isset($array[$key])) {
            return false;
        }

        if (empty($keys)) {
            return isset($array[$key]);
        }

        if (!\is_array($array[$key])) {
            return false;
        }

        return self::has($array[$key], ...$keys);
    }
1309955
protected function resolveLastDecendant($array, array $keys): ?Fluent
    {
        $isLastDescendant = function ($array, $segment) {
            return ! \is_array($array->childs) || ! isset($array->childs[$segment]);
        };

        // To retrieve the array item using dot syntax, we'll iterate through
        // each segment in the key and look for that value. If it exists,
        // we will return it, otherwise we will set the depth of the array
        // and look for the next segment.
        foreach ($keys as $segment) {
            if ($isLastDescendant($array, $segment)) {
                return $array;
            }

            $array = $array->childs[$segment];
        }

        return $array;
    }
162513
protected function hasCapability($name)
    {
        if (empty($this->capability) || $name == '') {
            return false;
        }

        if (in_array($name, $this->capability)) {
            return true;
        }
        else if (strpos($name, '=')) {
            return false;
        }

        $result = array();
        foreach ($this->capability as $cap) {
            $entry = explode('=', $cap);
            if ($entry[0] == $name) {
                $result[] = $entry[1];
            }
        }

        return $result ?: false;
    }
435031
protected function isHeadersAllowed(array $headers)
    {
        /**
         * Webkit browsers are known to include simple headers in access-control-request-headers.
         * We need to remove these so they aren't considered in the check for allowed headers.
         * @see http://stackoverflow.com/questions/17330302/why-non-custom-headers-in-access-control-request-headers
         */
        // Strip out any requests for simple headers
        $headers = array_udiff(
            $headers,
            $this->simpleHeaders,
            'strcasecmp'
        );

        // Check for any access-control-request-headers not in allowed headers, using case-insensitive comparison
        return array_udiff(
            $headers,
            $this->config['allowHeaders'],
            'strcasecmp'
        ) === [];
    }
796889
public function canCreate($member = null, $context = [])
    {
        // Obtain Parent Context:
        
        if (isset($context['Parent'])) {
            
            // Obtain Parent:
            
            $parent = $context['Parent'];
            
            // Obtain Parent Class:
            
            $class = get_class($context['Parent']);
            
            // Obtain Allowed Parents:
            
            if ($parents = $this->config()->allowed_parents) {
                
                // Initialise Allowed Classes Array:
                
                $classes = [];
                
                // Obtain Subclasses for Parent Class:
                
                foreach ($parents as $parent) {
                    $classes = array_merge($classes, array_values(ClassInfo::subclassesFor($parent)));
                }
                
                // Disallow Parent (if not found):
                
                if (!in_array($class, $classes)) {
                    return false;
                }
                
            } else {
                
                // Disallow Page as Parent (except if explicitly allowed):
                
                if ($context['Parent'] instanceof Page) {
                    
                    $allowed_children = $context['Parent']->allowedChildren();
                    
                    if (in_array(SiteTree::class, $allowed_children) || !in_array(static::class, $allowed_children)) {
                        return false;
                    }
                    
                }
                
            }
            
            // Check Allowed Children of Parent:
            
            $strictParentInstance = ($parent && $parent instanceof SiteTree);
            
            if ($strictParentInstance && !in_array(static::class, $parent->allowedChildren())) {
                return false;
            }
            
        }
        
        // Check Permissions for Member:
        
        return Permission::checkMember($member, ['ADMIN', 'SILVERWARE_COMPONENT_CREATE']);
    }
690301
public function has($key)
	{
		if ( ! isset($this->jar[$key]) or $this->jar[$key]->isDeleted())
		{
			if ( ! $this->parentEnabled or ! $this->parent->has($key))
			{
				return false;
			}
		}

		return true;
	}
1261873
public function nextIfLookaheadAnyOf(array $types): bool
    {
        if (!isset($this->tokens[$this->position]) || !$this->tokens[$this->position]->typeEqualsAnyOf($types)) {
            return false;
        }

        $this->next();
        return true;
    }
569757
public function has_any(array $keys) {
        foreach ($keys as $key) {
            if ($this->has($key)) {
                return true;
            }
        }
        return false;
    }
935936
public function matchesFieldKeys(array $keys): bool
    {
        if ( ! count($keys)) return false;

        return count(array_intersect($keys, $this->descendantFieldKeys())) > 0;
    }
793816
public static function haveSameKeys(array $array1, array $array2)
    {
        return self::hasAllKeys($array1, array_keys($array2)) && self::hasAllKeys($array2, array_keys($array1)) ? true : false;
    }
1152007
public function hasKey($_)
    {
        try {
            $keys = array_reverse($this->getKeyArguments(func_get_args()));

            $array = $this->getArrayCopy();
            while (count($keys) > 0) {
                $key = array_pop($keys);
                if (! array_key_exists($key, $array)) {
                    return false;
                }
                $array = $array[$key];
            }
        } catch (Exception $exception) {
            return false;
        }

        return true;
    }