HttpAsyncClientDiscovery::find()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 10
loc 10
ccs 5
cts 5
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Http\Discovery;
4
5
use Http\Client\HttpAsyncClient;
6
use Http\Discovery\Exception\DiscoveryFailedException;
7
8
/**
9
 * Finds an HTTP Asynchronous Client.
10
 *
11
 * @author Joel Wurtz <[email protected]>
12
 */
13 View Code Duplication
final class HttpAsyncClientDiscovery extends ClassDiscovery
14
{
15
    /**
16
     * Finds an HTTP Async Client.
17
     *
18
     * @return HttpAsyncClient
19
     *
20
     * @throws Exception\NotFoundException
21
     */
22 2
    public static function find()
23
    {
24
        try {
25 2
            $asyncClient = static::findOneByType(HttpAsyncClient::class);
26 1
        } catch (DiscoveryFailedException $e) {
27 1
            throw new NotFoundException('No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e);
0 ignored issues
show
Deprecated Code introduced by
The class Http\Discovery\NotFoundException has been deprecated with message: since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
28
        }
29
30 1
        return static::instantiateClass($asyncClient);
31
    }
32
}
33