Salesforce::setApiVersion()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 0
cts 11
cp 0
rs 9.4285
cc 2
eloc 7
nc 1
nop 1
crap 6
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