/** * DNS A Lookup * @param $hostname * @return array * @throws Exception */ protected function dns_lookup_a($hostname) { $service_array = $this->dns_lookup($hostname); $service_array = $service_array[0]; if (!array_has_keys(['host', 'type', 'ip'], $service_array)) { throw new Exception('Wrong Keys'); // @todo Update } return $service_array; }
public function test_array_has_keys() { // True $array = ['a' => 'a', 'b' => 'b']; $keys = ['a', 'b']; $this->assertTrue(array_has_keys($keys, $array)); // False $array = ['a' => 'a']; $keys = ['a', 'b']; $this->assertFalse(array_has_keys($keys, $array)); }