$this->description = $description;
}
- public function getType()
- {
- if ($this instanceof ResourceZone) {
- return self::TYPE_ZONE;
- } elseif ($this instanceof ResourcePlace) {
- return self::TYPE_PLACE;
- } elseif ($this instanceof ResourceComputer) {
- return self::TYPE_COMPUTER;
- }
-
- throw new \LogicException(sprintf('Unable to guess type from "%s"', get_class($this)));
- }
-
public function getStatus()
{
return $this->status;
public function isParentRequired()
{
- return $this->getType() === self::TYPE_COMPUTER;
+ return false;
}
- public function getAllowedParentTypes()
- {
- $type = $this->getType();
-
- if ($type === Resource::TYPE_ZONE) {
- return array(Resource::TYPE_ZONE);
- } elseif ($type == Resource::TYPE_PLACE) {
- return array(Resource::TYPE_ZONE, Resource::TYPE_PLACE);
- } elseif ($type == Resource::TYPE_COMPUTER) {
- return array(Resource::TYPE_PLACE);
- }
-
- throw new \InvalidArgumentException(sprintf('No parent types defined for "%s"', $type));
- }
+ abstract public function getAllowedParentTypes();
+ abstract public function getType();
}