Search::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
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