Get modified date and stage for the given version

@param int $version
@return array A list containing 0 => LastEdited, 1 => Stage
352673
protected function getLastEditedAndStageForVersion($version)
    {
        // Cache key
        $baseTable = $this->baseTable();
        $id = $this->owner->ID;
        $key = "{$baseTable}#{$id}/{$version}";

        // Check cache
        if (isset($this->versionModifiedCache[$key])) {
            return $this->versionModifiedCache[$key];
        }

        // Build query
        $table = "\"{$baseTable}_Versions\"";
        $query = SQLSelect::create(['"LastEdited"', '"WasPublished"'], $table)
            ->addWhere([
                "{$table}.\"RecordID\"" => $id,
                "{$table}.\"Version\"" => $version
            ]);
        $result = $query->execute()->record();
        if (!$result) {
            return null;
        }
        $list = [
            $result['LastEdited'],
            $result['WasPublished'] ? static::LIVE : static::DRAFT,
        ];
        $this->versionModifiedCache[$key] = $list;
        return $list;
    }
867841
public function getDetectedVersion($version)
    {
        return isset($this->detectedVersions[$version]) ? $this->detectedVersions[$version] : null;
    }
91628
protected function passThrough($version, $key)
    {
        $revisioned = $this->getVersion($version);

        $needle = $this->passThrough[$key];

        return $this->dataGet($revisioned, $needle);
    }
128491
public static function parseStability($version)
    {
        $version = preg_replace('{#.+$}i', '', $version);

        if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
            return 'dev';
        }

        preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
        if (!empty($match[3])) {
            return 'dev';
        }

        if (!empty($match[1])) {
            if ('beta' === $match[1] || 'b' === $match[1]) {
                return 'beta';
            }
            if ('alpha' === $match[1] || 'a' === $match[1]) {
                return 'alpha';
            }
            if ('rc' === $match[1]) {
                return 'RC';
            }
        }

        return 'stable';
    }
1048107
public function getChangedFilesSince(string $revision) : array
    {
        $cmd    = (new ChangedFiles($this->repo->getRoot()))->byRevision($revision);
        $result = $this->runner->run($cmd);

        return $result->getBufferedOutput();
    }
1100248
public function getMigrationVersion($version)
    {
        if ($this->isVersionAvailable($version)) {
            if ($this->isVersionLoaded($version)) {
                $configuration = $this->loadedVersions[$version];
            } else {
                $configuration = $this->loadConfiguration($version);
                $this->loadedVersions[$version] = $configuration;
            }
            return $configuration;
        }
        throw new MigrationException('Specified version is not available.', 1345821746);
    }
962857
private function extractStability($version)
    {
        $stability = $this->getExplicitStability($version);

        if ($stability === null) {
            $stability = $this->getParsedStability($version);
        }

        return $stability;
    }
1080929
public static function convertVersionMetadata($version)
    {
        $version = str_replace(self::$cleanPatterns, '', $version);

        if (preg_match_all(
            self::createPattern('([a-zA-Z]+|(\-|\+)[a-zA-Z]+|(\-|\+)[0-9]+)'),
            $version,
            $matches,
            PREG_OFFSET_CAPTURE
        )) {
            list($type, $version, $end) = self::cleanVersion(strtolower($version), $matches);
            list($version, $patchVersion) = self::matchVersion($version, $type);

            $matches = array();
            $hasPatchNumber = preg_match('/[0-9]+\.[0-9]+|[0-9]+|\.[0-9]+$/', $end, $matches);
            $end = $hasPatchNumber ? $matches[0] : '1';

            if ($patchVersion) {
                $version .= $end;
            }
        }

        return static::cleanWildcard($version);
    }
781919
public function stagesDiffer()
    {
        if (func_num_args() > 0) {
            Deprecation::notice('5.0', 'Versioned only has two stages and stagesDiffer no longer requires parameters');
        }
        $id = $this->owner->ID ?: $this->owner->OldID;
        if (!$id || !$this->hasStages()) {
            return false;
        }

        $draftVersion = static::get_versionnumber_by_stage($this->owner, Versioned::DRAFT, $id);
        $liveVersion = static::get_versionnumber_by_stage($this->owner, Versioned::LIVE, $id);
        return $draftVersion !== $liveVersion;
    }
