source: sandbox/2.4-expresso-api/prototype/rest/hypermedia/item.php @ 6230

Revision 6230, 621 bytes checked in by acoutinho, 12 years ago (diff)

Ticket #2758 - Implementacao dos recursos de contatos dinamicos no modelo de rest

  • 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
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    }
20
21    function setHref($href) {
22        $this->href = $href;
23    }
24
25    function getHref() {
26        return $this->href;
27    }
28
29    function addData($data) {
30        $this->data[] = $data;
31    }
32
33    function addLink($link) {
34        $this->links[] = $link;
35    }
36
37}
38
39?> 
Note: See TracBrowser for help on using the repository browser.