Driver::searchAndBuyNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace LeadThread\Sms\Drivers;
4
5
use LeadThread\Sms\Interfaces\SendsSms;
6
use LeadThread\Sms\Interfaces\PhoneSearchParams;
7
8
abstract class Driver implements SendsSms
9
{
10
    protected $config = [];
11
    
12
    abstract public function searchNumber(PhoneSearchParams $search);
13
    abstract public function buyNumber($phone);
14
    abstract public function sellNumber($phone);
15
16
    /**
17
     * Searches for a number and then purchases the first one it finds
18
     * @param  array $search Array of search options
19
     * @return \LeadThread\Sms\Responses\Response
20
     */
21
    public function searchAndBuyNumber(PhoneSearchParams $search)
22
    {
23
        $resp = $this->searchNumber($search);
24
        return $this->buyNumber($resp->number);
25
    }
26
}
27