Skip to content

Commit b3e2708

Browse files
committed
Document for phpdoc
1 parent 745d292 commit b3e2708

File tree

4 files changed

+54
-14
lines changed

4 files changed

+54
-14
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,10 @@ $client = new SruClient($url, array(
4141

4242
$response = $client->search('dc.title="Hello world"');
4343

44+
### To generate documentation
45+
46+
wget http://phpdoc.org/phpDocumentor.phar
47+
mkdir docs
48+
php phpDocumentor.phar
49+
4450
```

phpdoc.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<phpdoc>
3+
<title>SRU client</title>
4+
<parser>
5+
<target>docs</target>
6+
</parser>
7+
<transformer>
8+
<target>docs</target>
9+
</transformer>
10+
<files>
11+
<directory>src</directory>
12+
</files>
13+
</phpdoc>

src/Client.php

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,46 @@
11
<?php namespace Scriptotek\Sru;
22

3-
use Danmichaelo\QuiteSimpleXMLElement\QuiteSimpleXMLElement;
43
use \Guzzle\Http\Client as HttpClient;
54

5+
/**
6+
* SRU client
7+
*/
68
class Client {
79

10+
/** @var HttpClient */
811
protected $httpClient;
12+
13+
/** @var string SRU service base URL */
914
protected $url;
15+
16+
/** @var string Requested schema for the returned records */
1017
protected $schema;
11-
protected $namespaces;
18+
19+
/** @var string SRU protocol version */
1220
protected $version;
21+
22+
/** @var string Some user agent string to identify our client */
1323
protected $userAgent;
1424

1525
/**
16-
* Proxy: Either a string or an array:
17-
* - '127.0.0.1:3128'
18-
* - array( '127.0.0.1:3128', 'my_username', 'my_password' )
26+
* @var string|string[] Proxy configuration details.
27+
*
28+
* Either a string 'host:port' or an
29+
* array('host:port', 'username', 'password').
1930
*/
2031
protected $proxy;
2132

2233
/**
23-
* array(username, password)
34+
* @var string[] Array containing username and password
2435
*/
2536
protected $credentials;
2637

2738
/**
2839
* Create a new client
2940
*
30-
* @param string $url
41+
* @param string $url Base URL to the SRU service
3142
* @param array $options Associative array of options
32-
* @param Guzzle\Http\Client $httpClient
43+
* @param HttpClient $httpClient
3344
*/
3445
public function __construct($url, $options = null, $httpClient = null)
3546
{
@@ -69,9 +80,9 @@ public function __construct($url, $options = null, $httpClient = null)
6980
/**
7081
* Construct the URL for a CQL query
7182
*
72-
* @param string $cql
83+
* @param string $cql The CQL query
7384
* @param int $start Start value in result set (optional)
74-
* @param count $count Number of records to request (optional)
85+
* @param int $count Number of records to request (optional)
7586
* @return string
7687
*/
7788
public function urlTo($cql, $start = 1, $count = 10)
@@ -98,8 +109,8 @@ public function urlTo($cql, $start = 1, $count = 10)
98109
*
99110
* @param string $cql
100111
* @param int $start Start value in result set (optional)
101-
* @param count $count Number of records to request (optional)
102-
* @return QuiteSimpleXMLElement
112+
* @param int $count Number of records to request (optional)
113+
* @return Response
103114
*/
104115
public function search($cql, $start = 1, $count = 10) {
105116

src/Response.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
use Danmichaelo\QuiteSimpleXMLElement\QuiteSimpleXMLElement;
44

5+
/**
6+
* SRU response, containing a list of records or some error
7+
*/
58
class Response {
69

10+
/** @var Record[] */
711
public $records;
12+
13+
/** @var string */
814
public $error;
915

16+
/** @var string */
1017
protected $rawResponse;
1118

1219
/**
@@ -33,10 +40,13 @@ public function __construct($text)
3340
$this->records[] = $record;
3441
}
3542

36-
//doc->xpath('/srw:searchRetrieveResponse/
37-
3843
}
3944

45+
/**
46+
* Return the raw xml response
47+
*
48+
* @return string
49+
*/
4050
public function asXml()
4151
{
4252
return $this->rawResponse;

0 commit comments

Comments
 (0)