Documentation

ReportingCloud extends AbstractReportingCloud
in package
Uses BuildTrait, DeleteTrait, GetTrait, PostTrait, PutTrait

Abstract ReportingCloud

Table of Contents

Constants

DEFAULT_BASE_URI  = 'https://api.reporting.cloud'
Default base URI of backend
DEFAULT_DATE_FORMAT  = 'Y-m-d\\TH:i:sP'
Default date/time format of backend is 'ISO 8601'
DEFAULT_TIME_ZONE  = 'UTC'
Default time zone of backend
DOCUMENT_DIVIDER_NEW_PARAGRAPH  = 2
Document divider - new paragraph
DOCUMENT_DIVIDER_NEW_SECTION  = 3
Document divider - new section
DOCUMENT_DIVIDER_NONE  = 1
Document divider - none
FILE_FORMAT_BMP  = 'BMP'
Bitmap file format
FILE_FORMAT_DOC  = 'DOC'
DOC file format
FILE_FORMAT_DOCX  = 'DOCX'
DOCX file format
FILE_FORMAT_GIF  = 'GIF'
GIF file format
FILE_FORMAT_HTML  = 'HTML'
HTML file format
FILE_FORMAT_JPG  = 'JPG'
JPEG file format
FILE_FORMAT_PDF  = 'PDF'
PDF file format
FILE_FORMAT_PDFA  = 'PDFA'
PDF/A file format
FILE_FORMAT_PNG  = 'PNG'
PNG file format
FILE_FORMAT_RTF  = 'RTF'
RTF file format
FILE_FORMAT_TX  = 'TX'
TX (Text Control) file format
FILE_FORMAT_TXT  = 'TXT'
Pure text file format
FILE_FORMAT_XLSX  = 'XLSX'
XLSX file format
FILE_FORMATS_DOCUMENT  = [self::FILE_FORMAT_DOC, self::FILE_FORMAT_DOCX, self::FILE_FORMAT_HTML, self::FILE_FORMAT_PDF, self::FILE_FORMAT_RTF, self::FILE_FORMAT_TX]
Document file formats
FILE_FORMATS_IMAGE  = [self::FILE_FORMAT_BMP, self::FILE_FORMAT_GIF, self::FILE_FORMAT_JPG, self::FILE_FORMAT_PNG]
Image file formats
FILE_FORMATS_RETURN  = [self::FILE_FORMAT_DOC, self::FILE_FORMAT_DOCX, self::FILE_FORMAT_HTML, self::FILE_FORMAT_PDF, self::FILE_FORMAT_PDFA, self::FILE_FORMAT_RTF, self::FILE_FORMAT_TX, self::FILE_FORMAT_TXT]
Return file formats
FILE_FORMATS_TEMPLATE  = [self::FILE_FORMAT_DOC, self::FILE_FORMAT_DOCX, self::FILE_FORMAT_RTF, self::FILE_FORMAT_TX]
Template file formats
HIGHLIGHT_MODE_ACTIVATED  = 2
Activated highlight mode
HIGHLIGHT_MODE_ALWAYS  = 3
Always highlight mode
HIGHLIGHT_MODE_NEVER  = 1
Never highlight mode
TRACKED_CHANGE_DELETED_TEXT  = 8192
DeletedText tracked change
TRACKED_CHANGE_INSERTED_TEXT  = 4096
InsertedText tracked change
DEFAULT_DEBUG  = false
Default debug flag of REST client
DEFAULT_TEST  = false
Default test flag of backend
DEFAULT_TIMEOUT  = 120
Default timeout of backend in seconds
DEFAULT_VERSION  = 'v1'
Default version string of backend

Properties

$apiKey  : string
Backend API key
$baseUri  : string
Backend base URI
$client  : Client
REST client to backend
$debug  : bool
Debug flag of REST client
$password  : string
Backend password
$test  : bool
When true, API call does not count against quota "TEST MODE" watermark is added to document
$timeout  : int
Backend timeout in seconds
$username  : string
Backend username
$version  : string
Backend version string

Methods

