src/Property/Event/RecurrenceRule.php
public function setBySetPos($value)
    {
        if (null === $value) {
            $this->bySetPos = $value;

            return $this;
        }

        if (!(is_string($value) || is_array($value) || is_int($value))) {
            throw new InvalidArgumentException('Invalid value for BYSETPOS');
        }

        $list = $value;

        if (is_int($value)) {
            if ($value === 0 || $value < -366 || $value > 366) {
                throw new InvalidArgumentException('Invalid value for BYSETPOS');
            }
            $this->bySetPos = [$value];

            return $this;
        }

        if (is_string($value)) {
            $list = explode(',', $value);
        }

        $output = [];

        foreach ($list as $item) {
            if (is_string($item)) {
                if (!preg_match('/^ *-?[0-9]* *$/', $item)) {
                    throw new InvalidArgumentException('Invalid value for BYSETPOS');
                }
                $item = intval($item);
            }

            if (!is_int($item) || $item === 0 || $item < -366 || $item > 366) {
                throw new InvalidArgumentException('Invalid value for BYSETPOS');
            }

            $output[] = $item;
        }

        $this->bySetPos = $output;

        return $this;
    }
public function setBySetPos($value)
    {
        if (null === $value) {
            $this->bySetPos = $value;

            return $this;
        }

        if (!(is_string($value) || is_array($value) || is_int($value))) {
            throw new InvalidArgumentException('Invalid value for BYSETPOS');
        }

        $list = $value;

        if (is_int($value)) {
            if ($value === 0 || $value < -366 || $value > 366) {
                throw new InvalidArgumentException('Invalid value for BYSETPOS');
            }
            $this->bySetPos = [$value];

            return $this;
        }

        if (is_string($value)) {
            $list = explode(',', $value);
        }

        $output = [];

        foreach ($list as $item) {
            if (is_string($item)) {
                if (!preg_match('/^ *-?[0-9]* *$/', $item)) {
                    throw new InvalidArgumentException('Invalid value for BYSETPOS');
                }
                $item = intval($item);
            }

            if (!is_int($item) || $item === 0 || $item < -366 || $item > 366) {
                throw new InvalidArgumentException('Invalid value for BYSETPOS');
            }

            $output[] = $item;
        }

        $this->bySetPos = $output;

        return $this;
    }
public function setBySetPos ( $ value ) { if ( null === $ value ) { $ this -> bySetPos = $ value ; return $ this ; } if ( ! ( is_string ( $ value ) || is_array ( $ value ) || is_int ( $ value ) ) ) { throw new InvalidArgumentException ( 'Invalid value for BYSETPOS' ) ; } $ list = $ value ; if ( is_int ( $ value ) ) { if ( $ value === 0 || $ value < - 366 || $ value > 366 ) { throw new InvalidArgumentException ( 'Invalid value for BYSETPOS' ) ; } $ this -> bySetPos = [ $ value ] ; return $ this ; } if ( is_string ( $ value ) ) { $ list = explode ( ',' , $ value ) ; } $ output = [ ] ; foreach ( $ list as $ item ) { if ( is_string ( $ item ) ) { if ( ! preg_match ( '/^ *-?[0-9]* *$/' , $ item ) ) { throw new InvalidArgumentException ( 'Invalid value for BYSETPOS' ) ; } $ item = intval ( $ item ) ; } if ( ! is_int ( $ item ) || $ item === 0 || $ item < - 366 || $ item > 366 ) { throw new InvalidArgumentException ( 'Invalid value for BYSETPOS' ) ; } $ output [ ] = $ item ; } $ this -> bySetPos = $ output ; return $ this ; }
The BYSETPOS filters one interval of events by the specified position.
A positive position will start from the beginning and go forward while
a negative position will start at the end and move backward.

Valid values are a comma separated string or an array of integers
from 1 to 366 or negative integers from -1 to -366.

@param int|string|array|null $value

@throws InvalidArgumentException

@return $this
The BYSETPOS filters one interval of events by the specified position . A positive position will start from the beginning and go forward while a negative position will start at the end and move backward .