Completed
Push — master ( 9e79b8...d5f666 )
by Freek
16:43 queued 13:48
created

Yahoo::generate()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 10

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
dl 18
loc 18
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 10
nc 4
nop 1
1
<?php
2
3
namespace Spatie\CalendarLinks\Generators;
4
5
use Spatie\CalendarLinks\Link;
6
use Spatie\CalendarLinks\Generator;
7
8 View Code Duplication
class Yahoo implements Generator
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    public function generate(Link $link): string
11
    {
12
        $url = 'https://calendar.yahoo.com/?v=60&view=d&type=20';
13
14
        $url .= '&title='.urlencode($link->title);
15
        $url .= '&st='.$link->from->format('Ymd\THis');
16
        $url .= '&et='.$link->to->format('Ymd\THis');
17
18
        if ($link->description) {
19
            $url .= '&desc='.urlencode($link->description);
20
        }
21
22
        if ($link->address) {
23
            $url .= '&in_loc='.urlencode($link->address);
24
        }
25
26
        return $url;
27
    }
28
}
29