Passed
Push — master ( 9eeea6...aec556 )
by Stephen
02:58
created

OrganizationService::name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Sfneal\Users\Services;
5
6
7
use Sfneal\Actions\AbstractService;
8
9
class OrganizationService extends AbstractService
10
{
11
    /**
12
     * Retrieve the Organization's name
13
     *
14
     * @return string|null
15
     */
16
    public static function name(): ?string
17
    {
18
        return config('users.org.name');
19
    }
20
21
    /**
22
     * Retrieve the Organization's logo
23
     *
24
     * @return string|null
25
     */
26
    public static function logo(): ?string
27
    {
28
        return config('users.org.logo');
29
    }
30
31
    /**
32
     * Retrieve an OrganizationAddressService instance for accessing the address
33
     *
34
     * @return OrganizationAddressService
35
     */
36
    public static function address(): OrganizationAddressService
37
    {
38
        return new OrganizationAddressService();
39
    }
40
41
    /**
42
     * Retrieve the Organization's phone number
43
     *
44
     * @param bool $href
45
     * @return string|null
46
     */
47
    public static function phone(bool $href = false): ?string
48
    {
49
        // Return a phone href
50
        if ($href) {
51
            return 'tel:+' . str_replace('-', '', config('users.org.phone'));
52
        }
53
54
        // Only return the phone number
55
        return config('users.org.phone');
56
    }
57
58
    /**
59
     * Retrieve the Organization's email address
60
     *
61
     * @param bool $href
62
     * @return string|null
63
     */
64
    public static function email(bool $href = false): ?string
65
    {
66
        // Return a phone href
67
        if ($href) {
68
            return 'mailto:' . config('users.org.email');
69
        }
70
71
        // Only return the phone number
72
        return config('users.org.email');
73
    }
74
}
75