Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
35 | 1 | public function __invoke(FetchSubscription $wished): void |
|
36 | { |
||
37 | 1 | $subscription = $this->subscriptions->get($wished->identity()); |
|
38 | 1 | $resource = $this->crawler->execute(new Request( |
|
39 | 1 | $subscription->location(), |
|
40 | 1 | new Method(Method::GET), |
|
41 | 1 | new ProtocolVersion(2, 0) |
|
42 | )); |
||
43 | $resource |
||
44 | 1 | ->attributes() |
|
45 | 1 | ->get('articles') |
|
46 | 1 | ->content() |
|
47 | 1 | ->filter(function(Article $article): bool { |
|
48 | 1 | return !$this->articles->has($article->link()); |
|
49 | 1 | }) |
|
50 | 1 | ->foreach(function(Article $article) use ($subscription): void { |
|
51 | 1 | $article->bindTo($subscription->identity()); |
|
52 | 1 | $this->articles->add($article); |
|
53 | 1 | }); |
|
56 |