php/mixins/FlaggedElement.php
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;
	}
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;
	}
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 ; }
Add one or more flags.

@param string|array $flags One or more flags to add, or an array keyed by flag name
containing boolean set/remove instructions.
@return $this
Add one or more flags .