CpeSwfHandler::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace SA\CpeSdk\Swf;
4
5
use Aws\Swf\SwfClient;
6
7
// SA Cpe SDK
8
use SA\CpeSdk;
9
10
/**
11
 * Create the AWS SWF connection
12
 * Check for AWS environment variables
13
 */
14
class CpeSwfHandler
15
{
16
    public $swf;
17
18
    public function __construct()
19
    {
20
        # Check if preper env vars are setup
21
        if (!($region = getenv("AWS_DEFAULT_REGION")))
22
            throw new CpeSdk\CpeException("Set 'AWS_DEFAULT_REGION' environment variable!");
23
24
        // SWF client
25
        $this->swf = SwfClient::factory(array(
26
            'region'  => $region
27
        ));
28
    }
29
}