OrganizationService   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
eloc 10
c 2
b 0
f 0
dl 0
loc 64
rs 10

5 Methods

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