1 | <?php |
||
22 | class Connection implements LoggerAwareInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | const CLASS_SOAPCLIENT = 'SoapClient'; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | const CLASS_SOAPHEADER = 'SoapHeader'; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | const API_INDIVIDUAL = 'individual.yml'; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | const API_BROADCAST = 'broadcast.yml'; |
||
43 | |||
44 | /** |
||
45 | * @var ReflectionClass |
||
46 | */ |
||
47 | private $client; |
||
48 | |||
49 | /** |
||
50 | * @var ReflectionClass |
||
51 | */ |
||
52 | private $header; |
||
53 | |||
54 | /** |
||
55 | * @var Array |
||
56 | */ |
||
57 | private $options = []; |
||
|
|||
58 | |||
59 | /** |
||
60 | * @var LoggerInterface |
||
61 | */ |
||
62 | private $logger = null; |
||
63 | |||
64 | /** |
||
65 | * @param string $client |
||
66 | * @param string $header |
||
67 | * |
||
68 | * @throws InvalidArgumentException |
||
69 | */ |
||
70 | public function __construct($client = 'SoapClient', $header = 'SoapHeader') |
||
71 | { |
||
72 | 4 | $load = function($class, $expected) { |
|
73 | 4 | $result = new \ReflectionClass($class); |
|
74 | 4 | if ($class != $expected && !$result->isSubclassOf($expected)) { |
|
75 | 2 | throw new \InvalidArgumentException(sprintf( |
|
76 | 2 | "%s is not an instance of %s", |
|
77 | 2 | $class, $expected |
|
78 | )); |
||
79 | } |
||
80 | 3 | return $result; |
|
81 | 4 | }; |
|
82 | |||
83 | 4 | $this->client = $load($client, self::CLASS_SOAPCLIENT); |
|
84 | 3 | $this->header = $load($header, self::CLASS_SOAPHEADER); |
|
85 | 2 | } |
|
86 | |||
87 | /** |
||
88 | * {@inheritDoc} |
||
89 | */ |
||
90 | 1 | public function setLogger(LoggerInterface $logger) |
|
94 | |||
95 | |||
96 | /** |
||
97 | * @param array $parameters |
||
98 | * @param string $config |
||
99 | * |
||
100 | * @return \SoapClient |
||
101 | */ |
||
102 | 2 | public function open(array $parameters = [], $config = 'individual.yml', array $options = []) |
|
134 | } |
||
135 |
This check marks private properties in classes that are never used. Those properties can be removed.