Skip to content

Commit cdb331d

Browse files
committed
New Root class for root url operations
1 parent 11cb95f commit cdb331d

File tree

11 files changed

+76
-25
lines changed

11 files changed

+76
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ composer.lock
1414
/debian/php-flexibee.substvars
1515
/debian/php-flexibee.debhelper.log
1616
/debian/php-spojenet-flexibee-dev.substvars
17+
/debian/php-spojenet-flexibee-dev/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ clean:
2525

2626
apigen:
2727
VERSION=`cat debian/composer.json | grep version | awk -F'"' '{print $4}'`; \
28-
apigen generate --source src --destination docs --title "FlexiPeeHP ${VERSION}" --charset UTF-8 --access-levels public --access-levels protected --php --tree
28+
apigen generate --destination=docs -- src
2929

3030
pretest:
3131
composer --ansi --no-interaction update

debian/.debhelper/generated/php-spojenet-flexibee/installed-by-dh_installdocs

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
testing/src/FlexiPeeHP/*.php /usr/share/php/FlexiPeeHPdev
2+
debian/composer.json /usr/share/php/FlexiPeeHPdev
3+
debian/test/* /usr/share/doc/FlexiPeeHPdev
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
Alias /flexipeehp /usr/share/doc/FlexiPeeHP/html
2-
Alias /FlexiPeeHP /usr/share/doc/FlexiPeeHP/html
1+
Alias /php-flexibee /usr/share/doc/php-spojenet-flexibee/html
2+
3+
4+
5+
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
docs/* usr/share/doc/FlexiPeeHP/html
2-
docs/resources/* usr/share/doc/FlexiPeeHP/html/resources
3-
debian/php-flexibee-doc.conf usr/share/doc/flexipeehp-doc/apache
4-
README.md usr/share/doc/FlexiPeeHP/
1+
docs/* usr/share/doc/php-spojenet-flexibee/html
2+
docs/resources/* usr/share/doc/php-spojenet-flexibee/html/resources
3+
debian/php-spojenet-flexibee-doc.conf usr/share/doc/php-spojenet-flexibee-doc/apache
4+
README.md usr/share/doc/php-spojenet-flexibee

src/FlexiPeeHP/Changes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function rawXmlToArray($rawXML) {
9696
* @return null
9797
*/
9898
public function getVazby($id = null) {
99-
throw new Exception(__('Changes has no relations'));
99+
throw new Exception(_('Changes has no relations'));
100100
}
101101

102102
}

src/FlexiPeeHP/Company.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ public function getRecordID()
249249
*/
250250
public function getVazby($id = null)
251251
{
252-
throw new Exception(__('Company has no relations'));
252+
throw new Exception(_
253+
('Company has no relations'));
253254
}
254255

255256
/**

src/FlexiPeeHP/FlexiBeeRO.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -533,23 +533,23 @@ public function getConnectionOptions() {
533533
*/
534534
public function configToEnv($opts = null) {
535535
$options = is_null($opts) ? $this->getConnectionOptions() : $opts;
536-
if(array_key_exists('url', $options)){
537-
putenv('FLEXIBEE_URL='.$options['URL']);
536+
if (array_key_exists('url', $options)) {
537+
putenv('FLEXIBEE_URL=' . $options['URL']);
538538
}
539-
if(array_key_exists('user', $options)){
540-
putenv('FLEXIBEE_LOGIN='.$options['user']);
539+
if (array_key_exists('user', $options)) {
540+
putenv('FLEXIBEE_LOGIN=' . $options['user']);
541541
}
542-
if(array_key_exists('password', $options)){
543-
putenv('FLEXIBEE_PASSWORD='.$options['password']);
542+
if (array_key_exists('password', $options)) {
543+
putenv('FLEXIBEE_PASSWORD=' . $options['password']);
544544
}
545-
if(array_key_exists('company', $options)){
546-
putenv('FLEXIBEE_COMPANY='.$options['company']);
545+
if (array_key_exists('company', $options)) {
546+
putenv('FLEXIBEE_COMPANY=' . $options['company']);
547547
}
548-
if(array_key_exists('authSessionId', $options)){
549-
putenv('FLEXIBEE_AUTHSESSID='.$options['authSessionId']);
548+
if (array_key_exists('authSessionId', $options)) {
549+
putenv('FLEXIBEE_AUTHSESSID=' . $options['authSessionId']);
550550
}
551551
}
552-
552+
553553
/**
554554
* Inicializace CURL
555555
*
@@ -1087,7 +1087,7 @@ public function parseError(array $responseDecoded) {
10871087
}
10881088

10891089
foreach ($this->errors as $errorInfo) {
1090-
$this->addStatusMessage(array_key_exists('error',$errorInfo) ? $errorInfo['error'] : $errorInfo['message'], 'error');
1090+
$this->addStatusMessage(array_key_exists('error', $errorInfo) ? $errorInfo['error'] : $errorInfo['message'], 'error');
10911091
if (array_key_exists('for', $errorInfo)) {
10921092
unset($errorInfo['message']);
10931093
$this->addStatusMessage(json_encode($errorInfo), 'debug');
@@ -1738,7 +1738,7 @@ public function logResult($resultData = null, $url = null) {
17381738
$resultData = $this->lastResult;
17391739
}
17401740
if (isset($url)) {
1741-
\Ease\Shared::logger()->addToLog($this,$this->lastResponseCode . ':' . urldecode($url));
1741+
\Ease\Shared::logger()->addToLog($this, $this->lastResponseCode . ':' . urldecode($url));
17421742
}
17431743

17441744
if (isset($resultData['results'])) {
@@ -2416,11 +2416,10 @@ public function sendByMail($to, $subject, $body, $cc = null) {
24162416
*
24172417
* @url https://www.flexibee.eu/api/dokumentace/ref/odesilani-mailem/
24182418
*
2419-
* @return int http response code
2419+
* @return boolean
24202420
*/
24212421
public function sendUnsent() {
2422-
return $this->doCurlRequest('automaticky-odeslat-neodeslane', 'PUT',
2423-
'xml');
2422+
return $this->performRequest('automaticky-odeslat-neodeslane', 'PUT', 'xml') == 202;
24242423
}
24252424

24262425
/**

src/FlexiPeeHP/Root.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
/**
4+
* FlexiPeeHP - / related functions.
5+
*
6+
* @author Vítězslav Dvořák <[email protected]>
7+
* @copyright (C) 2015-2017 Spoje.Net
8+
*/
9+
10+
namespace FlexiPeeHP;
11+
12+
/**
13+
* Description of Common
14+
*
15+
* @author vitex
16+
*/
17+
class Root extends FlexiBeeRW {
18+
19+
/**
20+
* Update HTTPS certificate
21+
*
22+
* @param string $pem
23+
*
24+
* @return boolean
25+
*/
26+
public function uploadCertificate($pem) {
27+
$this->postFields = $pem;
28+
$this->performRequest('/certificate', 'PUT');
29+
return $this->lastResponseCode == 201;
30+
}
31+
32+
/**
33+
* Get availble companies listing
34+
*
35+
* @param array $condition applay to listing
36+
*
37+
* @return array
38+
*/
39+
public function companies($conditions = []) {
40+
return $this->getFlexiData('/c', $conditions);
41+
}
42+
43+
}

0 commit comments

Comments
 (0)