PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / s3 / Aws / Arn / AccessPointArn.php

AccessPointArn.php in Media Cloud Sync 1.4.1, at includes/sdk/s3/Aws/Arn/AccessPointArn.php

56 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws\Arn;
4
5 use Dudlewebs\WPMCS\s3\Aws\Arn\Exception\InvalidArnException;
6 /**
7 * @internal
8 */
9 class AccessPointArn extends Arn implements AccessPointArnInterface
10 {
11 use ResourceTypeAndIdTrait;
12 /**
13 * AccessPointArn constructor
14 *
15 * @param $data
16 */
17 public function __construct($data)
18 {
19 parent::__construct($data);
20 static::validate($this->data);
21 }
22 public static function parse($string)
23 {
24 $data = parent::parse($string);
25 $data = self::parseResourceTypeAndId($data);
26 $data['accesspoint_name'] = $data['resource_id'];
27 return $data;
28 }
29 public function getAccesspointName()
30 {
31 return $this->data['accesspoint_name'];
32 }
33 /**
34 * Validation specific to AccessPointArn
35 *
36 * @param array $data
37 */
38 protected static function validate(array $data)
39 {
40 self::validateRegion($data, 'access point ARN');
41 self::validateAccountId($data, 'access point ARN');
42 if ($data['resource_type'] !== 'accesspoint') {
43 throw new InvalidArnException("The 6th component of an access point ARN" . " represents the resource type and must be 'accesspoint'.");
44 }
45 if (empty($data['resource_id'])) {
46 throw new InvalidArnException("The 7th component of an access point ARN" . " represents the resource ID and must not be empty.");
47 }
48 if (\strpos($data['resource_id'], ':') !== \false) {
49 throw new InvalidArnException("The resource ID component of an access" . " point ARN must not contain additional components" . " (delimited by ':').");
50 }
51 if (!self::isValidHostLabel($data['resource_id'])) {
52 throw new InvalidArnException("The resource ID in an access point ARN" . " must be a valid host label value.");
53 }
54 }
55 }
56