src/Flag.php
public static function setOn($value, $flag)
    {
        if (!Int::is($value)) {
            throw new \InvalidArgumentException("The \$value parameter must be of type int.");
        }

        if (is_array($flag)) {
            $ret = $value;
            foreach ($flag as $item) {
                $ret = static::setOn($ret, $item);
            }

            return $ret;
        } elseif (!static::is($flag)) {
            throw new \InvalidArgumentException("The \$flag parameter must be of type int and a power of 2.");
        }

        return ($value | $flag);
    }
public static function setOn($value, $flag)
    {
        if (!Int::is($value)) {
            throw new \InvalidArgumentException("The \$value parameter must be of type int.");
        }

        if (is_array($flag)) {
            $ret = $value;
            foreach ($flag as $item) {
                $ret = static::setOn($ret, $item);
            }

            return $ret;
        } elseif (!static::is($flag)) {
            throw new \InvalidArgumentException("The \$flag parameter must be of type int and a power of 2.");
        }

        return ($value | $flag);
    }
public static function setOn ( $ value , $ flag ) { if ( ! Int :: is ( $ value ) ) { throw new \ InvalidArgumentException ( "The \$value parameter must be of type int." ) ; } if ( is_array ( $ flag ) ) { $ ret = $ value ; foreach ( $ flag as $ item ) { $ ret = static :: setOn ( $ ret , $ item ) ; } return $ ret ; } elseif ( ! static :: is ( $ flag ) ) { throw new \ InvalidArgumentException ( "The \$flag parameter must be of type int and a power of 2." ) ; } return ( $ value | $ flag ) ; }
Sets a flag into a value.

@param int       $value The value to set the flag on.
@param int|array $flag  The flag(s) to be set.

@return int Returns the value with the flag on.
@throws \InvalidArgumentException
Sets a flag into a value .