File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace MessageBird ;
4
4
5
+ use PackageVersions \Versions ;
6
+
5
7
/**
6
8
* Class Client
7
9
*
@@ -15,6 +17,7 @@ class Client
15
17
const VOICEAPI_ENDPOINT = 'https://voice.messagebird.com ' ;
16
18
17
19
const CLIENT_VERSION = '1.14.1 ' ;
20
+ const PACKAGE_NAME = 'messagebird/php-rest-api ' ;
18
21
19
22
/**
20
23
* @var string
@@ -242,4 +245,25 @@ private function getPhpVersion()
242
245
243
246
return 'PHP/ ' . PHP_VERSION_ID ;
244
247
}
248
+
249
+ /**
250
+ * Get the current version of this package without hash or v-prefix
251
+ * If this reposistory is checked out on a non-version-branch it will
252
+ * have a format like dev-[branch]. (e.g. dev-master for the master branch)
253
+ *
254
+ * @return string
255
+ */
256
+ private function getClientVersion ()
257
+ {
258
+ $ fullVersion = Versions::getVersion (static ::PACKAGE_NAME );
259
+ $ splitVersion = explode ('@ ' , $ fullVersion , 2 );
260
+
261
+ if (strlen ($ splitVersion [0 ]) > 1 && $ splitVersion [0 ]{0 } == 'v ' ) {
262
+ // some tags ar v1.x.y, some are not (?)
263
+ $ versionWithoutVPrefix = substr ($ splitVersion [0 ], 1 );
264
+ } else {
265
+ $ versionWithoutVPrefix = $ splitVersion [0 ];
266
+ }
267
+ return $ versionWithoutVPrefix ;
268
+ }
245
269
}
You can’t perform that action at this time.
0 commit comments