Get a flag by primary matcher or any defined aliases.

@param mixed  $flag  Either a string representing the flag or an
cli\arguments\Argument object.
@return array
168792
public function getFlag($flag) {
		if ($flag instanceOf Argument) {
			$obj  = $flag;
			$flag = $flag->value;
		}

		if (isset($this->_flags[$flag])) {
			return $this->_flags[$flag];
		}

		foreach ($this->_flags as $master => $settings) {
			if (in_array($flag, (array)$settings['aliases'])) {
				if (isset($obj)) {
					$obj->key = $master;
				}

				$cache[$flag] =& $settings;
				return $settings;
			}
		}
	}
771106
public function getMatches(
        string $regex,
        int $offset = 0,
        int $flags = self::PREG_NO_FLAGS
    ): MapInterface {
        return $this->capture($regex, $offset, $flags);
    }
1364400
private static function getFlagsSelect($statement, $flags)
    {
        $flags['querytype'] = 'SELECT';
        $flags['is_select'] = true;

        if (! empty($statement->from)) {
            $flags['select_from'] = true;
        }

        if ($statement->options->has('DISTINCT')) {
            $flags['distinct'] = true;
        }

        if (! empty($statement->group) || ! empty($statement->having)) {
            $flags['is_group'] = true;
        }

        if (! empty($statement->into)
            && ($statement->into->type === 'OUTFILE')
        ) {
            $flags['is_export'] = true;
        }

        $expressions = $statement->expr;
        if (! empty($statement->join)) {
            foreach ($statement->join as $join) {
                $expressions[] = $join->expr;
            }
        }

        foreach ($expressions as $expr) {
            if (! empty($expr->function)) {
                if ($expr->function === 'COUNT') {
                    $flags['is_count'] = true;
                } elseif (in_array($expr->function, static::$FUNCTIONS)) {
                    $flags['is_func'] = true;
                }
            }
            if (! empty($expr->subquery)) {
                $flags['is_subquery'] = true;
            }
        }

        if (! empty($statement->procedure)
            && ($statement->procedure->name === 'ANALYSE')
        ) {
            $flags['is_analyse'] = true;
        }

        if (! empty($statement->group)) {
            $flags['group'] = true;
        }

        if (! empty($statement->having)) {
            $flags['having'] = true;
        }

        if (! empty($statement->union)) {
            $flags['union'] = true;
        }

        if (! empty($statement->join)) {
            $flags['join'] = true;
        }

        return $flags;
    }
1360281
protected function sanitizeFlags(array $flags)
    {
        $flags = (array) $flags;

        // Flip array if necessary
        $firstKey = Arr::get(array_keys($flags), 0);
        if ($firstKey !== null && is_int($firstKey)) {
            $flags = array_combine(
                array_values($flags),
                array_fill(0, count($flags), null)
            );
        }

        return $flags;
    }
730615
static public function ParseFlags($flags)
    {
        $dup = ($flags & 0x08) >> 3;
        $qos = ($flags & 0x06) >> 1;
        $retain = ($flags & 0x01);

        return array(
            'dup'           =>  $dup,
            'qos'           =>  $qos,
            'retain'        =>  $retain,
        );
    }
676408
public function withFlag(FlagInterface $flag): self
    {
        $clone = clone ($this);
        $clone->flags[$flag->__toString()] = deep_clone($flag);

        return $clone;
    }
1064635
public function addFlag($flag)
    {
        if (!in_array($flag, $this->flags, true)) {
            $this->flags[] = $flag;
        }

        return $this;
    }
49462
public function setFlag($flag) {
        $this->client->openFolder($this->folder_path);

        $flag = "\\".trim(is_array($flag) ? implode(" \\", $flag) : $flag);
        $status = imap_setflag_full($this->client->getConnection(), $this->getUid(), $flag, SE_UID);
        $this->parseFlags();

        return $status;
    }
401397
public function getFlags()
    {
        $returnValue = array();

        
        $currentAnnotations = $this->getAnnotations();
        if (isset($currentAnnotations[self::FLAGS])){
            $returnValue = explode(" ", $currentAnnotations[self::FLAGS]);
        }
        

        return (array) $returnValue;
    }
1159647
public function getMatchAll(string $pattern, int $flags = PREG_PATTERN_ORDER, int $offset = 0)
	{
		return preg_match_all($pattern, $this->str, $matches, $flags, $offset) === false ? null : $matches;
	}
232827
public function setFlags( $flags ) {
		$add = [];
		$remove = [];
		$classPrefix = 'oo-ui-flaggedElement-';

		if ( is_string( $flags ) ) {
			// Set
			if ( !isset( $this->flags[$flags] ) ) {
				$this->flags[$flags] = true;
				$add[] = $classPrefix . $flags;
			}
		} elseif ( is_array( $flags ) ) {
			foreach ( $flags as $key => $value ) {
				if ( is_numeric( $key ) ) {
					// Set
					if ( !isset( $this->flags[$value] ) ) {
						$this->flags[$value] = true;
						$add[] = $classPrefix . $value;
					}
				} else {
					if ( $value ) {
						// Set
						if ( !isset( $this->flags[$key] ) ) {
							$this->flags[$key] = true;
							$add[] = $classPrefix . $key;
						}
					} else {
						// Remove
						if ( isset( $this->flags[$key] ) ) {
							unset( $this->flags[$key] );
							$remove[] = $classPrefix . $key;
						}
					}
				}
			}
		}

		$this->flagged
			->addClasses( $add )
			->removeClasses( $remove );

		return $this;
	}
1113969
public function setExtractFlags($flag)
    {
        switch ($flag) {
            case self::EXTR_DATA:
            case self::EXTR_PRIORITY:
            case self::EXTR_BOTH:
                $this->extractFlag = $flag;
                break;
            default:
                throw new Exception\InvalidArgumentException("The extract flag specified is not valid");
        }
    }
467708
public function getFlag($flag)
    {
        return isset($this->_parts['flags'][$flag]) ? $this->_parts['flags'][$flag] : null;
    }
560301
protected function flagsToStr($flags)
    {
        foreach ((array)$flags as $idx => $flag) {
            if ($flag = $this->flags[strtoupper($flag)]) {
                $flags[$idx] = $flag;
            }
        }

        return implode(' ', (array)$flags);
    }
914307
protected function isFlagSet($options, $flag)
    {
        $options = abs( (int) $options);
        $flag = abs( (int) $flag);
        return (($options & $flag) === $flag);
    }
605345
public static function convertFromDelegateFlags($flags = null)
    {
        if (null === $flags) {
            return self::NOPARAM;
        }

        $converted = 0;

        foreach (self::$flagMap as $from => $to) {
            if ($flags & $to) {
                $converted |= $from;
            }
        }

        return $converted;
    }
1362973
public function number($flags = 0)
    {
        $ret = false;

        if ($number = $this->match(TextTokenizer::NUMBER, $matches, $flags)) {
            $ret = $number;
        }

        return $ret;
    }