\TxTextControl\ReportingCloudReportingCloud

Class ReportingCloud

Summary

Methods
Properties
Constants
deleteApiKey()
deleteTemplate()
getApiKeys()
proofingCheck()
getAvailableDictionaries()
getProofingSuggestions()
getTemplateInfo()
getTemplateThumbnails()
getTemplateCount()
getTemplateList()
getTemplatePageCount()
templateExists()
getFontList()
getAccountSettings()
downloadTemplate()
uploadTemplateFromBase64()
uploadTemplate()
convertDocument()
mergeDocument()
appendDocument()
findAndReplaceDocument()
getDocumentThumbnails()
getTrackedChanges()
removeTrackedChange()
createApiKey()
getApiKey()
setApiKey()
getUsername()
setUsername()
getPassword()
setPassword()
getBaseUri()
setBaseUri()
getDebug()
setDebug()
getTest()
setTest()
getTimeout()
setTimeout()
getVersion()
setVersion()
getClient()
setClient()
__construct()
No public properties found
DEFAULT_DATE_FORMAT
DEFAULT_TIME_ZONE
DEFAULT_BASE_URI
DEFAULT_DEBUG
DEFAULT_TEST
DEFAULT_TIMEOUT
DEFAULT_VERSION
DOCUMENT_DIVIDER_NONE
DOCUMENT_DIVIDER_NEW_PARAGRAPH
DOCUMENT_DIVIDER_NEW_SECTION
FILE_FORMAT_DOC
FILE_FORMAT_DOCX
FILE_FORMAT_HTML
FILE_FORMAT_PDF
FILE_FORMAT_PDFA
FILE_FORMAT_RTF
FILE_FORMAT_TX
FILE_FORMAT_TXT
FILE_FORMAT_BMP
FILE_FORMAT_GIF
FILE_FORMAT_JPG
FILE_FORMAT_PNG
FILE_FORMAT_XLSX
TRACKED_CHANGE_INSERTED_TEXT
TRACKED_CHANGE_DELETED_TEXT
HIGHLIGHT_MODE_NEVER
HIGHLIGHT_MODE_ACTIVATED
HIGHLIGHT_MODE_ALWAYS
FILE_FORMATS_IMAGE
FILE_FORMATS_TEMPLATE
FILE_FORMATS_DOCUMENT
FILE_FORMATS_RETURN
buildPropertyMapArray()
buildDocumentsArray()
buildDocumentSettingsArray()
buildMergeSettingsArray()
buildFindAndReplaceDataArray()
uri()
request()
No protected properties found
N/A
delete()
get()
post()
put()
getAuthorizationHeader()
$apiKey
$username
$password
$baseUri
$debug
$test
$timeout
$version
$client
N/A

Constants

DEFAULT_DATE_FORMAT

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

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

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

DEFAULT_TIME_ZONE

DEFAULT_TIME_ZONE = 'UTC'

Default time zone of backend

DEFAULT_BASE_URI

DEFAULT_BASE_URI = 'https://api.reporting.cloud'

Default base URI of backend

DEFAULT_DEBUG

DEFAULT_DEBUG = false

Default debug flag of REST client

DEFAULT_TEST

DEFAULT_TEST = false

Default test flag of backend

DEFAULT_TIMEOUT

DEFAULT_TIMEOUT = 120

Default timeout of backend in seconds

DEFAULT_VERSION

DEFAULT_VERSION = 'v1'

Default version string of backend

DOCUMENT_DIVIDER_NONE

DOCUMENT_DIVIDER_NONE = 1

Document divider - none

DOCUMENT_DIVIDER_NEW_PARAGRAPH

DOCUMENT_DIVIDER_NEW_PARAGRAPH = 2

Document divider - new paragraph

DOCUMENT_DIVIDER_NEW_SECTION

DOCUMENT_DIVIDER_NEW_SECTION = 3

Document divider - new section

FILE_FORMAT_DOC

FILE_FORMAT_DOC = 'DOC'

DOC file format