__construct()  : mixed
appendDocument()  : string
Combine documents by appending them, divided by a new section, paragraph or nothing
convertDocument()  : string
Convert a document on the local file system to a different format
createApiKey()  : string
Create an API key
deleteApiKey()  : bool
Delete an API key
deleteTemplate()  : bool
Delete a template in template storage
downloadTemplate()  : string
Download the binary data of a template from template storage
findAndReplaceDocument()  : string
Perform find and replace in document and return binary data.
getAccountSettings()  : array<string|int, mixed>
Return an array of properties for the ReportingCloud account
getApiKey()  : string
Return the API key
getApiKeys()  : array<string|int, mixed>
Return an associative array of API keys associated with the Reporting Cloud account
getAvailableDictionaries()  : array<string|int, mixed>
Return an array of available dictionaries on the Reporting Cloud service
getBaseUri()  : string
Return the base URI of the backend web service
getClient()  : Client
Return the REST client of the backend web service
getDebug()  : bool
Return the debug flag
getDocumentThumbnails()  : array<string|int, mixed>
Generate a thumbnail image per page of specified document filename.
getFontList()  : array<string|int, mixed>
Return an array of available fonts on the Reporting Cloud service
getPassword()  : string
Return the password
getProofingSuggestions()  : array<string|int, mixed>
Return an array of suggestions for a misspelled word
getTemplateCount()  : int
Return the number of templates in template storage
getTemplateInfo()  : array<string|int, mixed>
Return an array of merge blocks and merge fields in a template file in template storage
getTemplateList()  : array<string|int, mixed>
Return an array of properties for the templates in template storage
getTemplatePageCount()  : int
Return the number of pages in a template in template storage
getTemplateThumbnails()  : array<string|int, mixed>
Generate a thumbnail image per page of specified template in template storage.
getTest()  : bool
Return the test flag
getTimeout()  : int
Get the timeout (in seconds) of the backend web service
getTrackedChanges()  : array<string|int, mixed>
Return the tracked changes in a document.
getUsername()  : string
Return the username
getVersion()  : string
Get the version string of the backend web service
mergeDocument()  : array<string|int, mixed>
Merge data into a template and return an array of binary data.
proofingCheck()  : array<string|int, mixed>
Check a corpus of text for spelling errors.
removeTrackedChange()  : array<string|int, mixed>
Removes a specific tracked change and returns the resulting document.
setApiKey()  : self
Set the API key
setBaseUri()  : self
Set the base URI of the backend web service
setClient()  : self
Set the REST client of the backend web service
setDebug()  : self
Set the debug flag
setPassword()  : self
Set the password
setTest()  : self
Set the test flag
setTimeout()  : self
Set the timeout (in seconds) of the backend web service
setUsername()  : self
Set the username
setVersion()  : self
Set the version string of the backend web service
templateExists()  : bool
Return true, if the template exists in template storage
uploadTemplate()  : bool
Upload a template to template storage
uploadTemplateFromBase64()  : bool
Upload a base64 encoded template to template storage
buildDocumentsArray()  : array<string|int, mixed>
Using passed documentsData array, build array for backend
buildDocumentSettingsArray()  : array<string|int, mixed>
Using passed documentsSettings array, build array for backend
buildFindAndReplaceDataArray()  : array<string|int, mixed>
Using passed findAndReplaceData associative array (key-value), build array for backend (list of string arrays)
buildMergeSettingsArray()  : array<string|int, mixed>
Using passed mergeSettings array, build array for backend
buildPropertyMapArray()  : array<string|int, mixed>
Using the passed propertyMap, recursively build array
request()  : ResponseInterface
Request the URI with options
uri()  : string
Construct URI with version number
delete()  : bool
Execute a DELETE request via REST client
get()  : mixed
Execute a GET request via REST client
getAuthorizationHeader()  : string
Return Authorization Header, with either API key or username and password
post()  : mixed
Execute a POST request via REST client
put()  : string
Execute a PUT request via REST client

Constants

DEFAULT_BASE_URI

Default base URI of backend

public final string DEFAULT_BASE_URI = 'https://api.reporting.cloud'
Tags
const

DEFAULT_BASE_URI

DEFAULT_DATE_FORMAT

Default date/time format of backend is 'ISO 8601'

public final string DEFAULT_DATE_FORMAT = 'Y-m-d\\TH:i:sP'

Note, last letter is 'P' and not 'O':

O - Difference to Greenwich time (GMT) in hours (e.g. +0200) P - Difference to Greenwich time (GMT) with colon between hours and minutes (e.g. +02:00)

Backend uses the 'P' variant

Tags
const

DEFAULT_DATE_FORMAT

DEFAULT_TIME_ZONE

Default time zone of backend

public final string DEFAULT_TIME_ZONE = 'UTC'
Tags
const

DEFAULT_TIME_ZONE

DOCUMENT_DIVIDER_NEW_PARAGRAPH

Document divider - new paragraph

public final int DOCUMENT_DIVIDER_NEW_PARAGRAPH = 2

DOCUMENT_DIVIDER_NEW_SECTION

Document divider - new section

public final int DOCUMENT_DIVIDER_NEW_SECTION = 3

FILE_FORMATS_DOCUMENT

