getName() public method

public getName ( ) : string
return string
Exemplo n.º 1
0
 public function test_it_keep_version_formats()
 {
     $this->SUT = new Version('v1.0.0.0', 'v1.0.0', 'v1.0.0');
     $this->assertSame('v1.0.0.0', $this->SUT->getName());
     $this->assertSame('v1.0.0', $this->SUT->getPretty());
     $this->assertSame('v1.0.0', $this->SUT->getFullPretty());
     $this->SUT = new Version('v.1.0.9999999.9999999-dev', 'dev-master', 'dev-master 1234abc');
     $this->assertSame('v.1.0.9999999.9999999-dev', $this->SUT->getName());
     $this->assertSame('dev-master', $this->SUT->getPretty());
     $this->assertSame('dev-master 1234abc', $this->SUT->getFullPretty());
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getOutput(OperationInterface $operation, UrlGenerator $urlGenerator = null)
 {
     if (!$operation instanceof UpdateOperation) {
         throw new \LogicException('Operation should be an instance of UpdateOperation');
     }
     $output = [];
     $initialPackage = $operation->getInitialPackage();
     $targetPackage = $operation->getTargetPackage();
     $versionFrom = new Version($initialPackage->getVersion(), $initialPackage->getPrettyVersion(), method_exists($initialPackage, 'getFullPrettyVersion') ? $initialPackage->getFullPrettyVersion() : VersionParser::formatVersion($initialPackage));
     $versionTo = new Version($targetPackage->getVersion(), $targetPackage->getPrettyVersion(), method_exists($targetPackage, 'getFullPrettyVersion') ? $targetPackage->getFullPrettyVersion() : VersionParser::formatVersion($targetPackage));
     $action = 'updated';
     if (Comparator::greaterThan($versionFrom->getName(), $versionTo->getName())) {
         $action = 'downgraded';
     }
     $output[] = sprintf(' - <fg=green>%s</fg=green> %s from <fg=yellow>%s</fg=yellow> to <fg=yellow>%s</fg=yellow>', $initialPackage->getName(), $action, $versionFrom->getPretty(), $versionTo->getPretty());
     if ($urlGenerator) {
         $compareUrl = $urlGenerator->generateCompareUrl($initialPackage->getSourceUrl(), $versionFrom, $targetPackage->getSourceUrl(), $versionTo);
         if (!empty($compareUrl)) {
             $output[] = sprintf('   See changes: %s', $compareUrl);
         }
         $releaseUrl = $urlGenerator->generateReleaseUrl($this->extractSourceUrl($operation), $versionTo);
         if (!empty($releaseUrl)) {
             $output[] = sprintf('   Release notes: %s', $releaseUrl);
         }
     }
     return $output;
 }
 /**
  * Return whether the version is dev or not.
  *
  * @param Version $version
  *
  * @return string
  */
 protected function isDevVersion(Version $version)
 {
     return substr($version->getName(), 0, 4) === 'dev-' || substr($version->getName(), -4) === '-dev';
 }