FILE_FORMAT_DOCX

FILE_FORMAT_DOCX = 'DOCX'

DOCX file format

FILE_FORMAT_HTML

FILE_FORMAT_HTML = 'HTML'

HTML file format

FILE_FORMAT_PDF

FILE_FORMAT_PDF = 'PDF'

PDF file format

FILE_FORMAT_PDFA

FILE_FORMAT_PDFA = 'PDFA'

PDF/A file format

FILE_FORMAT_RTF

FILE_FORMAT_RTF = 'RTF'

RTF file format

FILE_FORMAT_TX

FILE_FORMAT_TX = 'TX'

TX (Text Control) file format

FILE_FORMAT_TXT

FILE_FORMAT_TXT = 'TXT'

Pure text file format

FILE_FORMAT_BMP

FILE_FORMAT_BMP = 'BMP'

Bitmap file format

FILE_FORMAT_GIF

FILE_FORMAT_GIF = 'GIF'

GIF file format

FILE_FORMAT_JPG

FILE_FORMAT_JPG = 'JPG'

JPEG file format

FILE_FORMAT_PNG

FILE_FORMAT_PNG = 'PNG'

PNG file format

FILE_FORMAT_XLSX

FILE_FORMAT_XLSX = 'XLSX'

XLSX file format

TRACKED_CHANGE_INSERTED_TEXT

TRACKED_CHANGE_INSERTED_TEXT = 4096

InsertedText tracked change

TRACKED_CHANGE_DELETED_TEXT

TRACKED_CHANGE_DELETED_TEXT = 8192

DeletedText tracked change

HIGHLIGHT_MODE_NEVER

HIGHLIGHT_MODE_NEVER = 1

Never highlight mode

HIGHLIGHT_MODE_ACTIVATED

HIGHLIGHT_MODE_ACTIVATED = 2

Activated highlight mode

HIGHLIGHT_MODE_ALWAYS

HIGHLIGHT_MODE_ALWAYS = 3

Always highlight mode

FILE_FORMATS_IMAGE

FILE_FORMATS_IMAGE = [self::FILE_FORMAT_BMP, self::FILE_FORMAT_GIF, self::FILE_FORMAT_JPG, self::FILE_FORMAT_PNG]

Image file formats

FILE_FORMATS_TEMPLATE

FILE_FORMATS_TEMPLATE = [self::FILE_FORMAT_DOC, self::FILE_FORMAT_DOCX, self::FILE_FORMAT_RTF, self::FILE_FORMAT_TX]

Template file formats

FILE_FORMATS_DOCUMENT

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_RETURN

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

Properties

$apiKey

$apiKey : string

Backend API key

Type

string

$username

$username : string

Backend username

Type

string

$password

$password : string

Backend password

Type

string

$baseUri

$baseUri : string

Backend base URI

Type

string

$debug

$debug : bool

Debug flag of REST client

Type

bool

$test

$test : bool

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

Type

bool

$timeout

$timeout : int

Backend timeout in seconds

Type

int

$version

$version : string

Backend version string

Type

string

$client

$client : \GuzzleHttp\Client

REST client to backend

Type

\GuzzleHttp\Client —

Methods

deleteApiKey()

deleteApiKey(string  $key) : bool

Delete an API key

Parameters

string $key

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

bool —

deleteTemplate()

deleteTemplate(string  $templateName) : bool

Delete a template in template storage

Parameters

string $templateName

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

bool —

getApiKeys()

getApiKeys() : array<int,array<int|string,array|bool|int|string>>

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

Returns

array> —

proofingCheck()

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

Check a corpus of text for spelling errors.

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

string $text

Corpus of text that should be spell checked

string $language

Language of specified text

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

getAvailableDictionaries()

getAvailableDictionaries() : array<int,string>

Return an array of available dictionaries on the Reporting Cloud service

Returns

array

getProofingSuggestions()

getProofingSuggestions(string  $word, string  $language, int  $max = 10) : array<int,string>

Return an array of suggestions for a misspelled word

