You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.5 KiB
47 lines
1.5 KiB
<?php
|
|
namespace app\core\auth;
|
|
|
|
class Profile {
|
|
|
|
public function __construct() {
|
|
}
|
|
|
|
public function formatProfileData(array $userDetails) {
|
|
$user = array(
|
|
'first_name' => $userDetails['firstname'],
|
|
'last_name' => $userDetails['lastname']
|
|
);
|
|
|
|
if(!is_null($userDetails['password']) && !empty($userDetails['password']))
|
|
$user['password'] = hash_password($userDetails['password']);
|
|
|
|
return $user;
|
|
|
|
}
|
|
|
|
public function formatDetailsData(array $userDetails) {
|
|
$subscriber = array(
|
|
'address' => $userDetails['address'],
|
|
'civility' => $userDetails['civil_status'],
|
|
'birthday' => $userDetails['birthday'],
|
|
'postal_code' => $userDetails['postal_code'],
|
|
'country' => $userDetails['country'],
|
|
'city' => $userDetails['city'],
|
|
'profession' => $userDetails['profession'],
|
|
'phone' => $userDetails['phone_number'],
|
|
'sponsorship' => $userDetails['sponsorship'],
|
|
'company' => $userDetails['company'],
|
|
'news_subscription' => (int)$userDetails['news_subscription']
|
|
);
|
|
|
|
return array_filter($subscriber);
|
|
}
|
|
|
|
public function formatSubscriptionData(array $userDetails) {
|
|
$subscription = array(
|
|
'transactionDateTime' => $userDetails['start_date'],
|
|
'expirationDate' => $userDetails['end_date']
|
|
);
|
|
return array_filter($subscription);
|
|
}
|
|
}
|