<commit_before><?php declare( strict_types = 1 );
namespace CodeKandis\Phlags\TraitfulExtensions;

use CodeKandis\Phlags\FlagableInterface;

/**
 * Represents a traitful extension to manipulate a flagable while a passed condition is true.
 * @package codekandis/phlags
 * @author <NAME> <<EMAIL>>
 */
trait ConditionalManipulationExtension
{
	/**
	 * Sets a flag.
	 * @param int|string|FlagableInterface $value The flag to set.
	 * @param bool $condition true if the value can be set, false otherwise.
	 * @return self
	 */
	public function ifSet( $value, bool $condition ): self
	{
		if ( true === $condition )
		{
			$this->set( $value );
		}

		return $this;
	}

	/**
	 * Unsets a flag.
	 * @param int|string|FlagableInterface $value The flag to unset.
	 * @param bool $condition true if the value can be unset, false otherwise.
	 * @return self
	 */
	public function ifUnset( $value, bool $condition ): self
	{
		if ( true === $condition )
		{
			$this->unset( $value );
		}

		return $this;
	}

	/**
	 * Switches a flag.
	 * @param int|string|FlagableInterface $value The flag to switch.
	 * @param bool $condition true if the value can be switched, false otherwise.
	 * @return self
	 */
	public function ifSwitch( $value, bool $condition ): self
	{
		if ( true === $condition )
		{
			$this->switch( $value );
		}

		return $this;<commit_msg>Refactors the `ConditionalManipulationExtension`.<commit_after><?php declare( strict_types = 1 );
namespace CodeKandis\Phlags\TraitfulExtensions;

/**
 * Represents a traitful extension to manipulate a flagable while a passed condition is true.
 * @package codekandis/phlags
 * @author <NAME> <<EMAIL>>
 */
trait ConditionalManipulationExtension
{
	/**
	 * @see ConditionalManipulationInterface::ifSet()
	 */
	public function ifSet( $value, bool $condition ): ConditionalManipulationInterface
	{
		if ( true === $condition )
		{
			$this->set( $value );
		}

		return $this;
	}

	/**
	 * @see ConditionalManipulationInterface::ifUnset()
	 */
	public function ifUnset( $value, bool $condition ): ConditionalManipulationInterface
	{
		if ( true === $condition )
		{
			$this->unset( $value );
		}

		return $this;
	}

	/**
	 * @see ConditionalManipulationInterface::ifSwitch()
	 */
	public function ifSwitch( $value, bool $condition ): ConditionalManipulationInterface
	{
		if ( true === $condition )
		{
			$this->switch( $value );
		}

		return $this;
{'fraction_non_alphanumeric': 0.12875, 'fraction_numerical': 0.0008333333333333334, 'mean_word_length': 3.7357001972386588, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1215903', 'n_tokens_mistral': 822, 'n_tokens_neox': 754, 'n_words': 219}