Parameters

string $word

Word that should be spell checked

string $language

Language of specified text

int $max

Maximum number of suggestions to return

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

getTemplateInfo()

getTemplateInfo(string  $templateName) : array<int|string,array|bool|int|string>

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

Parameters

string $templateName

Template name

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

getTemplateThumbnails()

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

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

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

Parameters

string $templateName

Template name

int $zoomFactor

Zoom factor

int $fromPage

From page

int $toPage

To page

string $imageFormat

Image format

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

getTemplateCount()

getTemplateCount() : int

Return the number of templates in template storage

Returns

int —

getTemplateList()

getTemplateList() : array<int|string,array|bool|int|string>

Return an array properties for the templates in template storage

Returns

array

getTemplatePageCount()

getTemplatePageCount(string  $templateName) : int

Return the number of pages in a template in template storage

Parameters

string $templateName

Template name

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

int —

templateExists()

templateExists(string  $templateName) : bool

Return true, if the template exists in template storage

Parameters

string $templateName

Template name

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

bool —

getFontList()

getFontList() : array<int,string>

Return an array of available fonts on the Reporting Cloud service

Returns

array

getAccountSettings()

getAccountSettings() : array<int|string,array|bool|int|string>

Return an array properties for the ReportingCloud account

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

downloadTemplate()

downloadTemplate(string  $templateName) : string

Download the binary data of a template from template storage

Parameters

string $templateName

Template name

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

string —

uploadTemplateFromBase64()

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

Upload a base64 encoded template to template storage

Parameters

string $data

Template encoded as base64

string $templateName

Template name

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

bool —

uploadTemplate()

uploadTemplate(string  $templateFilename) : bool

Upload a template to template storage

Parameters

string $templateFilename

Template name

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

bool —

convertDocument()

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

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

Parameters

string $documentFilename

Document filename

string $returnFormat

Return format

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

string —

mergeDocument()

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

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

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

Parameters

array $mergeData

Array of merge data

string $returnFormat

Return format

string $templateName

Template name

string $templateFilename

Template filename on local file system

bool $append

Append flag

array $mergeSettings

Array of merge settings

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

appendDocument()

appendDocument(array<int|string,array|bool|int|string>  $documentsData, string  $returnFormat, array<string,bool|int|string>  $documentSettings = []) : string

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

Parameters

array $documentsData
string $returnFormat
array $documentSettings

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

string —

findAndReplaceDocument()

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

Perform find and replace in document and return binary data.

Parameters

array $findAndReplaceData

Array of find and replace data

string $returnFormat

Return format

string $templateName

Template name

string $templateFilename

Template filename on local file system

array $mergeSettings

Array of merge settings

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

string —

getDocumentThumbnails()

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

Generate a thumbnail image per page of specified document filename.

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

Parameters

string $documentFilename

Document filename

int $zoomFactor

Zoom factor

int $fromPage

From page

int $toPage

To page

string $imageFormat

Image format

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

getTrackedChanges()

getTrackedChanges(string  $documentFilename) : array<int|string,array|bool|int|string>

Return the tracked changes in a document.

Parameters

string $documentFilename

Document filename

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

removeTrackedChange()

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

Removes a specific tracked change and returns the resulting document.

Parameters

string $documentFilename

Document filename

int $id

The ID of the tracked change that needs to be removed

bool $accept

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

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

array

createApiKey()

createApiKey() : string

Create an API key

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

string —

getApiKey()

getApiKey() : string

Return the API key

Returns

string —

setApiKey()

setApiKey(string  $apiKey) : self

Set the API key

Parameters

string $apiKey

Returns

self —

getUsername()

getUsername() : string

Return the username

Returns

string —

setUsername()

setUsername(string  $username) : self

Set the username

Parameters

string $username

Returns

self —

getPassword()

getPassword() : string

Return the password

Returns

string —

setPassword()

setPassword(string  $password) : self

Set the password

Parameters

string $password

Returns

self —

getBaseUri()

