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

Commit

Permalink
Removing some underscores removed from protected & private properties
Browse files Browse the repository at this point in the history
  • Loading branch information
perrick committed Apr 26, 2008
1 parent f32e64f commit d84fe31
Show file tree
Hide file tree
Showing 12 changed files with 436 additions and 435 deletions.
46 changes: 23 additions & 23 deletions authentication.php
Expand Up @@ -16,10 +16,10 @@
* @subpackage WebTester
*/
class SimpleRealm {
private $_type;
private $_root;
private $_username;
private $_password;
private $type;
private $root;
private $username;
private $password;

/**
* Starts with the initial entry directory.
Expand All @@ -30,10 +30,10 @@ class SimpleRealm {
* @access public
*/
function SimpleRealm($type, $url) {
$this->_type = $type;
$this->_root = $url->getBasePath();
$this->_username = false;
$this->_password = false;
$this->type = $type;
$this->root = $url->getBasePath();
$this->username = false;
$this->password = false;
}

/**
Expand All @@ -42,7 +42,7 @@ function SimpleRealm($type, $url) {
* @access public
*/
function stretch($url) {
$this->_root = $this->getCommonPath($this->_root, $url->getPath());
$this->root = $this->getCommonPath($this->root, $url->getPath());
}

/**
Expand Down Expand Up @@ -70,8 +70,8 @@ protected function getCommonPath($first, $second) {
* @access public
*/
function setIdentity($username, $password) {
$this->_username = $username;
$this->_password = $password;
$this->username = $username;
$this->password = $password;
}

/**
Expand All @@ -80,7 +80,7 @@ function setIdentity($username, $password) {
* @access public
*/
function getUsername() {
return $this->_username;
return $this->username;
}

/**
Expand All @@ -89,7 +89,7 @@ function getUsername() {
* @access public
*/
function getPassword() {
return $this->_password;
return $this->password;
}

/**
Expand All @@ -100,10 +100,10 @@ function getPassword() {
* @access public
*/
function isWithin($url) {
if ($this->isIn($this->_root, $url->getBasePath())) {
if ($this->isIn($this->root, $url->getBasePath())) {
return true;
}
if ($this->isIn($this->_root, $url->getBasePath() . $url->getPage() . '/')) {
if ($this->isIn($this->root, $url->getBasePath() . $url->getPage() . '/')) {
return true;
}
return false;
Expand All @@ -129,7 +129,7 @@ protected function isIn($part, $whole) {
* @subpackage WebTester
*/
class SimpleAuthenticator {
private $_realms;
private $realms;

/**
* Clears the realms.
Expand All @@ -144,7 +144,7 @@ function SimpleAuthenticator() {
* @access public
*/
function restartSession() {
$this->_realms = array();
$this->realms = array();
}

/**
Expand All @@ -164,7 +164,7 @@ function restartSession() {
* @access public
*/
function addRealm($url, $type, $realm) {
$this->_realms[$url->getHost()][$realm] = new SimpleRealm($type, $url);
$this->realms[$url->getHost()][$realm] = new SimpleRealm($type, $url);
}

/**
Expand All @@ -177,8 +177,8 @@ function addRealm($url, $type, $realm) {
* @access public
*/
function setIdentityForRealm($host, $realm, $username, $password) {
if (isset($this->_realms[$host][$realm])) {
$this->_realms[$host][$realm]->setIdentity($username, $password);
if (isset($this->realms[$host][$realm])) {
$this->realms[$host][$realm]->setIdentity($username, $password);
}
}

Expand All @@ -189,10 +189,10 @@ function setIdentityForRealm($host, $realm, $username, $password) {
* @access private
*/
protected function findRealmFromUrl($url) {
if (! isset($this->_realms[$url->getHost()])) {
if (! isset($this->realms[$url->getHost()])) {
return false;
}
foreach ($this->_realms[$url->getHost()] as $name => $realm) {
foreach ($this->realms[$url->getHost()] as $name => $realm) {
if ($realm->isWithin($url)) {
return $realm;
}
Expand Down Expand Up @@ -230,7 +230,7 @@ function addHeaders(&$request, $url) {
static function addBasicHeaders(&$request, $username, $password) {
if ($username && $password) {
$request->addHeaderLine(
'Authorization: Basic ' . base64_encode("$username:$password"));
'Authorization: Basic ' . base64_encode("$username:$password"));
}
}
}
Expand Down

0 comments on commit d84fe31

Please sign in to comment.