Document file formats

public final array<string|int, string> FILE_FORMATS_DOCUMENT = [self::FILE_FORMAT_DOC, self::FILE_FORMAT_DOCX, self::FILE_FORMAT_HTML, self::FILE_FORMAT_PDF, self::FILE_FORMAT_RTF, self::FILE_FORMAT_TX]

FILE_FORMATS_IMAGE

Image file formats

public final array<string|int, string> FILE_FORMATS_IMAGE = [self::FILE_FORMAT_BMP, self::FILE_FORMAT_GIF, self::FILE_FORMAT_JPG, self::FILE_FORMAT_PNG]

FILE_FORMATS_RETURN

Return file formats

public final array<string|int, string> FILE_FORMATS_RETURN = [self::FILE_FORMAT_DOC, self::FILE_FORMAT_DOCX, self::FILE_FORMAT_HTML, self::FILE_FORMAT_PDF, self::FILE_FORMAT_PDFA, self::FILE_FORMAT_RTF, self::FILE_FORMAT_TX, self::FILE_FORMAT_TXT]

FILE_FORMATS_TEMPLATE

Template file formats

public final array<string|int, string> FILE_FORMATS_TEMPLATE = [self::FILE_FORMAT_DOC, self::FILE_FORMAT_DOCX, self::FILE_FORMAT_RTF, self::FILE_FORMAT_TX]

HIGHLIGHT_MODE_ACTIVATED

Activated highlight mode

public final int HIGHLIGHT_MODE_ACTIVATED = 2

TRACKED_CHANGE_DELETED_TEXT

DeletedText tracked change

public final int TRACKED_CHANGE_DELETED_TEXT = 8192

TRACKED_CHANGE_INSERTED_TEXT

InsertedText tracked change

public final int TRACKED_CHANGE_INSERTED_TEXT = 4096

DEFAULT_DEBUG

Default debug flag of REST client

protected bool DEFAULT_DEBUG = false
Tags
const

DEFAULT_DEBUG

DEFAULT_TEST

Default test flag of backend

protected bool DEFAULT_TEST = false
Tags
const

DEFAULT_TEST

DEFAULT_TIMEOUT

Default timeout of backend in seconds

protected int DEFAULT_TIMEOUT = 120
Tags
const

DEFAULT_TIMEOUT

DEFAULT_VERSION

Default version string of backend

protected string DEFAULT_VERSION = 'v1'
Tags
const

DEFAULT_VERSION

Properties

$test

When true, API call does not count against quota "TEST MODE" watermark is added to document

private bool $test = false

Methods

__construct()

public __construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
$options : array<string|int, mixed> = []

appendDocument()

Combine documents by appending them, divided by a new section, paragraph or nothing

public appendDocument(array<string|int, mixed> $documentsData, string $returnFormat[, array<string|int, mixed> $documentSettings = [] ]) : string
Parameters
$documentsData : array<string|int, mixed>
$returnFormat : string
$documentSettings : array<string|int, mixed> = []
Return values
string

convertDocument()

Convert a document on the local file system to a different format

public convertDocument(string $documentFilename, string $returnFormat) : string
Parameters
$documentFilename : string

Document filename

$returnFormat : string

Return format

Return values
string

createApiKey()

Create an API key

public createApiKey() : string
Return values
string

deleteApiKey()

Delete an API key

public deleteApiKey(string $key) : bool
Parameters
$key : string
Return values
bool

deleteTemplate()

Delete a template in template storage

public deleteTemplate(string $templateName) : bool
Parameters
$templateName : string
Return values
bool

downloadTemplate()

Download the binary data of a template from template storage

public downloadTemplate(string $templateName) : string
Parameters
$templateName : string

Template name

Return values
string

findAndReplaceDocument()

Perform find and replace in document and return binary data.

public findAndReplaceDocument(array<string|int, mixed> $findAndReplaceData, string $returnFormat[, string $templateName = '' ][, string $templateFilename = '' ][, array<string|int, mixed> $mergeSettings = [] ]) : string
Parameters
$findAndReplaceData : array<string|int, mixed>

Array of find and replace data

$returnFormat : string

Return format

$templateName : string = ''

Template name

$templateFilename : string = ''

Template filename on local file system

$mergeSettings : array<string|int, mixed> = []

Array of merge settings

Return values
string

getAccountSettings()

Return an array of properties for the ReportingCloud account

public getAccountSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

getApiKeys()

Return an associative array of API keys associated with the Reporting Cloud account

public getApiKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>

getAvailableDictionaries()

Return an array of available dictionaries on the Reporting Cloud service

