public function getVersions()
    {
        if (!isset($this->_versions)) {
            $versions = array();

            foreach ($this->getMethods() as $method) {
                $matches = array();

                if (preg_match('/(up)(\d+)/', $method, $matches)) {
                    $versions[] = $matches[2];
                }
            }

            $path = dirname($this->getIdentifier()->filepath);

            if (file_exists($path)) {
                if (file_exists($path.'/migrations')) {
                    $files = new DirectoryIterator($path.'/migrations');
                    foreach ($files as $file) {
                        $matches = array();
                        if (preg_match('/(\d+)\.sql/', (string) $file, $matches)) {
                            $versions[] = $matches[1];
                        } elseif (preg_match('/(\d+)\.php/', (string) $file, $matches)) {
                            $versions[] = $matches[1];
                        }
                    }
                }
            }
            sort($versions);
            $this->_versions = array_unique($versions);
            $this->_max_version = array_pop($versions);
        }

        return $this->_versions;
    }
public function getVersions()
    {
        if (!isset($this->_versions)) {
            $versions = array();

            foreach ($this->getMethods() as $method) {
                $matches = array();

                if (preg_match('/(up)(\d+)/', $method, $matches)) {
                    $versions[] = $matches[2];
                }
            }

            $path = dirname($this->getIdentifier()->filepath);

            if (file_exists($path)) {
                if (file_exists($path.'/migrations')) {
                    $files = new DirectoryIterator($path.'/migrations');
                    foreach ($files as $file) {
                        $matches = array();
                        if (preg_match('/(\d+)\.sql/', (string) $file, $matches)) {
                            $versions[] = $matches[1];
                        } elseif (preg_match('/(\d+)\.php/', (string) $file, $matches)) {
                            $versions[] = $matches[1];
                        }
                    }
                }
            }
            sort($versions);
            $this->_versions = array_unique($versions);
            $this->_max_version = array_pop($versions);
        }

        return $this->_versions;
    }
public function getVersions ( ) { if ( ! isset ( $ this -> _versions ) ) { $ versions = array ( ) ; foreach ( $ this -> getMethods ( ) as $ method ) { $ matches = array ( ) ; if ( preg_match ( '/(up)(\d+)/' , $ method , $ matches ) ) { $ versions [ ] = $ matches [ 2 ] ; } } $ path = dirname ( $ this -> getIdentifier ( ) -> filepath ) ; if ( file_exists ( $ path ) ) { if ( file_exists ( $ path . '/migrations' ) ) { $ files = new DirectoryIterator ( $ path . '/migrations' ) ; foreach ( $ files as $ file ) { $ matches = array ( ) ; if ( preg_match ( '/(\d+)\.sql/' , ( string ) $ file , $ matches ) ) { $ versions [ ] = $ matches [ 1 ] ; } elseif ( preg_match ( '/(\d+)\.php/' , ( string ) $ file , $ matches ) ) { $ versions [ ] = $ matches [ 1 ] ; } } } } sort ( $ versions ) ; $ this -> _versions = array_unique ( $ versions ) ; $ this -> _max_version = array_pop ( $ versions ) ; } return $ this -> _versions ; }
Return the max version.

@return int
Return the max version .