Skip to content

Commit

Permalink
Merge pull request #2 from jenolan/master
Browse files Browse the repository at this point in the history
Missed that there was a regex as well as inline parsing
  • Loading branch information
amouhzi committed Jun 6, 2015
2 parents 89b3c14 + fcf46a2 commit 68328f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/Version/Stability.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace Version;

use JsonSchema\Exception\InvalidArgumentException;

class Stability
{

const REGEX = '[-|_|\.]{0,1}([R|r][C|c]|pl|a|alpha|[B|b][E|e][T|t][A|a]|b|B|patch|stable|p)\.{0,1}(\d*)';
const REGEX = '[-|_|\.]{0,1}([R|r][C|c]|pl|a|alpha|[B|b][E|e][T|t][A|a]|b|B|patch|stable|p|[D|d][E|e][V|v]|[D|d])\.{0,1}(\d*)';

/**
* @var string
Expand Down Expand Up @@ -109,7 +107,7 @@ private function toInt( $stability )
case 'patch':
return 6;
default:
throw new InvalidArgumentException( 'Invalid stability: ' . $stability );
throw new \InvalidArgumentException( 'Invalid stability: ' . $stability );
}
}
}
4 changes: 2 additions & 2 deletions src/Version/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ public function __toString()
$version =
$this->major . '.' .
$this->minor . '.' .
$this->revision . '.' .
(int)$this->micro;
$this->revision;
if($this->micro !== null) $version .= '.' . (int)$this->micro;
} else {
$version = $this->major;
if ($this->minor) $version .= '-' . $this->minor;
Expand Down

0 comments on commit 68328f5

Please sign in to comment.