public getAvailableDictionaries() : array<string|int, mixed>
Return values
array<string|int, mixed>

getBaseUri()

Return the base URI of the backend web service

public getBaseUri() : string
Return values
string

getClient()

Return the REST client of the backend web service

public getClient() : Client
Return values
Client

getDocumentThumbnails()

Generate a thumbnail image per page of specified document filename.

public getDocumentThumbnails(string $documentFilename, int $zoomFactor, int $fromPage, int $toPage, string $imageFormat) : array<string|int, mixed>

Return an array of binary data with each record containing one thumbnail.

Parameters
$documentFilename : string

Document filename

$zoomFactor : int

Zoom factor

$fromPage : int

From page

$toPage : int

To page

$imageFormat : string

Image format

Return values
array<string|int, mixed>

getFontList()

Return an array of available fonts on the Reporting Cloud service

public getFontList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPassword()

Return the password

public getPassword() : string
Tags
deprecated

Use $this->getApiKey() instead

Return values
string

getProofingSuggestions()

Return an array of suggestions for a misspelled word

public getProofingSuggestions(string $word, string $language[, int $max = 10 ]) : array<string|int, mixed>
Parameters
$word : string

Word that should be spell checked

$language : string

Language of specified text

$max : int = 10

Maximum number of suggestions to return

Return values
array<string|int, mixed>

getTemplateCount()

Return the number of templates in template storage

public getTemplateCount() : int
Return values
int

getTemplateInfo()

Return an array of merge blocks and merge fields in a template file in template storage

public getTemplateInfo(string $templateName) : array<string|int, mixed>
Parameters
$templateName : string

Template name

Return values
array<string|int, mixed>

getTemplateList()

Return an array of properties for the templates in template storage

public getTemplateList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTemplatePageCount()

Return the number of pages in a template in template storage

public getTemplatePageCount(string $templateName) : int
Parameters
$templateName : string

Template name

Return values
int

getTemplateThumbnails()

Generate a thumbnail image per page of specified template in template storage.

public getTemplateThumbnails(string $templateName, int $zoomFactor, int $fromPage, int $toPage, string $imageFormat) : array<string|int, mixed>

Return an array of binary data with each record containing one thumbnail.

Parameters
$templateName : string

Template name

$zoomFactor : int

Zoom factor

$fromPage : int

From page

$toPage : int

To page

$imageFormat : string

Image format

Return values
array<string|int, mixed>

getTimeout()

Get the timeout (in seconds) of the backend web service

public getTimeout() : int
Return values
int

getTrackedChanges()

Return the tracked changes in a document.

public getTrackedChanges(string $documentFilename) : array<string|int, mixed>
Parameters
$documentFilename : string

Document filename

Return values
array<string|int, mixed>

getUsername()

Return the username

public getUsername() : string
Tags
deprecated

Use $this->getApiKey(): string instead

Return values
string

getVersion()

Get the version string of the backend web service

public getVersion() : string
Return values
string

mergeDocument()

Merge data into a template and return an array of binary data.

public mergeDocument(array<string|int, mixed> $mergeData, string $returnFormat[, string $templateName = '' ][, string $templateFilename = '' ][, bool $append = false ][, array<string|int, mixed> $mergeSettings = [] ]) : array<string|int, mixed>

Each record in the array is the binary data of one document

Parameters
$mergeData : array<string|int, mixed>

Array of merge data

$returnFormat : string

Return format

$templateName : string = ''

Template name

$templateFilename : string = ''

Template filename on local file system

$append : bool = false

Append flag

$mergeSettings : array<string|int, mixed> = []

Array of merge settings

Return values
array<string|int, mixed>

proofingCheck()

Check a corpus of text for spelling errors.

public proofingCheck(string $text, string $language) : array<string|int, mixed>

Return an array of misspelled words, if spelling errors are found in the corpus of text.

Return an empty array, if no misspelled words are found in the corpus of text.

Parameters
$text : string

Corpus of text that should be spell checked

$language : string

Language of specified text

Return values
array<string|int, mixed>

removeTrackedChange()

Removes a specific tracked change and returns the resulting document.

public removeTrackedChange(string $documentFilename, int $id, bool $accept) : array<string|int, mixed>
Parameters
$documentFilename : string

Document filename

$id : int

The ID of the tracked change that needs to be removed

$accept : bool

Specifies whether the tracked change should be accepted or not (reject)

Return values
array<string|int, mixed>

setApiKey()

Set the API key

public setApiKey(string $apiKey) : self
Parameters
$apiKey : string
Return values
self

setBaseUri()

Set the base URI of the backend web service

public setBaseUri(string $baseUri) : self
Parameters
$baseUri : string
Return values
self

