GetRecordResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 6 3
A __construct() 0 7 2
1
<?php namespace Scriptotek\OaiPmh;
2
3
/**
4
 * GetRecord response, containing a single record or some error
5
 */
6
class GetRecordResponse extends Response
7
{
8
9
    /** @var Record Single record */
10
    public $record;
11
12
    /** @var string */
13
    public $schema;
14
15
    public function __get($name)
16
    {
17
        if (isset($this->record) && isset($this->record->{$name})) {
18
            return $this->record->{$name};
19
        }
20
    }
21
22
    /**
23
     * Create a new GetRecord response
24
     *
25
     * @param string $text Raw XML response
26
     */
27
    public function __construct($text)
28
    {
29
        parent::__construct($text);
30
31
        $rec = $this->response->first('/oai:OAI-PMH/oai:GetRecord/oai:record');
32
        $this->record = $rec ? new Record($rec) : null;
33
    }
34
}
35