1053479
public function getVersionedContent($version)
    {
        if (!in_array($version, $this->getVersions(), true)) {
            throw new \UnexpectedValueException("Invalid log entry $version for {$this->path}.");
        }

        if (($content = \Arbit\VCSWrapper\Cache\Manager::get($this->path, $version, 'content')) === false) {
            // Execute command
            $content = svn_cat($this->root . $this->path, $version);
            \Arbit\VCSWrapper\Cache\Manager::cache($this->path, $version, 'content', $content);
        }

        return $content;
    }
376688
public static function parseVersion($version)
    {
        if (preg_match('#^(\d+)\.(\d+)\.(\d+)(\-([\w.\-]+)|)$#', $version, $match)) {
            return (object) array(
                'major' => $match[1],
                'minor' => $match[2],
                'patch' => $match[3],
                'extra' => empty($match[5]) ? null : $match[5]
            );
        }

        return false;
    }
1325402
public function getGpgInfo($version)
    {
        $phpRelease = preg_replace('~^(\d+\.\d+)\.\d+$~', '\1', $this->resolveVersion($version));

        if (!isset($this->gpgKeys[$phpRelease])) {
            return [];
        }

        return $this->gpgKeys[$phpRelease];
    }
751652
public function getLink(String $key, String $version = 'latest')
    {
        $return = $this->getLinks()[$key] ?? false;

        if( $version !== 'latest' )
        {
            return $this->versionModifier($version, $return);
        }

        return $return;
    }
858294
protected function getPackageKeyFromMigrationVersion(Version $version)
    {
        $sortedAvailablePackages = $this->packageManager->getAvailablePackages();
        usort($sortedAvailablePackages, function (PackageInterface $packageOne, PackageInterface $packageTwo) {
            return strlen($packageTwo->getPackagePath()) - strlen($packageOne->getPackagePath());
        });

        $reflectedClass = new \ReflectionClass($version->getMigration());
        $classPathAndFilename = Files::getUnixStylePath($reflectedClass->getFileName());

        /** @var $package PackageInterface */
        foreach ($sortedAvailablePackages as $package) {
            $packagePath = Files::getUnixStylePath($package->getPackagePath());
            if (strpos($classPathAndFilename, $packagePath) === 0) {
                return $package->getPackageKey();
            }
        }

        return '';
    }
1116334
public static function toComponents($version)
    {
        if (!Validator::isVersion($version)) {
            throw new InvalidStringRepresentationException($version);
        }

        if (false !== strpos($version, '+')) {
            list($version, $build) = explode('+', $version);

            $build = explode('.', $build);
        }

        if (false !== strpos($version, '-')) {
            list($version, $pre) = explode('-', $version);

            $pre = explode('.', $pre);
        }

        list(
            $major,
            $minor,
            $patch
        ) = explode('.', $version);

        return array(
            self::MAJOR => intval($major),
            self::MINOR => intval($minor),
            self::PATCH => intval($patch),
            self::PRE_RELEASE => isset($pre) ? $pre : array(),
            self::BUILD => isset($build) ? $build : array(),
        );
    }
982696
public function resources(int $version = null)
    {
        $version = $version ?? $this->version;

        return $this->definitions->filter(function (ResourceDefinition $definition) use ($version) {
            return $definition->version === $version;
        })->pluck('resource');
    }
730215
public function format(Version $version)
    {
        if (preg_match('/^(\d+)-g([a-fA-F0-9]{7,40})(-dirty)?$/', $version->getPreRelease(), $matches)) {
            if ((int) $matches[1] != 0) {
                // we are not on TAG commit, add "dev" and git commit hash as pre release part
                $version = $version->withPreRelease(array('dev', $matches[2]));
            } else {
                $version = $version->withPreRelease(array());
            }
        }

        if (preg_match('/^(.*)-(\d+)-g([a-fA-F0-9]{7,40})(-dirty)?$/', $version->getPreRelease(), $matches)) {
            if ((int) $matches[2] != 0) {
                // we are not on TAG commit, add "dev" and git commit hash as pre release part
                if (empty($matches[1])) {
                    $version = $version->withPreRelease(array('dev', $matches[3]));
                } else {
                    $version = $version->withPreRelease(array_merge(explode('.', trim($matches[1], '-')), array('dev', $matches[3])));
                }
            } else {
                if (empty($matches[1])) {
                    $version = $version->withPreRelease(array());
                } else {
                    $version = $version->withPreRelease(trim($matches[1], '-'));
                }
            }
        }

        return $version;
    }