00001 <?php 00002 /*************************************************************************** 00003 * Copyright (C) 2004-2007 by Konstantin V. Arkhipov * 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 00018 abstract class NamedObject 00019 extends IdentifiableObject 00020 implements Named, Stringable 00021 { 00022 protected $name = null; 00023 00024 public static function compareNames( 00025 Named $left, Named $right 00026 ) 00027 { 00028 return strcasecmp($left->getName(), $right->getName()); 00029 } 00030 00031 public function getName() 00032 { 00033 return $this->name; 00034 } 00035 00039 public function setName($name) 00040 { 00041 $this->name = $name; 00042 00043 return $this; 00044 } 00045 00046 public function toString() 00047 { 00048 return "[{$this->id}] {$this->name}"; 00049 } 00050 } 00051 ?>