getBaseUri() : string

Return the base URI of the backend web service

Returns

string —

setBaseUri()

setBaseUri(string  $baseUri) : self

Set the base URI of the backend web service

Parameters

string $baseUri

Returns

self —

getDebug()

getDebug() : bool

Return the debug flag

Returns

bool —

setDebug()

setDebug(bool  $debug) : self

Set the debug flag

Parameters

bool $debug

Debug flag

Returns

self —

getTest()

getTest() : bool

Return the test flag

Returns

bool —

setTest()

setTest(bool  $test) : self

Set the test flag

Parameters

bool $test

Returns

self —

getTimeout()

getTimeout() : int

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

Returns

int —

setTimeout()

setTimeout(int  $timeout) : self

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

Parameters

int $timeout

Returns

self —

getVersion()

getVersion() : string

Get the version string of the backend web service

Returns

string —

setVersion()

setVersion(string  $version) : self

Set the version string of the backend web service

Parameters

string $version

Returns

self —

getClient()

getClient() : \GuzzleHttp\Client

Return the REST client of the backend web service

Returns

\GuzzleHttp\Client —

setClient()

setClient(\GuzzleHttp\Client  $client) : self

Set the REST client of the backend web service

Parameters

\GuzzleHttp\Client $client

Returns

self —

__construct()

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

ReportingCloud constructor

Parameters

array $options

Returns

mixed —

buildPropertyMapArray()

buildPropertyMapArray(array  $array, \TxTextControl\ReportingCloud\PropertyMap\AbstractPropertyMap  $propertyMap) : array

Using the passed propertyMap, recursively build array

Parameters

array $array

Array

\TxTextControl\ReportingCloud\PropertyMap\AbstractPropertyMap $propertyMap

PropertyMap

Returns

array —

buildDocumentsArray()

buildDocumentsArray(array  $array) : array

Using passed documentsData array, build array for backend

Parameters

array $array

AppendDocument array

Returns

array —

buildDocumentSettingsArray()

buildDocumentSettingsArray(array  $array) : array

Using passed documentsSettings array, build array for backend

Parameters

array $array

Returns

array —

buildMergeSettingsArray()

buildMergeSettingsArray(array  $array) : array

Using passed mergeSettings array, build array for backend

Parameters

array $array

MergeSettings array

Returns

array —

buildFindAndReplaceDataArray()

buildFindAndReplaceDataArray(array  $array) : array

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

Parameters

array $array

FindAndReplaceData array

Returns

array —

uri()

uri(string  $uri) : string

Construct URI with version number

Parameters

string $uri

URI

Returns

string —

request()

request(string  $method, string  $uri, array<string,array|bool|int|string>  $options) : \Psr\Http\Message\ResponseInterface

Request the URI with options

Parameters

string $method

HTTP method

string $uri

URI

array $options

Options

Throws

\TxTextControl\ReportingCloud\Exception\RuntimeException

Returns

\Psr\Http\Message\ResponseInterface —

delete()

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

Execute a DELETE request via REST client

Parameters

string $uri

URI

array $query

Query

mixed $json

JSON

int $statusCode

Required HTTP status code for response

Returns

bool —

get()

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

Execute a GET request via REST client

Parameters

string $uri

URI

array $query

Query

mixed $json

JSON

int $statusCode

Required HTTP status code for response

Returns

mixed —

post()

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

Execute a POST request via REST client

Parameters

string $uri

URI

array|array[] $query

Query

mixed $json

JSON

int $statusCode

Required HTTP status code for response

Returns

mixed —

put()

put(string  $uri, array[]  $query = [], mixed  $json = '', int  $statusCode) : string

Execute a PUT request via REST client

Parameters

string $uri

URI

array[] $query

Query

mixed $json

JSON

int $statusCode

Required HTTP status code for response

Returns

string —

getAuthorizationHeader()

getAuthorizationHeader() : string

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

Throws

\TxTextControl\ReportingCloud\Exception\InvalidArgumentException

Returns

string —