Search   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 6
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 16 1
1
<?php
2
3
/**
4
 * This file is part of Laravel Meetups.
5
 *
6
 * (c) Nuno Maduro <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace LaravelMeetups\Jobs\Detail;
13
14
use LaravelMeetups\Contracts\Jobs\Search as Contract;
15
use LaravelMeetups\Http\Client\Detail\Strategy;
16
use LaravelMeetups\Http\Client\Query;
17
use LaravelMeetups\Http\Client\Transporter;
18
use LaravelMeetups\Jobs\AbstractSearch;
19
20
/**
21
 * Class Search.
22
 */
23
class Search extends AbstractSearch implements Contract
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function execute()
29
    {
30
        $link = $this->dom->getElementsByClass('.event')->getAttribute('href');
31
32
        $this->config->setUrl($link);
33
34
        $body = (new Transporter())->execute(
35
            new Query(new Strategy($this->config))
36
        );
37
38
        $dom = $this->dom->load($body);
39
40
        return array_map(function ($elem) use ($dom) {
41
            return (new $elem())->find($dom);
42
        }, $this->config->getDetailProviders());
43
    }
44
}
45