File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 1212 * @method static bool is7x()
1313 * @method static bool is8x()
1414 * @method static bool is9x()
15+ * @method static int major()
16+ * @method static int minor()
17+ * @method static int patch()
18+ * @method static string version()
1519 */
1620class AppVersion extends Facade
1721{
Original file line number Diff line number Diff line change @@ -30,12 +30,26 @@ public function is9x(): bool
3030 return $ this ->major () === 9 ;
3131 }
3232
33- protected function major (): int
33+ public function major (): int
3434 {
3535 return (int ) Str::before ($ this ->version (), '. ' );
3636 }
3737
38- protected function version (): string
38+ public function minor (): int
39+ {
40+ $ version = $ this ->parse ();
41+
42+ return $ version [1 ];
43+ }
44+
45+ public function patch (): int
46+ {
47+ $ version = $ this ->parse ();
48+
49+ return $ version [2 ];
50+ }
51+
52+ public function version (): string
3953 {
4054 if (AppHelper::isLumen ()) {
4155 preg_match ('/.+\((\d+\.\d+\.\d+)\)/ ' , app ()->version (), $ matches );
@@ -45,4 +59,9 @@ protected function version(): string
4559
4660 return Application::VERSION ;
4761 }
62+
63+ protected function parse (): array
64+ {
65+ return explode ('. ' , $ this ->version ());
66+ }
4867}
You can’t perform that action at this time.
0 commit comments