From: olivier <> Date: Thu, 9 Apr 2009 08:57:24 +0000 (+0000) Subject: eztelemeta: simplify directory structure X-Git-Tag: 1.1~691 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fcc91a2d3fd041f569e65e59eb85ec4a9832957e;p=telemeta.git eztelemeta: simplify directory structure --- diff --git a/tools/eztelemeta/datatypes/telemetaitem/telemetaitem.php b/tools/eztelemeta/datatypes/telemetaitem/telemetaitem.php deleted file mode 100644 index bfad1382..00000000 --- a/tools/eztelemeta/datatypes/telemetaitem/telemetaitem.php +++ /dev/null @@ -1,109 +0,0 @@ - null, - 'title' => null, - 'description' => null, - 'rights' => null, - 'duration' => null, - 'creator' => null, - 'timeFetched' => null - ); - - - /** - * Constructs a new Telemeta item data type - * - * @param string $data Serialized data - * @throws telemetaDatatypeInvalidParamsError - */ - public function __construct($data = null) - { - if ($data) { - $data = unserialize($data); - if (!$data) { - throw new telemetaInvalidParamsError("Couldn't unserialize Telemeta Item data"); - } - $this->properties = array_merge($this->properties, $data); - } - } - - private function fetch($itemId) - { - if ($itemId == 1000) { - $this->properties['id'] = 1000; - $this->properties['title'] = "Pulp Fiction"; - $this->properties['description'] = "A crazy movie"; - $this->properties['rights'] = "Copyright Holywood"; - $this->properties['duration'] = 3600 + 1800; - $this->properties['creator'] = "Quentin Tarantino"; - $this->properties['timeFetched'] = time(); - return true; - } - return false; - } - - public function __toString() - { - return serialize($this->properties); - } - - public static function createFromString($str) - { - return new self($str); - } - - public function attribute($name) - { - return $this->__get($name); - } - - public function hasAttribute($name) - { - return $this->__isset($name); - } - - public function __get($name) - { - if ($this->__isset($name)) { - return $this->properties[$name]; - } else { - throw new ezcBasePropertyNotFoundException($name); - } - } - - public function __isset($name) - { - return (array_key_exists($name, $this->properties) and !is_null($this->properties[$name])); - } - - public function hasContent() - { - return $this->__isset('id'); - } -} - - -?> - diff --git a/tools/eztelemeta/exceptions/invalidparams.php b/tools/eztelemeta/exceptions/invalidparams.php deleted file mode 100644 index ac85e7d8..00000000 --- a/tools/eztelemeta/exceptions/invalidparams.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/tools/eztelemeta/src/exceptions.php b/tools/eztelemeta/src/exceptions.php new file mode 100644 index 00000000..ac85e7d8 --- /dev/null +++ b/tools/eztelemeta/src/exceptions.php @@ -0,0 +1,27 @@ + diff --git a/tools/eztelemeta/src/telemetaitem.php b/tools/eztelemeta/src/telemetaitem.php new file mode 100644 index 00000000..bfad1382 --- /dev/null +++ b/tools/eztelemeta/src/telemetaitem.php @@ -0,0 +1,109 @@ + null, + 'title' => null, + 'description' => null, + 'rights' => null, + 'duration' => null, + 'creator' => null, + 'timeFetched' => null + ); + + + /** + * Constructs a new Telemeta item data type + * + * @param string $data Serialized data + * @throws telemetaDatatypeInvalidParamsError + */ + public function __construct($data = null) + { + if ($data) { + $data = unserialize($data); + if (!$data) { + throw new telemetaInvalidParamsError("Couldn't unserialize Telemeta Item data"); + } + $this->properties = array_merge($this->properties, $data); + } + } + + private function fetch($itemId) + { + if ($itemId == 1000) { + $this->properties['id'] = 1000; + $this->properties['title'] = "Pulp Fiction"; + $this->properties['description'] = "A crazy movie"; + $this->properties['rights'] = "Copyright Holywood"; + $this->properties['duration'] = 3600 + 1800; + $this->properties['creator'] = "Quentin Tarantino"; + $this->properties['timeFetched'] = time(); + return true; + } + return false; + } + + public function __toString() + { + return serialize($this->properties); + } + + public static function createFromString($str) + { + return new self($str); + } + + public function attribute($name) + { + return $this->__get($name); + } + + public function hasAttribute($name) + { + return $this->__isset($name); + } + + public function __get($name) + { + if ($this->__isset($name)) { + return $this->properties[$name]; + } else { + throw new ezcBasePropertyNotFoundException($name); + } + } + + public function __isset($name) + { + return (array_key_exists($name, $this->properties) and !is_null($this->properties[$name])); + } + + public function hasContent() + { + return $this->__isset('id'); + } +} + + +?> +