<?php
/*******************************************************************
 * IdentityService.php
 * Copyright (C) 2006 Midnight Coders, LLC
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * The software is licensed under the GNU General Public License (GPL)
 * For details, see http://www.gnu.org/licenses/gpl.txt.
 ********************************************************************/
class IdentityService
{
    public function HideIdentity(Identity $myIdentity)
    {
        $arrColors = array("Blue", "Brown", "Green", "Transparent", "Red");
    	
    	$myIdentity->name = str_replace("s", "sh", $myIdentity->name);
        $myIdentity->name = str_replace("o", "u", $myIdentity->name);
        $myIdentity->name = str_replace("a", "o", $myIdentity->name);
        $myIdentity->name = str_replace("j", "g", $myIdentity->name);
        $myIdentity->name = str_replace("e", "a", $myIdentity->name);
        $myIdentity->name = str_replace("y", "i", $myIdentity->name);
        $myIdentity->name = str_replace("p", "b", $myIdentity->name);
        $myIdentity->name = str_replace("r", "ch", $myIdentity->name);

        $myIdentity->eyeColor = $arrColors[rand(0, 4)];

        $myIdentity->age += rand(0, 20);

        return $myIdentity;
    }
}

class Identity
{
    var $name;
    var $age;
    var $sex;
    var $eyeColor;
}
?>