Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymast committed Apr 11, 2016
1 parent f49e028 commit f705ca6
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 121 deletions.
167 changes: 81 additions & 86 deletions README.md
Expand Up @@ -14,106 +14,102 @@ print_r($resolver);

***output***
```bash
iMac-van-Johnny:redbox-dns johnny$ php ./example.php
$ php ./example.php
Redbox\DNS\Resolver Object
(
[data:Redbox\DNS\Reflectable:private] => Array
[storage:ArrayIterator:private] => Array
(
[DNS] => Array
[0] => Array
(
[0] => Array
(
[host] => php.net
[class] => IN
[ttl] => 312
[type] => A
[ip] => 72.52.91.14
)
[host] => php.net
[class] => IN
[ttl] => 375
[type] => A
[ip] => 72.52.91.14
)

[1] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns1.easydns.com
)
[1] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns2.easydns.net
)

[2] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns3.easydns.org
)
[2] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns1.easydns.com
)

[3] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns2.easydns.net
)
[3] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns3.easydns.org
)

[4] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns4.easydns.info
)
[4] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => NS
[target] => dns4.easydns.info
)

[5] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => SOA
[mname] => ns1.php.net
[rname] => admin.easydns.com
[serial] => 1449389723
[refresh] => 16384
[retry] => 2048
[expire] => 1048576
[minimum-ttl] => 2560
)
[5] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => SOA
[mname] => ns1.php.net
[rname] => admin.easydns.com
[serial] => 1449389723
[refresh] => 16384
[retry] => 2048
[expire] => 1048576
[minimum-ttl] => 2560
)

[6] => Array
(
[host] => php.net
[class] => IN
[ttl] => 38
[type] => MX
[pri] => 0
[target] => php-smtp2.php.net
)
[6] => Array
(
[host] => php.net
[class] => IN
[ttl] => 38
[type] => MX
[pri] => 0
[target] => php-smtp2.php.net
)

[7] => Array
[7] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => TXT
[txt] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ?all
[entries] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => TXT
[txt] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ?all
[entries] => Array
(
[0] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ?all
)

[0] => v=spf1 ip4:72.52.91.12 ip6:2a02:cb41::8 ip4:140.211.15.143 ?all
)

[8] => Array
(
[host] => php.net
[class] => IN
[ttl] => 274
[type] => AAAA
[ipv6] => 2a02:cb41::7
)
)

[8] => Array
(
[host] => php.net
[class] => IN
[ttl] => 375
[type] => AAAA
[ipv6] => 2a02:cb41::7
)

)
Expand All @@ -139,7 +135,6 @@ The following versions of PHP are supported by this version.
+ PHP 5.6
+ PHP 7
+ HHVM
+ Symfony Yaml 2.8

## Development Requirements

Expand Down
20 changes: 13 additions & 7 deletions src/Resolver.php
@@ -1,14 +1,17 @@
<?php
namespace Redbox\DNS;

class Resolver extends Reflectable
class Resolver extends \ArrayIterator
{
/**
* Resolver constructor.
*/
public function __construct()

public function clear()
{
$this->DNS = [];
$this->rewind();
$num = $this->count();

for ($i = 0; $i < $num; $i++) {
$this->offsetUnset($i);
}
}

/**
Expand All @@ -29,7 +32,10 @@ public function resolve($domain = '', $type = DNS_ANY)
return false;
}

$this->DNS = $result;
foreach ($result as $record) {
$this->append($record);
}

return true;
}

Expand Down
24 changes: 0 additions & 24 deletions tests/Constraint/IsSuccessfulResolveResponseConstraint.php

This file was deleted.

7 changes: 3 additions & 4 deletions tests/ResolverTest.php
@@ -1,7 +1,6 @@
<?php
namespace Redbox\DNS\Tests;
use Redbox\DNS\Resolver as Resolver;
use Redbox\Tests\DNS\Constraint\IsSuccessfulResolveResponseConstraint;

class ResolverTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -29,11 +28,11 @@ public function test_resolve_returns_true_on_success()
/**
* @depends test_resolve_returns_true_on_success
*/
public function test_resolve_returns_has_records_on_success() {
public function test_resolve_returns_has_records_on_success()
{
$resolver = new Resolver;
$resolver->resolve('php.net');
$this->assertThat($resolver, new IsSuccessfulResolveResponseConstraint()) ;
$this->assertTrue(($resolver->count() > 0));
unset($resolver);
}

}

0 comments on commit f705ca6

Please sign in to comment.