Skip to content

Commit

Permalink
added username method, but needs unit tests bug 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Botsko committed May 26, 2011
1 parent 7b32b2b commit b7cdb93
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Peregrine.php
Expand Up @@ -720,6 +720,22 @@ public function getName($key = false, $default = NULL){
}


/**
* Returns an acceptable username string
*
* @param string $key
* @param string $default
* @return string
*/
public function getUsername($key = false, $default = NULL){
$default = $default === NULL ? false : $default;
if($this->isSetAndNotEmpty($key)){
return preg_replace('/[^a-zA-Z0-9-_\.]/', '', $this->getKey($key));
}
return $default;
}


/**
* Returns a string of characters allowed within addresses
*
Expand Down

0 comments on commit b7cdb93

Please sign in to comment.