public static function validatePos($pos)
    {
        $posLength = strlen($pos);

        if (1 > $posLength) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR1,
                $pos
            );
        }

        if (preg_match('/[^0-9\-#]/', $pos)) { // alphabetic characters etc. are not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR2,
                $pos
            );
        }

        if (strpos($pos, '-') === $posLength - 1) { // something like 123- is not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR3,
                $pos
            );
        }

        if (0 === strpos($pos, '-')) { // something like -123 ist not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR4,
                $pos
            );
        }

        if (strpos($pos, '-') !== strrpos($pos, '-')) { // only one - is allowed
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR5,
                $pos
            );
        }

        $_pos = explode('-', $pos);

        if (2 < count($_pos)) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR6,
                $pos
            );
        }

        if (1 == count($_pos)) {
            $_pos[1] = null;
        }

        return $_pos;
    }
public static function validatePos($pos)
    {
        $posLength = strlen($pos);

        if (1 > $posLength) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR1,
                $pos
            );
        }

        if (preg_match('/[^0-9\-#]/', $pos)) { // alphabetic characters etc. are not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR2,
                $pos
            );
        }

        if (strpos($pos, '-') === $posLength - 1) { // something like 123- is not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR3,
                $pos
            );
        }

        if (0 === strpos($pos, '-')) { // something like -123 ist not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR4,
                $pos
            );
        }

        if (strpos($pos, '-') !== strrpos($pos, '-')) { // only one - is allowed
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR5,
                $pos
            );
        }

        $_pos = explode('-', $pos);

        if (2 < count($_pos)) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR6,
                $pos
            );
        }

        if (1 == count($_pos)) {
            $_pos[1] = null;
        }

        return $_pos;
    }
public static function validatePos ( $ pos ) { $ posLength = strlen ( $ pos ) ; if ( 1 > $ posLength ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: PR . InvalidMARCspecException :: PR1 , $ pos ) ; } if ( preg_match ( '/[^0-9\-#]/' , $ pos ) ) { // alphabetic characters etc. are not valid throw new InvalidMARCspecException ( InvalidMARCspecException :: PR . InvalidMARCspecException :: PR2 , $ pos ) ; } if ( strpos ( $ pos , '-' ) === $ posLength - 1 ) { // something like 123- is not valid throw new InvalidMARCspecException ( InvalidMARCspecException :: PR . InvalidMARCspecException :: PR3 , $ pos ) ; } if ( 0 === strpos ( $ pos , '-' ) ) { // something like -123 ist not valid throw new InvalidMARCspecException ( InvalidMARCspecException :: PR . InvalidMARCspecException :: PR4 , $ pos ) ; } if ( strpos ( $ pos , '-' ) !== strrpos ( $ pos , '-' ) ) { // only one - is allowed throw new InvalidMARCspecException ( InvalidMARCspecException :: PR . InvalidMARCspecException :: PR5 , $ pos ) ; } $ _pos = explode ( '-' , $ pos ) ; if ( 2 < count ( $ _pos ) ) { throw new InvalidMARCspecException ( InvalidMARCspecException :: PR . InvalidMARCspecException :: PR6 , $ pos ) ; } if ( 1 == count ( $ _pos ) ) { $ _pos [ 1 ] = null ; } return $ _pos ; }
validate a position or range.


@param string $pos The position or range

@throws CK\MARCspec\Exception\InvalidMARCspecException

@return array $_pos[string] An numeric array of character or index positions.
$_pos[1] might be empty.
validate a position or range .