File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 99 "email" : " am@jonesiscoding.com"
1010 }
1111 ],
12- "version" : " 1.5" ,
12+ "version" : " 1.5.1 " ,
1313 "autoload" : {
1414 "psr-4" : {
1515 "DevCoding\\ Mac\\ " : " src"
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public function getShortVersion()
5656 {
5757 try
5858 {
59- return SemanticVersion:: parse ($ this ->getPlistValue ('CFBundleShortVersionString ' ));
59+ return new SemanticVersion ($ this ->getPlistValue ('CFBundleShortVersionString ' ));
6060 }
6161 catch (\Exception $ e )
6262 {
@@ -71,7 +71,7 @@ public function getVersion()
7171 {
7272 try
7373 {
74- return SemanticVersion:: parse ($ this ->getPlistValue ('CFBundleVersion ' ));
74+ return new SemanticVersion ($ this ->getPlistValue ('CFBundleVersion ' ));
7575 }
7676 catch (\Exception $ e )
7777 {
Original file line number Diff line number Diff line change 66
77class SemanticVersion extends Version
88{
9+ protected $ raw ;
10+
911 public function __construct (string $ version = '0.1.0 ' )
1012 {
13+ $ this ->raw = $ version ;
14+
1115 try
1216 {
1317 parent ::__construct ($ version );
1418 }
1519 catch (\Exception $ e )
1620 {
17- $ Fix = static ::parse ($ version );
21+ try
22+ {
23+ // Try the built in fixer
24+ $ Fix = static ::parse ($ version );
25+ }
26+ catch (\Exception $ e )
27+ {
28+ // Too many dots
29+ $ v = explode ('. ' , $ version );
30+ if (count ($ v ) > 3 )
31+ {
32+ $ version = array_shift ($ v ) . ". " . array_shift ($ v ) . '. ' . implode ('' , $ v );
33+ $ Fix = static ::parse ($ version );
34+ }
35+ }
1836
1937 $ this ->setMajor ($ Fix ->major );
2038 $ this ->setMinor ($ Fix ->minor );
@@ -24,6 +42,11 @@ public function __construct(string $version = '0.1.0')
2442 }
2543 }
2644
45+ public function getRaw ()
46+ {
47+ return $ this ->raw ;
48+ }
49+
2750 public function getBuild ()
2851 {
2952 return $ this ->build ;
You can’t perform that action at this time.
0 commit comments