Skip to content

Commit

Permalink
Removed support for integer argument which matched client_id as discu…
Browse files Browse the repository at this point in the history
…ssed with @mbabker, thanks.
  • Loading branch information
izharaazmi committed Jan 25, 2016
1 parent f19c140 commit 84163c5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 19 deletions.
8 changes: 3 additions & 5 deletions libraries/cms/application/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ protected function initialiseApp($options = array())
* @return boolean True if this application is administrator.
*
* @since 3.2
* @deprecated Use isClient('administrator') or isClient(1) instead.
* @deprecated Use isClient('administrator') instead.
*/
public function isAdmin()
{
Expand All @@ -682,7 +682,7 @@ public function isAdmin()
* @return boolean True if this application is site.
*
* @since 3.2
* @deprecated Use isClient('site') or isClient(0) instead.
* @deprecated Use isClient('site') instead.
*/
public function isSite()
{
Expand All @@ -700,9 +700,7 @@ public function isSite()
*/
public function isClient($identifier)
{
$match = is_numeric($identifier) ? $this->getClientId() : $this->getName();

return isset($match) && $match == $identifier;
return $this->getName() == $identifier;
}

/**
Expand Down
8 changes: 3 additions & 5 deletions libraries/legacy/application/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ public function getClientId()
* @return boolean True if this application is administrator.
*
* @since 11.1
* @deprecated 4.0 Use isClient('administrator') or isClient(1) instead.
* @deprecated 4.0 Use isClient('administrator') instead.
*/
public function isAdmin()
{
Expand All @@ -1136,7 +1136,7 @@ public function isAdmin()
* @return boolean True if this application is site.
*
* @since 11.1
* @deprecated 4.0 Use isClient('site') or isClient(0) instead.
* @deprecated 4.0 Use isClient('site') instead.
*/
public function isSite()
{
Expand All @@ -1154,9 +1154,7 @@ public function isSite()
*/
public function isClient($identifier)
{
$match = is_numeric($identifier) ? $this->getClientId() : $this->getName();

return isset($match) && $match == $identifier;
return $this->getName() == $identifier;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,7 @@ public function testIsSite()
public function testIsClient()
{
$this->assertTrue($this->class->isClient('administrator'));
$this->assertTrue($this->class->isClient(1));

$this->assertFalse($this->class->isClient('site'));
$this->assertFalse($this->class->isClient(0));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,7 @@ public function testIsSite()
public function testIsClient()
{
$this->assertFalse($this->class->isClient('administrator'));
$this->assertFalse($this->class->isClient(1));

$this->assertFalse($this->class->isClient('site'));
$this->assertFalse($this->class->isClient(0));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,7 @@ public function testIsSite()
public function testIsClient()
{
$this->assertFalse($this->class->isClient('administrator'));
$this->assertFalse($this->class->isClient(1));

$this->assertTrue($this->class->isClient('site'));
$this->assertTrue($this->class->isClient(0));
}

/**
Expand Down

0 comments on commit 84163c5

Please sign in to comment.