Salesforce   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 37
ccs 0
cts 15
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getApiVersion() 0 4 1
A setApiVersion() 0 12 2
1
<?php
2
3
namespace Flipbox\OAuth2\Client\Provider;
4
5
use Craft;
6
use flipbox\ember\helpers\ModelHelper;
7
8
use Exception;
9
use InvalidArgumentException;
10
11
class Salesforce extends \Stevenmaguire\OAuth2\Client\Provider\Salesforce
12
{
13
    /**
14
     * @var string
15
     */
16
    public $apiVersion = 'v20.0';
17
18
    /**
19
     * Retrieves the currently configured provider api version.
20
     *
21
     * @return string
22
     */
23
    public function getApiVersion()
24
    {
25
        return $this->apiVersion;
26
    }
27
28
    /**
29
     * Updates the provider api version with a given value.
30
     *
31
     * @throws  InvalidArgumentException
32
     * @param string $apiVersion
33
     * @return  Salesforce
34
     */
35
    public function setApiVersion($apiVersion)
36
    {
37
        try {
38
            $this->domain = (string) $apiVersion;
39
        } catch (Exception $e) {
0 ignored issues
show
Unused Code introduced by
catch (\Exception $e) { ...on is not a string'); } does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
40
            throw new InvalidArgumentException(
41
                'Value provided as api version is not a string'
42
            );
43
        }
44
45
        return $this;
46
    }
47
}
48