Total Complexity | 4 |
Total Lines | 73 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | abstract class AbstractNetworks |
||
11 | { |
||
12 | /** |
||
13 | * @var \Sanchescom\WiFi\System\AbstractNetwork[] |
||
14 | */ |
||
15 | protected $networks; |
||
16 | |||
17 | /** @var \Sanchescom\WiFi\System\Command */ |
||
18 | protected $command; |
||
19 | |||
20 | /** |
||
21 | * @param string $output |
||
22 | * |
||
23 | * @return array |
||
24 | */ |
||
25 | abstract protected function extractingNetworks(string $output): array; |
||
26 | |||
27 | /** |
||
28 | * @return \Sanchescom\WiFi\System\AbstractNetwork |
||
29 | */ |
||
30 | abstract protected function getNetwork(): AbstractNetwork; |
||
31 | |||
32 | /** |
||
33 | * @return string |
||
34 | */ |
||
35 | abstract protected function getCommand(): string; |
||
36 | |||
37 | /** |
||
38 | * AbstractNetworks constructor. |
||
39 | * |
||
40 | * @param \Sanchescom\WiFi\System\Command $command |
||
41 | */ |
||
42 | public function __construct(Command $command) |
||
43 | { |
||
44 | $this->command = $command; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @throws \Exception |
||
49 | * |
||
50 | * @return \Sanchescom\WiFi\System\Collection |
||
51 | */ |
||
52 | public function scan(): Collection |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param array $networks |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | protected function setNetworks(array $networks): void |
||
69 | { |
||
70 | $this->networks = array_map(function (array $network) { |
||
71 | return $this->getNetwork()->createFromArray($network); |
||
72 | }, $networks); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @param string $networksString |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | protected function explodeAvailableNetworks(string $networksString): array |
||
83 | } |
||
84 | } |
||
85 |