Base::getUserByFastspringId()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * This file implements Base.
4
 *
5
 * @author    Bilal Gultekin <[email protected]>
6
 * @author    Justin Hartman <[email protected]>
7
 * @copyright 2019 22 Digital
8
 * @license   MIT
9
 * @since     v0.1
10
 */
11
12
namespace TwentyTwoDigital\CashierFastspring\Listeners;
13
14
/**
15
 * This class describes a base.
16
 */
17
class Base
18
{
19
    /**
20
     * Get the billable entity instance by Fastspring ID.
21
     *
22
     * @param string $fastspringId
23
     *
24
     * @return \TwentyTwoDigital\CashierFastspring\Billable
25
     */
26 5
    public function getUserByFastspringId($fastspringId)
27
    {
28 5
        $model = getenv('FASTSPRING_MODEL') ?: config('services.fastspring.model');
29
30 5
        return (new $model())->where('fastspring_id', $fastspringId)->first();
31
    }
32
}
33