Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
breaking(Parser): make getSubdomains always return an array (#33)
Browse files Browse the repository at this point in the history
breaking(Parser): make getSubdomains always return an array
  • Loading branch information
Rohaq authored and layershifter committed Sep 28, 2018
1 parent 34cb389 commit 236bfa0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public function getSubdomain()
/**
* Return subdomains if they exist, example subdomain is "www.news", method will return array ['www', 'bbc'].
*
* @return null|array
* @return array
*/
public function getSubdomains()
{
return null === $this->subdomain ? null : explode('.', $this->subdomain);
return null === $this->subdomain ? array() : explode('.', $this->subdomain);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getSubdomain();
/**
* Return subdomains if they exist, example subdomain is "www.news", method will return array ['www', 'bbc'].
*
* @return null|array
* @return array
*/
public function getSubdomains();

Expand Down
4 changes: 2 additions & 2 deletions tests/ResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testDomain()

static::assertEquals('github.com', $result->getFullHost());
static::assertEquals(null, $result->getSubdomain());
static::assertEquals(null, $result->getSubdomains());
static::assertEquals(array(), $result->getSubdomains());
static::assertEquals('github.com', $result->getRegistrableDomain());
static::assertTrue($result->isValidDomain());
static::assertFalse($result->isIp());
Expand Down Expand Up @@ -136,7 +136,7 @@ public function testIp()

static::assertEquals('192.168.0.1', $result->getFullHost());
static::assertEquals(null, $result->getSubdomain());
static::assertEquals(null, $result->getSubdomains());
static::assertEquals(array(), $result->getSubdomains());
static::assertNull($result->getRegistrableDomain());
static::assertFalse($result->isValidDomain());
static::assertTrue($result->isIp());
Expand Down

0 comments on commit 236bfa0

Please sign in to comment.