IdentifiableObject.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2005-2007 by Garmonbozia Research Group                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00020     class /* spirit of */ IdentifiableObject implements Identifiable
00021     {
00022         protected $id = null;
00023         
00027         public static function wrap($id)
00028         {
00029             $io = new self;
00030             
00031             return $io->setId($id);
00032         }
00033         
00034         public function getId()
00035         {
00036             if (
00037                 $this->id instanceof Identifier
00038                 && $this->id->isFinalized()
00039             )
00040                 return $this->id->getId();
00041             else
00042                 return $this->id;
00043         }
00044         
00048         public function setId($id)
00049         {
00050             $this->id = $id;
00051             
00052             return $this;
00053         }
00054     }
00055 ?>