RestfulServerList::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace SilverStripe\RestfulServer;
4
5
/**
6
 * Restful server handler for a SS_List
7
 */
8
class RestfulServerList
9
{
10
    private static $url_handlers = array(
0 ignored issues
show
introduced by
The private property $url_handlers is not used, and could be removed.
Loading history...
11
        '#ID' => 'handleItem',
12
    );
13
14
    public function __construct($list)
15
    {
16
        $this->list = $list;
0 ignored issues
show
Bug Best Practice introduced by
The property list does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
17
    }
18
19
    public function handleItem($request)
20
    {
21
        return new RestfulServerItem($this->list->getById($request->param('ID')));
22
    }
23
}
24