src/Model/Version.php
public function toString()
    {
        if (!empty($this->alias)) {
            return $this->alias;
        }

        $version = '';

        if (!empty($this->nickname)) {
            $version .= $this->nickname . ' ';
        }

        if (!empty($this->value)) {
            if (preg_match("/([0-9]+)(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:([ab])([0-9]+))?/", $this->value, $match)) {
                $v = [ $match[1] ];

                if (array_key_exists(2, $match) && strlen($match[2])) {
                    $v[] = $match[2];
                }

                if (array_key_exists(3, $match) && strlen($match[3])) {
                    $v[] = $match[3];
                }

                if (array_key_exists(4, $match) && strlen($match[4])) {
                    $v[] = $match[4];
                }

                if (!empty($this->details)) {
                    if ($this->details < 0) {
                        array_splice($v, $this->details, 0 - $this->details);
                    }

                    if ($this->details > 0) {
                        array_splice($v, $this->details, count($v) - $this->details);
                    }
                }

                if (isset($this->builds) && !$this->builds) {
                    $count = count($v);
                    for ($i = 0; $i < $count; $i++) {
                        if ($v[$i] > 999) {
                            array_splice($v, $i, 1);
                        }
                    }
                }

                $version .= implode($v, '.');

                if (array_key_exists(5, $match) && strlen($match[5])) {
                    $version .= $match[5] . (!empty($match[6]) ? $match[6] : '');
                }
            }
        }

        return $version;
    }
public function toString()
    {
        if (!empty($this->alias)) {
            return $this->alias;
        }

        $version = '';

        if (!empty($this->nickname)) {
            $version .= $this->nickname . ' ';
        }

        if (!empty($this->value)) {
            if (preg_match("/([0-9]+)(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:([ab])([0-9]+))?/", $this->value, $match)) {
                $v = [ $match[1] ];

                if (array_key_exists(2, $match) && strlen($match[2])) {
                    $v[] = $match[2];
                }

                if (array_key_exists(3, $match) && strlen($match[3])) {
                    $v[] = $match[3];
                }

                if (array_key_exists(4, $match) && strlen($match[4])) {
                    $v[] = $match[4];
                }

                if (!empty($this->details)) {
                    if ($this->details < 0) {
                        array_splice($v, $this->details, 0 - $this->details);
                    }

                    if ($this->details > 0) {
                        array_splice($v, $this->details, count($v) - $this->details);
                    }
                }

                if (isset($this->builds) && !$this->builds) {
                    $count = count($v);
                    for ($i = 0; $i < $count; $i++) {
                        if ($v[$i] > 999) {
                            array_splice($v, $i, 1);
                        }
                    }
                }

                $version .= implode($v, '.');

                if (array_key_exists(5, $match) && strlen($match[5])) {
                    $version .= $match[5] . (!empty($match[6]) ? $match[6] : '');
                }
            }
        }

        return $version;
    }
public function toString ( ) { if ( ! empty ( $ this -> alias ) ) { return $ this -> alias ; } $ version = '' ; if ( ! empty ( $ this -> nickname ) ) { $ version .= $ this -> nickname . ' ' ; } if ( ! empty ( $ this -> value ) ) { if ( preg_match ( "/([0-9]+)(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:([ab])([0-9]+))?/" , $ this -> value , $ match ) ) { $ v = [ $ match [ 1 ] ] ; if ( array_key_exists ( 2 , $ match ) && strlen ( $ match [ 2 ] ) ) { $ v [ ] = $ match [ 2 ] ; } if ( array_key_exists ( 3 , $ match ) && strlen ( $ match [ 3 ] ) ) { $ v [ ] = $ match [ 3 ] ; } if ( array_key_exists ( 4 , $ match ) && strlen ( $ match [ 4 ] ) ) { $ v [ ] = $ match [ 4 ] ; } if ( ! empty ( $ this -> details ) ) { if ( $ this -> details < 0 ) { array_splice ( $ v , $ this -> details , 0 - $ this -> details ) ; } if ( $ this -> details > 0 ) { array_splice ( $ v , $ this -> details , count ( $ v ) - $ this -> details ) ; } } if ( isset ( $ this -> builds ) && ! $ this -> builds ) { $ count = count ( $ v ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( $ v [ $ i ] > 999 ) { array_splice ( $ v , $ i , 1 ) ; } } } $ version .= implode ( $ v , '.' ) ; if ( array_key_exists ( 5 , $ match ) && strlen ( $ match [ 5 ] ) ) { $ version .= $ match [ 5 ] . ( ! empty ( $ match [ 6 ] ) ? $ match [ 6 ] : '' ) ; } } } return $ version ; }
Return the version as a human readable string

@return string
Return the version as a human readable string