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