From 8136ac38bda667128cdb541fa59fe876c24d5d7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?=
Date: Tue, 14 Sep 2021 13:44:03 +0200
Subject: [PATCH 1/5] Add Utils::log with enum LogLevel (prefix logs)
---
src/Enums/LogLevel.php | 35 +++++++++++++++++++++++++++++++
src/Transport/Response.php | 6 ++----
src/Utils.php | 42 ++++++++++++++++++++++++++++++++++++++
src/WordPress/WPCrm.php | 12 ++++-------
4 files changed, 83 insertions(+), 12 deletions(-)
create mode 100644 src/Enums/LogLevel.php
diff --git a/src/Enums/LogLevel.php b/src/Enums/LogLevel.php
new file mode 100644
index 0000000..72bf28c
--- /dev/null
+++ b/src/Enums/LogLevel.php
@@ -0,0 +1,35 @@
+ 'LOG_EMERG',
+ 'ALERT' => 'LOG_ALERT',
+ 'CRIT' => 'LOG_CRIT',
+ 'ERR' => 'LOG_ERR',
+ 'WARNING' => 'LOG_WARNING',
+ 'NOTICE' => 'LOG_NOTICE',
+ 'INFO' => 'LOG_INFO',
+ 'DEBUG' => 'LOG_DEBUG',
+ ];
+ }
+}
diff --git a/src/Transport/Response.php b/src/Transport/Response.php
index 7934cca..ea51c33 100644
--- a/src/Transport/Response.php
+++ b/src/Transport/Response.php
@@ -4,6 +4,7 @@ namespace LDC\LDCCRM\Transport;
use LDC\LDCCRM\Enums\ApiError;
use LDC\LDCCRM\Enums\ApiStatus;
+use LDC\LDCCRM\Enums\LogLevel;
use LDC\LDCCRM\Exceptions\CrmException;
use LDC\LDCCRM\Utils;
use Psr\Http\Message\ResponseInterface;
@@ -165,10 +166,7 @@ class Response
$version,
$packageInfo['version']
);
- if (\class_exists('\Illuminate\Support\Facades\Log')) {
- \Illuminate\Support\Facades\Log::warning($message);
- }
- \syslog(\LOG_WARNING, $message);
+ Utils::log($message, LogLevel::WARNING());
}
}
}
diff --git a/src/Utils.php b/src/Utils.php
index 7eda121..0316df5 100644
--- a/src/Utils.php
+++ b/src/Utils.php
@@ -4,6 +4,7 @@ namespace LDC\LDCCRM;
use Dotenv\Dotenv;
use LDC\LDCCRM\Enums\HttpMethods;
+use LDC\LDCCRM\Enums\LogLevel;
use LDC\LDCCRM\Exceptions\ValidationException;
use LDC\LDCCRM\Transport\Request;
use Respect\Validation\Validator;
@@ -336,4 +337,45 @@ class Utils
}
}
}
+
+ /**
+ * Undocumented function
+ *
+ * @param string $message
+ * @return void
+ */
+ public static function log(string $message, LogLevel $level)
+ {
+ $message = "LDC CRM: $message";
+ if (\class_exists('\Illuminate\Support\Facades\Log')) {
+ switch ($level) {
+ case LogLevel::EMERG():
+ \Illuminate\Support\Facades\Log::emergency($message);
+ break;
+ case LogLevel::ALERT():
+ \Illuminate\Support\Facades\Log::alert($message);
+ break;
+ case LogLevel::CRIT():
+ \Illuminate\Support\Facades\Log::critical($message);
+ break;
+ case LogLevel::ERR():
+ \Illuminate\Support\Facades\Log::error($message);
+ break;
+ case LogLevel::WARNING():
+ \Illuminate\Support\Facades\Log::warning($message);
+ break;
+ case LogLevel::NOTICE():
+ \Illuminate\Support\Facades\Log::notice($message);
+ break;
+ case LogLevel::INFO():
+ \Illuminate\Support\Facades\Log::info($message);
+ break;
+ case LogLevel::DEBUG():
+ \Illuminate\Support\Facades\Log::debug($message);
+ break;
+ }
+ \Illuminate\Support\Facades\Log::warning($message);
+ }
+ \syslog(\constant($level), $message);
+ }
}
diff --git a/src/WordPress/WPCrm.php b/src/WordPress/WPCrm.php
index 3263e54..8d709f5 100644
--- a/src/WordPress/WPCrm.php
+++ b/src/WordPress/WPCrm.php
@@ -15,12 +15,14 @@ namespace LDC\LDCCRM\WordPress;
use Exception;
use LDC\LDCCRM\CrmApiV2;
use LDC\LDCCRM\Enums\ApiError;
+use LDC\LDCCRM\Enums\LogLevel;
use LDC\LDCCRM\Exceptions\ApiErrorException;
use LDC\LDCCRM\Exceptions\CrmException;
use LDC\LDCCRM\Models\ArcadiaMailDefault;
use LDC\LDCCRM\Models\ArcadiaMailGame;
use LDC\LDCCRM\Models\Customer;
use LDC\LDCCRM\Models\SingleOptin;
+use LDC\LDCCRM\Utils;
use ReflectionClass;
// phpcs:ignore Squiz.PHP.CommentedOutCode.Found
@@ -443,21 +445,15 @@ class WPCrm
case ApiError::apiAuthFailed():
throw $e;
default:
- self::logError($e->getMessage());
+ Utils::log($e->getMessage(), LogLevel::NOTICE());
throw $e;
}
} catch (CrmException $e) {
- self::logError($e->getMessage());
+ Utils::log($e->getMessage(), LogLevel::EMERG());
return false;
}
}
- private static function logError(string $message): void
- {
- // phpcs:ignore Squiz.PHP.DiscouragedFunctions.Found
- error_log($message);
- }
-
/**
* Boot the php session if needed
*
From 60da6e6dcb6adcb414835e306701e3d536f3610a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?=
Date: Tue, 14 Sep 2021 14:23:18 +0200
Subject: [PATCH 2/5] Add some comment on Utils
---
src/Utils.php | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/Utils.php b/src/Utils.php
index 0316df5..95e7879 100644
--- a/src/Utils.php
+++ b/src/Utils.php
@@ -323,6 +323,13 @@ class Utils
return static::$packageInfos;
}
+ /**
+ * Translation a string using php file lang
+ *
+ * @param string $key
+ * @param string $lang
+ * @return string
+ */
public static function translate(string $key, string $lang = 'fr'): string
{
try {
@@ -339,9 +346,12 @@ class Utils
}
/**
- * Undocumented function
+ * Write log using syslog
+ * It also write log using \Illuminate\Support\Facades\Log
+ * if it is present
*
- * @param string $message
+ * @param string $message The message is prefixed with "LDC CRM:"
+ * @param \LDC\LDCCRM\Enums\LogLevel $level The log level to apply
* @return void
*/
public static function log(string $message, LogLevel $level)
From 0fa8c8d691f72c9d48a5db296a830920ef25534a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?=
Date: Tue, 14 Sep 2021 14:23:31 +0200
Subject: [PATCH 3/5] Generate Doc
---
.../classes/LDC-LDCCRM-CrmApiV2.html | 250 ++-
.../classes/LDC-LDCCRM-Enums-ApiError.html | 96 +-
.../classes/LDC-LDCCRM-Enums-ApiStatus.html | 2 +
.../LDC-LDCCRM-Enums-ArcadiaMailType.html | 2 +
.../LDC-LDCCRM-Enums-ArcadiaOrderType.html | 2 +
.../classes/LDC-LDCCRM-Enums-Country.html | 2 +
.../classes/LDC-LDCCRM-Enums-LogLevel.html | 625 ++++++
.../LDC-LDCCRM-Enums-QuestionType.html | 2 +
...C-LDCCRM-Exceptions-ApiErrorException.html | 2 +
.../LDC-LDCCRM-Exceptions-CrmException.html | 2 +
.../LDC-LDCCRM-Exceptions-LoginException.html | 2 +
...LDCCRM-Exceptions-ValidationException.html | 2 +
.../classes/LDC-LDCCRM-Models-Answer.html | 87 +-
.../LDC-LDCCRM-Models-ArcadiaMailDefault.html | 72 +-
.../LDC-LDCCRM-Models-ArcadiaMailGame.html | 72 +-
.../classes/LDC-LDCCRM-Models-Customer.html | 346 ++-
.../classes/LDC-LDCCRM-Models-Question.html | 126 +-
.../LDC-LDCCRM-Models-SingleOptin.html | 26 +-
.../classes/LDC-LDCCRM-Transport-Request.html | 2 +
.../LDC-LDCCRM-Transport-Response.html | 26 +-
documentation/classes/LDC-LDCCRM-Utils.html | 180 +-
.../classes/LDC-LDCCRM-WordPress-WPCrm.html | 1941 +++++++++++++++++
.../LDC-LDCCRM-WordPress-WPCrmAnswer.html | 444 ++++
.../LDC-LDCCRM-WordPress-WPCrmQuestion.html | 576 +++++
.../LDC-LDCCRM-WordPress-WPCrmUser.html | 1633 ++++++++++++++
.../files/examples-customerexample.html | 2 +
documentation/files/src-crmapiv2.html | 2 +
documentation/files/src-enums-apierror.html | 2 +
documentation/files/src-enums-apistatus.html | 2 +
.../files/src-enums-arcadiamailtype.html | 2 +
.../files/src-enums-arcadiaordertype.html | 2 +
documentation/files/src-enums-country.html | 2 +
.../files/src-enums-httpmethods.html | 2 +
documentation/files/src-enums-loglevel.html | 151 ++
.../files/src-enums-questiontype.html | 2 +
.../src-exceptions-apierrorexception.html | 2 +
.../files/src-exceptions-crmexception.html | 2 +
.../files/src-exceptions-loginexception.html | 2 +
.../src-exceptions-validationexception.html | 2 +
documentation/files/src-models-answer.html | 2 +
.../files/src-models-arcadiamaildefault.html | 2 +
.../files/src-models-arcadiamailgame.html | 2 +
.../files/src-models-crmclientmodel.html | 2 +
documentation/files/src-models-customer.html | 2 +
documentation/files/src-models-question.html | 2 +
.../files/src-models-singleoptin.html | 2 +
.../src-providers-crmclientv2provider.html | 2 +
.../files/src-transport-apiinterface.html | 2 +
.../files/src-transport-request.html | 2 +
.../files/src-transport-response.html | 2 +
documentation/files/src-utils.html | 2 +
documentation/files/src-wordpress-wpcrm.html | 191 ++
.../files/src-wordpress-wpcrmanswer.html | 191 ++
.../files/src-wordpress-wpcrmquestion.html | 191 ++
.../files/src-wordpress-wpcrmuser.html | 191 ++
documentation/graphs/classes.html | 2 +
documentation/index.html | 3 +
documentation/indices/files.html | 12 +-
documentation/js/searchIndex.js | 562 ++++-
documentation/namespaces/default.html | 2 +
.../namespaces/ldc-ldccrm-enums.html | 4 +
.../namespaces/ldc-ldccrm-exceptions.html | 2 +
.../namespaces/ldc-ldccrm-models.html | 12 +-
.../namespaces/ldc-ldccrm-providers.html | 2 +
.../namespaces/ldc-ldccrm-transport.html | 2 +
.../namespaces/ldc-ldccrm-wordpress.html | 151 ++
documentation/namespaces/ldc-ldccrm.html | 3 +
documentation/namespaces/ldc.html | 2 +
.../packages/LDCCrmClient-Wordpress.html | 150 ++
.../packages/LDCCrmClient-enums.html | 4 +
.../packages/LDCCrmClient-exceptions.html | 2 +
.../packages/LDCCrmClient-models.html | 12 +-
.../packages/LDCCrmClient-transport.html | 2 +
.../packages/LDCCrmClient-utilities.html | 2 +
documentation/packages/LDCCrmClient.html | 3 +
documentation/packages/None.html | 132 ++
documentation/packages/default.html | 3 +
documentation/reports/deprecated.html | 2 +
documentation/reports/errors.html | 2 +
documentation/reports/markers.html | 470 ++--
80 files changed, 8691 insertions(+), 337 deletions(-)
create mode 100644 documentation/classes/LDC-LDCCRM-Enums-LogLevel.html
create mode 100644 documentation/classes/LDC-LDCCRM-WordPress-WPCrm.html
create mode 100644 documentation/classes/LDC-LDCCRM-WordPress-WPCrmAnswer.html
create mode 100644 documentation/classes/LDC-LDCCRM-WordPress-WPCrmQuestion.html
create mode 100644 documentation/classes/LDC-LDCCRM-WordPress-WPCrmUser.html
create mode 100644 documentation/files/src-enums-loglevel.html
create mode 100644 documentation/files/src-wordpress-wpcrm.html
create mode 100644 documentation/files/src-wordpress-wpcrmanswer.html
create mode 100644 documentation/files/src-wordpress-wpcrmquestion.html
create mode 100644 documentation/files/src-wordpress-wpcrmuser.html
create mode 100644 documentation/namespaces/ldc-ldccrm-wordpress.html
create mode 100644 documentation/packages/LDCCrmClient-Wordpress.html
create mode 100644 documentation/packages/None.html
diff --git a/documentation/classes/LDC-LDCCRM-CrmApiV2.html b/documentation/classes/LDC-LDCCRM-CrmApiV2.html
index 389f499..0219433 100644
--- a/documentation/classes/LDC-LDCCRM-CrmApiV2.html
+++ b/documentation/classes/LDC-LDCCRM-CrmApiV2.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+
public
- getCustomer ( string $identification ) : Customer
+ getCustomer ( string $identification ) : Customer |null
Parameters
@@ -311,11 +347,39 @@ to call its save method later on.
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
- Customer
+ Customer |null
—
-
+ Return null if the customer was not found
+
+
@@ -359,6 +423,32 @@ to call its save method later on.
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
Customer
@@ -379,7 +469,7 @@ to call its save method later on.
@@ -404,12 +494,114 @@ to call its save method later on.
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
Customer
—
+
+
+
+ login()
+
+
+
+
+ Test a customer credentials to see if it can login
+
+
+ public
+ static login ( string $email , string $password ) : bool
+
+
+ Parameters
+
+
+ $email
+ : string
+
+
+
+
+
+ $password
+ : string
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
CrmApiV2.php
:
- 36
+ 42
@@ -437,6 +629,22 @@ to call its save method later on.
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
Return values
bool
@@ -457,7 +665,7 @@ to call its save method later on.
@@ -501,6 +709,26 @@ to call its save method later on.
ApiError::singleOptinCustomerExists If single optin already exists
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
diff --git a/documentation/classes/LDC-LDCCRM-Enums-ApiError.html b/documentation/classes/LDC-LDCCRM-Enums-ApiError.html
index 44ea31c..d2c1087 100644
--- a/documentation/classes/LDC-LDCCRM-Enums-ApiError.html
+++ b/documentation/classes/LDC-LDCCRM-Enums-ApiError.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+
+
+
+ authorizationException()
+
+
+
+
+
+
+ public
+ static authorizationException ( ) :
+
+ You are maybe trying to access data that is out of your range.
+This should not happen normally, it is here to allow you to handle this case.
+If this happens fill a ticket on https://supportweb.ldc.fr
+with some technical details
+
+
+
+
+
Return values
—
@@ -447,7 +500,7 @@ this action
@@ -495,6 +548,40 @@ this action
+ Return values
+
+ —
+
+
+
+
+
+ missingParameter()
+
+
+
+
+
+
+ public
+ static missingParameter ( ) :
+
+ The request is missing some parameters
+
+
+
+
+
Return values
—
@@ -628,7 +715,8 @@ but it already exists
Too many requests have been attempted. The is a throttle security.
Normally you should not trigger this.
-If this happens fill a ticket on https://supportweb.ldc.fr
+If this happens fill a ticket on https://supportweb.ldc.fr
+with some technical details
@@ -688,7 +776,7 @@ you may have to look into message to get the details
diff --git a/documentation/classes/LDC-LDCCRM-Enums-ApiStatus.html b/documentation/classes/LDC-LDCCRM-Enums-ApiStatus.html
index 496c11e..7673647 100644
--- a/documentation/classes/LDC-LDCCRM-Enums-ApiStatus.html
+++ b/documentation/classes/LDC-LDCCRM-Enums-ApiStatus.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+
+
+
+ jsonSerialize()
+
+
+
+
+ Serialize this object to an array
+
+
+ public
+ jsonSerialize ( ) : array<string|int, mixed>
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+
+
Answer.php
:
- 89
+ 96
- Get unanswered question for a specific customer
+ Set unanswered question for a specific customer
public
@@ -645,7 +687,8 @@ Field Type bigInt
: string
-
+
@@ -653,7 +696,8 @@ Field Type bigInt
: int
-
+
@@ -661,17 +705,46 @@ Field Type bigInt
: array<string|int, mixed>
-
+ An array with answers id
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
bool
—
-
+
+
diff --git a/documentation/classes/LDC-LDCCRM-Models-ArcadiaMailDefault.html b/documentation/classes/LDC-LDCCRM-Models-ArcadiaMailDefault.html
index 83b2726..a68e3fb 100644
--- a/documentation/classes/LDC-LDCCRM-Models-ArcadiaMailDefault.html
+++ b/documentation/classes/LDC-LDCCRM-Models-ArcadiaMailDefault.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+
+
+
+
+ jsonSerialize()
+
+
+
+
+ Serialize this object to an array
+
+
+ public
+ jsonSerialize ( ) : array<string|int, mixed>
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+
+
ArcadiaMailGame.php
:
- 149
+ 153
@@ -952,6 +994,32 @@ Required
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
bool
diff --git a/documentation/classes/LDC-LDCCRM-Models-Customer.html b/documentation/classes/LDC-LDCCRM-Models-Customer.html
index e830269..dd55789 100644
--- a/documentation/classes/LDC-LDCCRM-Models-Customer.html
+++ b/documentation/classes/LDC-LDCCRM-Models-Customer.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+
@@ -2122,12 +2215,147 @@ This is an alias of Customer::find()
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
self|null
—
+
+
+
+ jsonSerialize()
+
+
+
+
+ Serialize this object to an array
+
+
+ public
+ jsonSerialize ( ) : array<string|int, mixed>
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+
+
+
+
+
+ login()
+
+
+
+
+ Test customer credentials
+
+
+ public
+ static login ( string $email , string $password ) : bool
+
+
+ Parameters
+
+
+ $email
+ : string
+
+
+
+
+
+ $password
+ : string
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
Customer.php
:
- 438
+ 433
@@ -2155,6 +2383,32 @@ This is an alias of Customer::find()
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
bool
@@ -2177,7 +2431,7 @@ This is an alias of Customer::find()
@@ -2190,6 +2444,32 @@ This is an alias of Customer::find()
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
bool
@@ -2212,7 +2492,7 @@ This is an alias of Customer::find()
@@ -2258,7 +2538,7 @@ This is an alias of Customer::find()
@@ -2291,7 +2571,7 @@ This is an alias of Customer::find()
diff --git a/documentation/classes/LDC-LDCCRM-Models-Question.html b/documentation/classes/LDC-LDCCRM-Models-Question.html
index 4fc4ca8..5d9fd4e 100644
--- a/documentation/classes/LDC-LDCCRM-Models-Question.html
+++ b/documentation/classes/LDC-LDCCRM-Models-Question.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+
+
+
+ jsonSerialize()
+
+
+
+
+ Serialize this object to an array
+
+
+ public
+ jsonSerialize ( ) : array<string|int, mixed>
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+
+
Question.php
:
- 262
+ 273
@@ -1036,6 +1130,32 @@ using validation rules
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
Return values
array<string|int, Question >
diff --git a/documentation/classes/LDC-LDCCRM-Models-SingleOptin.html b/documentation/classes/LDC-LDCCRM-Models-SingleOptin.html
index 940f886..0d4ac86 100644
--- a/documentation/classes/LDC-LDCCRM-Models-SingleOptin.html
+++ b/documentation/classes/LDC-LDCCRM-Models-SingleOptin.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+
+
+
+ $translations
+
+
+
+
+
+
+ Loaded translations
+
+
+ private
+ static array<string|int, mixed>
+ $translations
+ = []
+
+
+
+
+
@@ -311,7 +369,7 @@
@@ -375,7 +433,7 @@
@@ -408,7 +466,7 @@
@@ -455,6 +513,62 @@
—
+
+
+
+ log()
+
+
+
+
+ Write log using syslog
+It also write log using \Illuminate\Support\Facades\Log
+if it is present
+
+
+ public
+ static log ( string $message , LogLevel $level ) : void
+
+
+ Parameters
+
+
+ $message
+ : string
+
+
+ The message is prefixed with "LDC CRM:"
+
+
+
+
+ $level
+ : LogLevel
+
+
+
+
+
+
+
+
+
+ Return values
+ void
+ —
+
+
Utils.php
:
- 49
+ 56
@@ -477,7 +591,7 @@
public
- static makeValidator ( array<string|int, mixed> $data , array<string|int, mixed> $rules [ , array<string|int, mixed> $messages = [] ] [ , array<string|int, mixed> $customAttributes = [] ] ) : Validator
+ static makeValidator ( array<string|int, mixed> $data , array<string|int, mixed> $rules ) : Validator
Parameters
@@ -496,17 +610,53 @@
+
+
+
+
+ Return values
+ Validator
+ —
+
+
+
+
+
+ translate()
+
+
+
+
+ Translation a string using php file lang
+
+
+ public
+ static translate ( string $key [ , string $lang = 'fr' ] ) : string
+
+
+ Parameters
+
- $messages
- : array<string|int, mixed>
- = []
+ $key
+ : string
+
- $customAttributes
- : array<string|int, mixed>
- = []
+ $lang
+ : string
+ = 'fr'
@@ -515,7 +665,7 @@
Return values
- Validator
+ string
—
diff --git a/documentation/classes/LDC-LDCCRM-WordPress-WPCrm.html b/documentation/classes/LDC-LDCCRM-WordPress-WPCrm.html
new file mode 100644
index 0000000..87ee0e2
--- /dev/null
+++ b/documentation/classes/LDC-LDCCRM-WordPress-WPCrm.html
@@ -0,0 +1,1941 @@
+
+
+
+
+ CRM V2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPCrm
+
+
+
+
+
+
+
+
+
+ Class de gestion des users en session avec Wordpress (ce truc immonde)
+
+
+
+
+
+
+ category
+
+
+
+
+
+
+
+ subpackage
+
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+ MIT https://opensource.org/licenses/MIT
+
+
+
+
+ link
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+ $api
+
+ : CrmApiV2
+
+The user object
+
+
+ $user
+
+ : WPCrmUser
+
+The user object
+
+
+ $sessionDestroyed
+
+ : mixed
+
+
+
+
+ $sessionKey
+
+ : mixed
+
+
+
+
+ activateUser()
+
+ : bool
+
+Toggle the current user optin value
+on the current user and the crm
+
+
+ check()
+
+ : bool
+
+Check if the user is Authenticated
+
+
+ deleteUser()
+
+ : bool
+
+Delete current customer from
+the local database and the crm
+
+
+ forceLogin()
+
+ : WPCrmUser |null
+
+Login user by setting user session
+
+
+ getNewUser()
+
+ : WPCrmUser
+
+Generate a new user
+
+
+ getUser()
+
+ : WPCrmUser |null
+
+Get the current user
+return null if the user is not logged in
+
+
+ getUserFromApi()
+
+ : WPCrmUser |false
+
+Get the current user
+return api response code if an error occurs
+
+
+ getUserFromTable()
+
+ : array<string|int, mixed>|null
+
+Get a customer from table
+
+
+ getUserFromTableByEmail()
+
+ : array<string|int, mixed>|null
+
+Get a customer from table by an email
+
+
+ getUserFromTableByUuid()
+
+ : array<string|int, mixed>|null
+
+Get a customer from table by an email
+
+
+ login()
+
+ : WPCrmUser |false
+
+Try to login with CRM API
+return api response code if an error occurs
+
+
+ logout()
+
+ : void
+
+Destroy the customer from session
+and therefore logout
+
+
+ saveUser()
+
+ : bool
+
+Save current customer to
+the local database and on crm
+
+
+ sendArcadiaMailDefault()
+
+ : bool
+
+send An arcadia mail with type default
+This methods requires to have a user in session (to be logged in)
+
+
+ sendArcadiaMailGame()
+
+ : bool
+
+send An arcadia mail with type game
+This methods requires to have a user in session (to be logged in)
+
+
+ setSingleOptin()
+
+ : bool
+
+Set the single optin status for an email
+on the crm
+
+
+ toggleUserOptin()
+
+ : bool
+
+Toggle the current user optin value
+on the current user and the crm
+
+
+ unsetActiveUser()
+
+ : void
+
+Remove active user
+to prevent WPCrm::check to return true
+
+
+ getRawProperty()
+
+ : mixed
+
+Get a property
+
+
+ bootSessionIfNeeded()
+
+ : void
+
+Boot the php session if needed
+
+
+ deleteUserFromTable()
+
+ : void
+
+Save or update the user to the table
+
+
+ getCustomer()
+
+ : Customer |null
+
+Get all customer infos
+
+
+ getWpDb()
+
+ : object
+
+Get WP 'pdo instance'
+
+
+ initLdcApi()
+
+ : ApiV1
+
+Get the initialized API object
+
+
+ loginUserWithApi()
+
+ : WPCrmUser |false
+
+Get the current user
+return null if the user is not logged in
+
+
+ makeApiV2Call()
+
+ : mixed|false
+
+Make a call using apiV2
+
+
+ query()
+
+ : object
+
+Query in DB
+
+
+ saveOrUpdateUserToTable()
+
+ : void
+
+Save or update the user to the table
+
+
+ setUser()
+
+ : void
+
+Create a user
+stores it to the session
+and finally saves it to the database if it does not exists
+
+
+
+
+
+
+
+
+
+
+
+
+ $api
+
+
+
+
+
+
+ The user object
+
+
+ protected
+ static CrmApiV2
+ $api
+ = null
+
+
+
+
+
+
+
+
+ $user
+
+
+
+
+
+
+ The user object
+
+
+ protected
+ static WPCrmUser
+ $user
+ = null
+
+
+
+
+
+
+
+
+ $sessionDestroyed
+
+
+
+
+
+
+
+
+ private
+ static mixed
+ $sessionDestroyed
+ = false
+
+
+
+
+
+
+
+
+
+
+ $sessionKey
+
+
+
+
+
+
+
+
+ private
+ static mixed
+ $sessionKey
+ = 'LDC_CRM_USER'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ activateUser()
+
+
+
+
+ Toggle the current user optin value
+on the current user and the crm
+
+
+ public
+ static activateUser ( ) : bool
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded
+
+
+
+
+
+
+ check()
+
+
+
+
+ Check if the user is Authenticated
+
+
+ public
+ static check ( ) : bool
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
+
+
+
+ deleteUser()
+
+
+
+
+ Delete current customer from
+the local database and the crm
+
+
+ public
+ static deleteUser ( ) : bool
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded
+
+
+
+
+
+
+ forceLogin()
+
+
+
+
+ Login user by setting user session
+
+
+ public
+ static forceLogin ( ) : WPCrmUser |null
+
+
+
+
+
+ Return values
+ WPCrmUser |null
+ —
+
+
+
+
+
+ getNewUser()
+
+
+
+
+ Generate a new user
+
+
+ public
+ static getNewUser ( ) : WPCrmUser
+
+
+
+
+
+ Return values
+ WPCrmUser
+ —
+
+
+
+
+
+ getUser()
+
+
+
+
+ Get the current user
+return null if the user is not logged in
+
+
+ public
+ static getUser ( ) : WPCrmUser |null
+
+
+
+
+
+ Return values
+ WPCrmUser |null
+ —
+
+
+
+
+
+ getUserFromApi()
+
+
+
+
+ Get the current user
+return api response code if an error occurs
+
+
+ public
+ static getUserFromApi ( string $identification ) : WPCrmUser |false
+
+
+ Parameters
+
+
+ $identification
+ : string
+
+
+ The customer hashcode or email
+
+
+
+
+
+
+
+ Return values
+ WPCrmUser |false
+ —
+
+
+
+
+
+ getUserFromTable()
+
+
+
+
+ Get a customer from table
+
+
+ public
+ static getUserFromTable ( string $hashcode ) : array<string|int, mixed>|null
+
+
+ Parameters
+
+
+ $hashcode
+ : string
+
+
+
+
+
+
+
+
+
+ Return values
+ array<string|int, mixed>|null
+ —
+
+
+
+
+
+ getUserFromTableByEmail()
+
+
+
+
+ Get a customer from table by an email
+
+
+ public
+ static getUserFromTableByEmail ( string $email ) : array<string|int, mixed>|null
+
+
+ Parameters
+
+
+ $email
+ : string
+
+
+
+
+
+
+
+
+
+ Return values
+ array<string|int, mixed>|null
+ —
+
+
+
+
+
+ getUserFromTableByUuid()
+
+
+
+
+ Get a customer from table by an email
+
+
+ public
+ static getUserFromTableByUuid ( string $uuid ) : array<string|int, mixed>|null
+
+
+ Parameters
+
+
+ $uuid
+ : string
+
+
+ The customer transaction uuid
+
+
+
+
+
+
+
+ Return values
+ array<string|int, mixed>|null
+ —
+
+
+
+
+
+ login()
+
+
+
+
+ Try to login with CRM API
+return api response code if an error occurs
+
+
+ public
+ static login ( string $email , string $password ) : WPCrmUser |false
+
+
+ Parameters
+
+
+ $email
+ : string
+
+
+
+
+
+
+ $password
+ : string
+
+
+
+
+
+
+
+
+
+ Return values
+ WPCrmUser |false
+ —
+
+
+
+
+
+ logout()
+
+
+
+
+ Destroy the customer from session
+and therefore logout
+
+
+ public
+ static logout ( ) : void
+
+
+
+
+
+ Return values
+ void
+ —
+
+
+
+
+
+ saveUser()
+
+
+
+
+ Save current customer to
+the local database and on crm
+
+
+ public
+ static saveUser ( ) : bool
+
+
+
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ with \LDC\LDCCRM\Enums\ApiError::customerExists()
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded false otherwise
+
+
+
+
+
+
+ sendArcadiaMailDefault()
+
+
+
+
+ send An arcadia mail with type default
+This methods requires to have a user in session (to be logged in)
+
+
+ public
+ static sendArcadiaMailDefault ( ArcadiaMailDefault $mail ) : bool
+
+
+ Parameters
+
+
+ $mail
+ : ArcadiaMailDefault
+
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
+
+
+
+
+ sendArcadiaMailGame()
+
+
+
+
+ send An arcadia mail with type game
+This methods requires to have a user in session (to be logged in)
+
+
+ public
+ static sendArcadiaMailGame ( ArcadiaMailGame $mail ) : bool
+
+
+ Parameters
+
+
+ $mail
+ : ArcadiaMailGame
+
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
+
+
+
+
+ setSingleOptin()
+
+
+
+
+ Set the single optin status for an email
+on the crm
+
+
+ public
+ static setSingleOptin ( string $email , bool $opt_in ) : bool
+
+
+ Parameters
+
+
+ $email
+ : string
+
+
+
+
+
+ $opt_in
+ : bool
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ with \LDC\LDCCRM\Enums\ApiError::singleOptinCustomerExists()
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded false otherwise
+
+
+
+
+
+
+ toggleUserOptin()
+
+
+
+
+ Toggle the current user optin value
+on the current user and the crm
+
+
+ public
+ static toggleUserOptin ( ) : bool
+
+
+
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ with \LDC\LDCCRM\Enums\ApiError::singleOptinCustomerExists()
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded
+
+
+
+
+
+
+ unsetActiveUser()
+
+
+
+
+ Remove active user
+to prevent WPCrm::check to return true
+
+
+ public
+ static unsetActiveUser ( ) : void
+
+
+
+
+
+ Return values
+ void
+ —
+
+
+
+
+
+ getRawProperty()
+
+
+
+
+ Get a property
+
+
+ protected
+ static getRawProperty ( object $object , string $field ) : mixed
+
+
+ Parameters
+
+
+ $object
+ : object
+
+
+
+
+
+
+ $field
+ : string
+
+
+
+
+
+
+
+
+ Return values
+ mixed
+ —
+
+
+
+
+
+ bootSessionIfNeeded()
+
+
+
+
+ Boot the php session if needed
+
+
+ private
+ static bootSessionIfNeeded ( ) : void
+
+
+
+
+
+ Return values
+ void
+ —
+
+
+
+
+
+ deleteUserFromTable()
+
+
+
+
+ Save or update the user to the table
+
+
+ private
+ static deleteUserFromTable ( ) : void
+
+
+
+
+
+ Return values
+ void
+ —
+
+
+
+
+
+ getCustomer()
+
+
+
+
+ Get all customer infos
+
+
+ private
+ static getCustomer ( ) : Customer |null
+
+
+
+
+
+ Return values
+ Customer |null
+ —
+
+
+
+
+
+ getWpDb()
+
+
+
+
+ Get WP 'pdo instance'
+
+
+ private
+ static getWpDb ( ) : object
+
+
+
+
+
+ Return values
+ object
+ —
+
+
+
+
+
+
+ initLdcApi()
+
+
+
+
+ Get the initialized API object
+
+
+ private
+ static initLdcApi ( ) : ApiV1
+
+
+
+
+
+ Return values
+ ApiV1
+ —
+
+
+
+
+
+ loginUserWithApi()
+
+
+
+
+ Get the current user
+return null if the user is not logged in
+
+
+ private
+ static loginUserWithApi ( string $email , string $password ) : WPCrmUser |false
+
+
+ Parameters
+
+
+ $email
+ : string
+
+
+
+
+
+
+ $password
+ : string
+
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
+
+ Return values
+ WPCrmUser |false
+ —
+
+
+
+
+
+ makeApiV2Call()
+
+
+
+
+ Make a call using apiV2
+
+
+ private
+ static makeApiV2Call ( mixed $obj , string $method [ , array<string|int, mixed> $arguments = [] ] ) : mixed|false
+
+
+ Parameters
+
+
+ $obj
+ : mixed
+
+
+
+
+
+
+ $method
+ : string
+
+
+
+
+
+ $arguments
+ : array<string|int, mixed>
+ = []
+
+
+
+
+
+
+
+ Return values
+ mixed|false
+ —
+
+
+
+
+
+ query()
+
+
+
+
+ Query in DB
+
+
+ private
+ static query ( string $query [ , array<string|int, mixed> $params = [] ] ) : object
+
+
+ Parameters
+
+
+ $query
+ : string
+
+
+ La request avec les variables en points d'interrogation
+
+
+
+
+ $params
+ : array<string|int, mixed>
+ = []
+
+ Les paramètres des la requète
+
+
+
+
+
+
+
+ Return values
+ object
+ —
+ Containing the row columns
+
+
+
+
+
+
+ saveOrUpdateUserToTable()
+
+
+
+
+ Save or update the user to the table
+
+
+ private
+ static saveOrUpdateUserToTable ( ) : void
+
+
+
+
+
+ Return values
+ void
+ —
+
+
+
+
+
+ setUser()
+
+
+
+
+ Create a user
+stores it to the session
+and finally saves it to the database if it does not exists
+
+
+ private
+ static setUser ( Customer $customer ) : void
+
+
+ Parameters
+
+
+ $customer
+ : Customer
+
+
+
+
+
+
+
+
+
+ Return values
+ void
+ —
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/classes/LDC-LDCCRM-WordPress-WPCrmAnswer.html b/documentation/classes/LDC-LDCCRM-WordPress-WPCrmAnswer.html
new file mode 100644
index 0000000..13fcef2
--- /dev/null
+++ b/documentation/classes/LDC-LDCCRM-WordPress-WPCrmAnswer.html
@@ -0,0 +1,444 @@
+
+
+
+
+ CRM V2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPCrmAnswer
+
+
+
+
+
+
+
+
+
+ Class de gestion de la segmentation question avec Wordpress (ce truc immonde)
+
+
+
+
+
+
+ category
+
+
+
+
+
+
+
+ subpackage
+
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+ MIT https://opensource.org/licenses/MIT
+
+
+
+
+ link
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+ setQuestionAnswers()
+
+ : bool
+
+Set unanswered question for a specific customer
+
+
+ getRawProperty()
+
+ : mixed
+
+Get a property
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setQuestionAnswers()
+
+
+
+
+ Set unanswered question for a specific customer
+
+
+ public
+ setQuestionAnswers ( WPCrmUser $user , int $questionId , array<string|int, mixed> $answersId ) : bool
+
+
+ Parameters
+
+
+ $user
+ : WPCrmUser
+
+
+
+
+
+
+ $questionId
+ : int
+
+
+
+
+
+
+ $answersId
+ : array<string|int, mixed>
+
+
+ An array with answers id
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
+
+
+
+
+ getRawProperty()
+
+
+
+
+ Get a property
+
+
+ protected
+ static getRawProperty ( object $object , string $field ) : mixed
+
+
+ Parameters
+
+
+ $object
+ : object
+
+
+
+
+
+
+ $field
+ : string
+
+
+
+
+
+
+
+
+ Return values
+ mixed
+ —
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/classes/LDC-LDCCRM-WordPress-WPCrmQuestion.html b/documentation/classes/LDC-LDCCRM-WordPress-WPCrmQuestion.html
new file mode 100644
index 0000000..8229379
--- /dev/null
+++ b/documentation/classes/LDC-LDCCRM-WordPress-WPCrmQuestion.html
@@ -0,0 +1,576 @@
+
+
+
+
+ CRM V2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPCrmQuestion
+
+
+
+
+
+
+
+
+
+ Class de gestion de la segmentation question avec Wordpress (ce truc immonde)
+
+
+
+
+
+
+ category
+
+
+
+
+
+
+
+ subpackage
+
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+ MIT https://opensource.org/licenses/MIT
+
+
+
+
+ link
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+ allWithCustomerAnswers()
+
+ : array<string|int, mixed>
+
+Get all the questions with user answers
+
+
+ getAll()
+
+ : array<string|int, mixed>
+
+Get all questions only
+
+
+ unansweredBy()
+
+ : array<string|int, Question >
+
+Get unanswered question for a specific customer
+
+
+ getRawProperty()
+
+ : mixed
+
+Get a property
+
+
+
+
+
+
+
+
+
+
+
+
+
+ allWithCustomerAnswers()
+
+
+
+
+ Get all the questions with user answers
+
+
+ public
+ static allWithCustomerAnswers ( WPCrmUser $user ) : array<string|int, mixed>
+
+
+ Parameters
+
+
+ $user
+ : WPCrmUser
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+ [
+0 => [
+'question' => \LDC\LDCCRM\Models\Question,
+'customerAnswers' => \LDC\LDCCRM\Models\Answer[]
+]
+]
+with \LDC\LDCCRM\Models\Question[]
+and the customer \LDC\LDCCRM\Models\Answer[]
+
+
+
+
+
+
+ getAll()
+
+
+
+
+ Get all questions only
+
+
+ public
+ static getAll ( ) : array<string|int, mixed>
+
+
+
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+ with \LDC\LDCCRM\Models\Question[]
+
+
+
+
+
+
+ unansweredBy()
+
+
+
+
+ Get unanswered question for a specific customer
+
+
+ public
+ static unansweredBy ( WPCrmUser $user ) : array<string|int, Question >
+
+
+ Parameters
+
+
+ $user
+ : WPCrmUser
+
+
+
+
+
+
+
+
+
+
+ throws
+
+
+ CrmException
+
+ if an error occurs on server side or on getting response
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ If any error or \LDC\LDCCRM\Enums\ApiError occurs
+
+
+
+
+
+ Return values
+ array<string|int, Question >
+ —
+
+
+
+
+
+ getRawProperty()
+
+
+
+
+ Get a property
+
+
+ protected
+ static getRawProperty ( object $object , string $field ) : mixed
+
+
+ Parameters
+
+
+ $object
+ : object
+
+
+
+
+
+
+ $field
+ : string
+
+
+
+
+
+
+
+
+ Return values
+ mixed
+ —
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/classes/LDC-LDCCRM-WordPress-WPCrmUser.html b/documentation/classes/LDC-LDCCRM-WordPress-WPCrmUser.html
new file mode 100644
index 0000000..be04cdb
--- /dev/null
+++ b/documentation/classes/LDC-LDCCRM-WordPress-WPCrmUser.html
@@ -0,0 +1,1633 @@
+
+
+
+
+ CRM V2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPCrmUser
+
+
+
+
+
+ implements
+ JsonSerializable
+
+
+
+
+
+ Class de gestion des users en session avec Wordpress (ce truc immonde)
+
+ @property string $uuidToken — A local transaction token for this user
+
+
+
+
+
+
+ category
+
+
+
+
+
+
+
+ subpackage
+
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+ license
+
+
+
+ MIT https://opensource.org/licenses/MIT
+
+
+
+
+ link
+
+
+ /
+
+
+
+
+
+
+
+
+ Interfaces, Classes and Traits
+
+
+
+
+ JsonSerializable
+
+
+
+
+
+
+
+ Table of Contents
+
+
+
+
+
+ $address
+
+ : string
+
+
+
+
+ $address2
+
+ : string
+
+
+
+
+ $birth_date
+
+ : string
+
+
+
+
+ $city
+
+ : string
+
+
+
+
+ $country
+
+ : Country
+
+
+
+
+ $email
+
+ : string
+
+
+
+
+ $firstname
+
+ : string
+
+
+
+
+ $hashcode
+
+ : string
+
+
+
+
+ $last_connection
+
+ : string
+
+
+
+
+ $lastname
+
+ : string
+
+
+
+
+ $opt_in
+
+ : bool
+
+
+
+
+ $password
+
+ : string
+
+
+
+
+ $phone
+
+ : string
+
+
+
+
+ $postcode
+
+ : string
+
+
+
+
+ $status
+
+ : bool
+
+
+
+
+ $info
+
+ : Customer
+
+The CRM customer info (the api response)
+
+
+ $pemail
+
+ : string
+
+The CRM customer email
+
+
+ $phashcode
+
+ : string
+
+The CRM hashcode (UUID)
+
+
+ $uuidToken
+
+ : string
+
+The CRM customer temp uuidToken to validate transactions
+
+
+ __construct()
+
+ : mixed
+
+WPCrmUser construct
+
+
+ __get()
+
+ : bool|string|Country
+
+Magic getter
+
+
+ __set()
+
+ : bool|string|Country
+
+Magic setter
+
+
+ activate()
+
+ : bool
+
+Activate the account in the crm
+
+
+ delete()
+
+ : bool
+
+Delete current customer to
+the local database and on crm
+
+
+ jsonSerialize()
+
+ : array<string|int, mixed>
+
+Serialize this object to an array
+
+
+ parseFromJson()
+
+ : WPCrmUser
+
+Generate a user from session data
+
+
+ save()
+
+ : bool
+
+Save current customer to
+the local database and on crm
+
+
+ setInfo()
+
+ : void
+
+Set the customer info
+with api response
+
+
+ toggleOptin()
+
+ : bool
+
+Toggle the current user optin value
+on the current user and the crm
+
+
+
+
+
+
+
+
+
+
+
+
+ $address
+
+
+
+
+
+
+
+
+ public
+ string
+ $address
+
+
+ The account address (street number, name, build, flat number)
+
+
+
+
+
+
+
+
+
+ $address2
+
+
+
+
+
+
+
+
+ public
+ string
+ $address2
+
+
+ — The account phone (address complement)
+
+
+
+
+
+
+
+
+
+ $birth_date
+
+
+
+
+
+
+
+
+ public
+ string
+ $birth_date
+
+
+ — The account birth date 'yyyy-mm-dd'
+
+
+
+
+
+
+
+
+
+ $city
+
+
+
+
+
+
+
+
+ public
+ string
+ $city
+
+
+ — The account city name
+
+
+
+
+
+
+
+
+
+ $country
+
+
+
+
+
+
+
+
+ public
+ Country
+ $country
+
+
+ — The account country residence
+
+
+
+
+
+
+
+
+
+ $email
+
+
+
+
+
+
+
+
+ public
+ string
+ $email
+
+
+ — Must be a rfc valid email on a valid domain name
+
+
+
+
+
+
+
+
+
+ $firstname
+
+
+
+
+
+
+
+
+ public
+ string
+ $firstname
+
+
+ — The account first name
+
+
+
+
+
+
+
+
+
+ $hashcode
+
+
+
+
+
+
+
+
+ public
+ string
+ $hashcode
+
+
+ — The crm hashcode this is a readonly field
+
+
+
+
+
+
+
+
+
+ $last_connection
+
+
+
+
+
+
+
+
+ public
+ string
+ $last_connection
+
+
+ the last time user was connected 'yyyy-mm-dd HH:ii:ss'
+
+
+
+
+
+
+
+
+
+ $lastname
+
+
+
+
+
+
+
+
+ public
+ string
+ $lastname
+
+
+ — The account last name
+
+
+
+
+
+
+
+
+
+ $opt_in
+
+
+
+
+
+
+
+
+ public
+ bool
+ $opt_in
+
+
+ — true if the account is opt in
+
+
+
+
+
+
+
+
+
+ $password
+
+
+
+
+
+
+
+
+ public
+ string
+ $password
+
+
+ Required only on create,
+must have upper and lowers chars,
+at least 1 number,
+at leat 1 upper char,
+at least 1 lower char and
+at leat 1 special char
+
+
+
+
+
+
+
+
+
+ $phone
+
+
+
+
+
+
+
+
+ public
+ string
+ $phone
+
+
+
+
+
+
+
+
+
+
+
+ $postcode
+
+
+
+
+
+
+
+
+ public
+ string
+ $postcode
+
+
+ — The account city postcode
+
+
+
+
+
+
+
+
+
+ $status
+
+
+
+
+
+
+
+
+ public
+ bool
+ $status
+
+
+ — true if the account is activated
+
+
+
+
+
+
+
+
+
+ $info
+
+
+
+
+
+
+ The CRM customer info (the api response)
+
+
+ protected
+ Customer
+ $info
+ = null
+
+
+
+
+
+
+
+
+ $pemail
+
+
+
+
+
+
+ The CRM customer email
+
+
+ protected
+ string
+ $pemail
+ = null
+
+
+
+
+
+
+
+
+ $phashcode
+
+
+
+
+
+
+ The CRM hashcode (UUID)
+
+
+ protected
+ string
+ $phashcode
+ = null
+
+
+
+
+
+
+
+
+ $uuidToken
+
+
+
+
+
+
+ The CRM customer temp uuidToken to validate transactions
+
+
+ protected
+ string
+ $uuidToken
+ = null
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __construct()
+
+
+
+
+ WPCrmUser construct
+
+
+ public
+ __construct ( [ string $hashcode = null ] [ , string $email = null ] ) : mixed
+
+
+ Parameters
+
+
+ $hashcode
+ : string
+ = null
+
+ The customer hashcode (UUID)
+
+
+
+
+ $email
+ : string
+ = null
+
+
+
+
+
+
+
+
+ Return values
+ mixed
+ —
+
+
+
+
+
+ __get()
+
+
+
+
+ Magic getter
+
+
+ public
+ __get ( string $prop ) : bool|string|Country
+
+
+ Parameters
+
+
+ $prop
+ : string
+
+
+
+
+
+
+
+
+
+ Return values
+ bool|string|Country
+ —
+
+
+
+
+
+ __set()
+
+
+
+
+ Magic setter
+
+
+ public
+ __set ( string $prop , mixed $value ) : bool|string|Country
+
+
+ Parameters
+
+
+ $prop
+ : string
+
+
+
+
+
+
+ $value
+ : mixed
+
+
+
+
+
+
+
+
+
+ Return values
+ bool|string|Country
+ —
+
+
+
+
+
+ activate()
+
+
+
+
+ Activate the account in the crm
+
+
+ public
+ activate ( ) : bool
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
+
+
+
+
+ delete()
+
+
+
+
+ Delete current customer to
+the local database and on crm
+
+
+ public
+ delete ( ) : bool
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded false otherwise
+
+
+
+
+
+
+ jsonSerialize()
+
+
+
+
+ Serialize this object to an array
+
+
+ public
+ jsonSerialize ( ) : array<string|int, mixed>
+
+
+
+
+
+ Return values
+ array<string|int, mixed>
+ —
+
+
+
+
+
+ parseFromJson()
+
+
+
+
+ Generate a user from session data
+
+
+ public
+ static parseFromJson ( string $string ) : WPCrmUser
+
+
+ Parameters
+
+
+ $string
+ : string
+
+
+ The json data stored in session
+
+
+
+
+
+
+
+ Return values
+ WPCrmUser
+ —
+
+
+
+
+
+ save()
+
+
+
+
+ Save current customer to
+the local database and on crm
+
+
+ public
+ save ( ) : bool
+
+
+
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ with \LDC\LDCCRM\Enums\ApiError::customerExists()
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded false otherwise
+
+
+
+
+
+
+ setInfo()
+
+
+
+
+ Set the customer info
+with api response
+
+
+ public
+ setInfo ( Customer $customer ) : void
+
+
+ Parameters
+
+
+ $customer
+ : Customer
+
+
+ The Api object reponse (user)
+
+
+
+
+
+
+
+ Return values
+ void
+ —
+
+
+
+
+
+ toggleOptin()
+
+
+
+
+ Toggle the current user optin value
+on the current user and the crm
+
+
+ public
+ toggleOptin ( ) : bool
+
+
+
+
+
+
+
+ throws
+
+
+ ApiErrorException
+
+ with \LDC\LDCCRM\Enums\ApiError::singleOptinCustomerExists()
+
+
+
+
+
+ Return values
+ bool
+ —
+ true if the operation succeeded
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/files/examples-customerexample.html b/documentation/files/examples-customerexample.html
index 2f66a7c..7bb0da2 100644
--- a/documentation/files/examples-customerexample.html
+++ b/documentation/files/examples-customerexample.html
@@ -70,7 +70,9 @@
models
transport
utilities
+ Wordpress
+