setClient()

Set the REST client of the backend web service

public setClient(Client $client) : self
Parameters
$client : Client
Return values
self

setDebug()

Set the debug flag

public setDebug(bool $debug) : self
Parameters
$debug : bool

Debug flag

Return values
self

setPassword()

Set the password

public setPassword(string $password) : self
Parameters
$password : string
Tags
deprecated

Use $this->setApiKey(string $apiKey): self instead

Return values
self

setTest()

Set the test flag

public setTest(bool $test) : self
Parameters
$test : bool
Return values
self

setTimeout()

Set the timeout (in seconds) of the backend web service

public setTimeout(int $timeout) : self
Parameters
$timeout : int
Return values
self

setUsername()

Set the username

public setUsername(string $username) : self
Parameters
$username : string
Tags
deprecated

Use $this->setApiKey(string $apiKey): self instead

Return values
self

setVersion()

Set the version string of the backend web service

public setVersion(string $version) : self
Parameters
$version : string
Return values
self

templateExists()

Return true, if the template exists in template storage

public templateExists(string $templateName) : bool
Parameters
$templateName : string

Template name

Return values
bool

uploadTemplate()

Upload a template to template storage

public uploadTemplate(string $templateFilename) : bool
Parameters
$templateFilename : string

Template name

Return values
bool

uploadTemplateFromBase64()

Upload a base64 encoded template to template storage

public uploadTemplateFromBase64(string $data, string $templateName) : bool
Parameters
$data : string

Template encoded as base64

$templateName : string

Template name

Return values
bool

buildDocumentsArray()

Using passed documentsData array, build array for backend

protected abstract buildDocumentsArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

AppendDocument array

Return values
array<string|int, mixed>

buildDocumentSettingsArray()

Using passed documentsSettings array, build array for backend

protected abstract buildDocumentSettingsArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
Return values
array<string|int, mixed>

buildFindAndReplaceDataArray()

Using passed findAndReplaceData associative array (key-value), build array for backend (list of string arrays)

protected abstract buildFindAndReplaceDataArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

FindAndReplaceData array

Return values
array<string|int, mixed>

buildMergeSettingsArray()

Using passed mergeSettings array, build array for backend

protected abstract buildMergeSettingsArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

MergeSettings array

Return values
array<string|int, mixed>

buildPropertyMapArray()

Using the passed propertyMap, recursively build array

protected abstract buildPropertyMapArray(array<string|int, mixed> $array, AbstractPropertyMap $propertyMap) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

Array

$propertyMap : AbstractPropertyMap

PropertyMap

Return values
array<string|int, mixed>

request()

Request the URI with options

protected request(string $method, string $uri, array<string|int, mixed> $options) : ResponseInterface
Parameters
$method : string

HTTP method

$uri : string

URI

$options : array<string|int, mixed>

Options

Return values
ResponseInterface

uri()

Construct URI with version number

protected uri(string $uri) : string
Parameters
$uri : string

URI

Return values
string

delete()

Execute a DELETE request via REST client

private delete(string $uri[, array<string|int, mixed> $query = [] ][, mixed $json = '' ][, int $statusCode = 0 ]) : bool
Parameters
$uri : string

URI

$query : array<string|int, mixed> = []

Query

$json : mixed = ''

JSON

$statusCode : int = 0

Required HTTP status code for response

Return values
bool

get()

Execute a GET request via REST client

private get(string $uri[, array<string|int, mixed> $query = [] ][, mixed $json = '' ][, int $statusCode = 0 ]) : mixed
Parameters
$uri : string

URI

$query : array<string|int, mixed> = []

Query

$json : mixed = ''

JSON

$statusCode : int = 0

Required HTTP status code for response

getAuthorizationHeader()

Return Authorization Header, with either API key or username and password

private getAuthorizationHeader() : string
Return values
string

post()

Execute a POST request via REST client

private post(string $uri[, array<string|int, mixed> $query = [] ][, mixed $json = '' ][, int $statusCode = 0 ]) : mixed
Parameters
$uri : string

URI

$query : array<string|int, mixed> = []

Query

$json : mixed = ''

JSON

$statusCode : int = 0

Required HTTP status code for response

put()

Execute a PUT request via REST client

private put(string $uri[, array<string|int, array<string|int, mixed>> $query = [] ][, mixed $json = '' ][, int $statusCode = 0 ]) : string
Parameters
$uri : string

URI

$query : array<string|int, array<string|int, mixed>> = []

Query

$json : mixed = ''

JSON

$statusCode : int = 0

Required HTTP status code for response

Return values
string

        
On this page

Search results