| Total Complexity | 5 |
| Total Lines | 111 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | abstract class AbstractNetwork |
||
| 11 | { |
||
| 12 | /** @var string */ |
||
| 13 | const WPA2_SECURITY = 'WPA2'; |
||
| 14 | |||
| 15 | /** @var string */ |
||
| 16 | const WPA_SECURITY = 'WPA'; |
||
| 17 | |||
| 18 | /** @var string */ |
||
| 19 | const WEP_SECURITY = 'WEP'; |
||
| 20 | |||
| 21 | /** @var string */ |
||
| 22 | const UNKNOWN_SECURITY = 'Unknown'; |
||
| 23 | |||
| 24 | /** @var string */ |
||
| 25 | public $bssid; |
||
| 26 | |||
| 27 | /** @var string */ |
||
| 28 | public $ssid; |
||
| 29 | |||
| 30 | /** @var int */ |
||
| 31 | public $channel; |
||
| 32 | |||
| 33 | /** @var float */ |
||
| 34 | public $quality; |
||
| 35 | |||
| 36 | /** @var float */ |
||
| 37 | public $dbm; |
||
| 38 | |||
| 39 | /** @var string */ |
||
| 40 | public $security; |
||
| 41 | |||
| 42 | /** @var string */ |
||
| 43 | public $securityFlags; |
||
| 44 | |||
| 45 | /** @var int */ |
||
| 46 | public $frequency; |
||
| 47 | |||
| 48 | /** @var bool */ |
||
| 49 | public $connected; |
||
| 50 | |||
| 51 | /** @var array */ |
||
| 52 | protected static $securityTypes = [ |
||
| 53 | self::WPA2_SECURITY, |
||
| 54 | self::WPA_SECURITY, |
||
| 55 | self::WEP_SECURITY, |
||
| 56 | ]; |
||
| 57 | |||
| 58 | /** @var Command */ |
||
| 59 | protected $command; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * AbstractNetwork constructor. |
||
| 63 | * |
||
| 64 | * @param Command $command |
||
| 65 | */ |
||
| 66 | public function __construct(Command $command) |
||
| 67 | { |
||
| 68 | $this->command = $command; |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return string |
||
| 73 | */ |
||
| 74 | public function getSecurityType(): string |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @return string |
||
| 89 | */ |
||
| 90 | public function __toString(): string |
||
| 101 | ]); |
||
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @param string $password |
||
| 106 | * @param string $device |
||
| 107 | */ |
||
| 108 | abstract public function connect(string $password, string $device): void; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @param string $device |
||
| 112 | */ |
||
| 113 | abstract public function disconnect(string $device): void; |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @param array $network |
||
| 117 | * |
||
| 118 | * @return AbstractNetwork |
||
| 119 | */ |
||
| 120 | abstract public function createFromArray(array $network): self; |
||
| 121 | } |
||
| 122 |