VacancyTemplateBuilder::addServiceStatement()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Timegridio\Concierge\Vacancy;
4
5
use Timegridio\Concierge\Models\Business;
6
use Timegridio\Concierge\Models\Service;
7
8
class VacancyTemplateBuilder
9
{
10
    protected $statement = [];
11
12 2
    public function getTemplate(Business $business, Service $service)
13
    {
14 2
        $this->addServiceStatement($service);
15 2
        $this->addDaysStatement();
16 2
        $this->addTimeRangeStatement($business->pref('start_at'), $business->pref('finish_at'));
17
18 2
        return $this->build();
19
    }
20
21 2
    protected function addServiceStatement(Service $service)
22
    {
23 2
        $this->addStatement($service->slug.':1');
24 2
    }
25
26 2
    protected function addDaysStatement()
27
    {
28 2
        $this->addStatement(' mon, tue, wed, thu, fri, sat');
29 2
    }
30
31 2
    protected function addTimeRangeStatement($startAt, $finishAt)
32
    {
33 2
        $this->addStatement('  '.$startAt.' - '.$finishAt);
34 2
    }
35
36 2
    protected function addStatement($statement)
37
    {
38 2
        $this->statement[] = $statement;
39 2
    }
40
41 2
    protected function build()
42
    {
43 2
        return implode("\n", $this->statement);
44
    }
45
}
46