source: branches/2.4/prototype/rest/hypermedia/item.php @ 6754

Revision 6754, 814 bytes checked in by niltonneto, 12 years ago (diff)

Ticket #0000 - Copiadas as alterações do Trunk. Versão final da 2.4.1.

  • Property svn:executable set to *
Line 
1<?php
2
3class Item {
4
5    public $href;
6    public $dataType;
7    public $data = array();
8    public $links = array();
9
10    function __construct($config, $className, $id) {
11        foreach ($config as $key => $value) {
12            if ($value['class'] == $className) {
13                //TODO - Verificar expressão regular
14                $uri = preg_replace('/\/[:][a-zA-Z-0-9]+/', '', $key);
15                break;
16            }
17        }
18        $this->href = $uri .'/'. $id;
19        $this->dataType = $uri;
20    }
21   
22    function setDataType($dataType) {
23        $this->dataType = $dataType;
24    }
25
26    function getDataType() {
27        return $this->dataType;
28    }
29
30    function setHref($href) {
31        $this->href = $href;
32    }
33
34    function getHref() {
35        return $this->href;
36    }
37
38    function addData($data) {
39        $this->data[] = $data;
40    }
41
42    function addLink($link) {
43        $this->links[] = $link;
44    }
45
46}
47
48?> 
Note: See TracBrowser for help on using the repository browser.