Skip to content
This repository was archived by the owner on Sep 10, 2023. It is now read-only.

Commit 9f249c9

Browse files
committed
Implemented end-point "/v1/fonts/list".
1 parent 300ee48 commit 9f249c9

4 files changed

Lines changed: 56 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## dev-master
66

7+
## 1.3.0 - 2017-04-05
8+
9+
* Implemented end-point `/v1/fonts/list`.
10+
711
## 1.2.0 - 2017-02-25
812

913
* Updated `zendframework/zend-servicemanager` to `^3.2`.

demo/list-fonts.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
include_once 'bootstrap.php';
4+
5+
use TxTextControl\ReportingCloud\Console\Helper;
6+
use TxTextControl\ReportingCloud\ReportingCloud;
7+
8+
$reportingCloud = new ReportingCloud([
9+
'username' => Helper::username(),
10+
'password' => Helper::password(),
11+
]);
12+
13+
// ---------------------------------------------------------------------------------------------------------------------
14+
15+
var_dump($reportingCloud->getFontList());
16+
17+
// ---------------------------------------------------------------------------------------------------------------------

src/ReportingCloud.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,24 @@ public function templateExists($templateName)
182182
return (boolean) $this->get('/templates/exists', $query);
183183
}
184184

185+
/**
186+
* Return an array of available fonts on the Reporting Cloud service
187+
*
188+
* @return array|null
189+
*/
190+
public function getFontList()
191+
{
192+
$ret = null;
193+
194+
$fonts = $this->get('/fonts/list');
195+
196+
if (is_array($fonts) && count($fonts) > 0) {
197+
$ret = array_map('trim', $fonts);
198+
}
199+
200+
return $ret;
201+
}
202+
185203
/**
186204
* Return an array properties for the ReportingCloud account
187205
*

test/ReportingCloudTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,23 @@ public function testGetTemplateList()
298298

299299
// -----------------------------------------------------------------------------------------------------------------
300300

301+
public function testGetFontList()
302+
{
303+
$fonts = $this->reportingCloud->getFontList();
304+
305+
$this->assertInternalType(PHPUnit_IsType::TYPE_ARRAY, $fonts);
306+
307+
$this->assertContains('Times New Roman', $fonts);
308+
$this->assertContains('Arial' , $fonts);
309+
$this->assertContains('Courier New' , $fonts);
310+
311+
$this->assertArrayHasKey(0, $fonts);
312+
$this->assertArrayHasKey(1, $fonts);
313+
$this->assertArrayHasKey(2, $fonts);
314+
}
315+
316+
// -----------------------------------------------------------------------------------------------------------------
317+
301318
public function testGetAccountSettings()
302319
{
303320
$response = $this->reportingCloud->getAccountSettings();

0 commit comments

Comments
 (0)