summaryrefslogtreecommitdiff
path: root/vendor/aws/aws-sdk-php/src/Arn/ResourceTypeAndIdTrait.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/aws/aws-sdk-php/src/Arn/ResourceTypeAndIdTrait.php')
-rw-r--r--vendor/aws/aws-sdk-php/src/Arn/ResourceTypeAndIdTrait.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/aws/aws-sdk-php/src/Arn/ResourceTypeAndIdTrait.php b/vendor/aws/aws-sdk-php/src/Arn/ResourceTypeAndIdTrait.php
new file mode 100644
index 0000000..424974f
--- /dev/null
+++ b/vendor/aws/aws-sdk-php/src/Arn/ResourceTypeAndIdTrait.php
@@ -0,0 +1,30 @@
+<?php
+namespace Aws\Arn;
+
+/**
+ * @internal
+ */
+trait ResourceTypeAndIdTrait
+{
+ public function getResourceType()
+ {
+ return $this->data['resource_type'];
+ }
+
+ public function getResourceId()
+ {
+ return $this->data['resource_id'];
+ }
+
+ protected static function parseResourceTypeAndId(array $data)
+ {
+ $resourceData = preg_split("/[\/:]/", $data['resource'], 2);
+ $data['resource_type'] = isset($resourceData[0])
+ ? $resourceData[0]
+ : null;
+ $data['resource_id'] = isset($resourceData[1])
+ ? $resourceData[1]
+ : null;
+ return $data;
+ }
+} \ No newline at end of file