source: trunk/prototype/rest/hypermedia/item.php @ 6528

Revision 6528, 627 bytes checked in by gustavo, 12 years ago (diff)

Ticket #2766 - Merge do branch das novas funcionalidaes para o trunk

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