Expand code for Spectre login.

This commit is contained in:
James Cole
2018-01-02 15:17:31 +01:00
parent d49aecdf49
commit 3f786856f3
12 changed files with 667 additions and 14 deletions

View File

@@ -0,0 +1,108 @@
<?php
/**
* Login.php
* Copyright (c) 2018 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Object;
use Carbon\Carbon;
/**
* Class Login
*/
class Login extends SpectreObject
{
/** @var Carbon */
private $consentGivenAt;
/** @var array */
private $consentTypes;
/** @var string */
private $countryCode;
/** @var Carbon */
private $createdAt;
/** @var int */
private $customerId;
/** @var bool */
private $dailyRefresh;
/** @var Holder */
private $holderInfo;
/** @var int */
private $id;
/** @var Attempt */
private $lastAttempt;
/** @var Carbon */
private $lastSuccessAt;
/** @var Carbon */
private $nextRefreshPossibleAt;
/** @var string */
private $providerCode;
/** @var int */
private $providerId;
/** @var string */
private $providerName;
/** @var bool */
private $showConsentConfirmation;
/** @var string */
private $status;
/** @var bool */
private $storeCredentials;
/** @var Carbon */
private $updatedAt;
/**
* Login constructor.
*
* @param array $data
*/
public function __construct(array $data)
{
$this->consentGivenAt = new Carbon($data['consent_given_at']);
$this->consentTypes = $data['consent_types'];
$this->countryCode = $data['country_code'];
$this->createdAt = new Carbon($data['created_at']);
$this->updatedAt = new Carbon($data['updated_at']);
$this->customerId = $data['customer_id'];
$this->dailyRefresh = $data['daily_refresh'];
$this->holderInfo = new Holder($data['holder_info']);
$this->id = $data['id'];
$this->lastAttempt = new Attempt($data['last_attempt']);
$this->lastSuccessAt = new Carbon($data['last_success_at']);
$this->nextRefreshPossibleAt = new Carbon($data['next_refresh_possible_at']);
$this->providerCode = $data['provider_code'];
$this->providerId = $data['provider_id'];
$this->providerName = $data['provider_name'];
$this->showConsentConfirmation = $data['show_consent_confirmation'];
$this->status = $data['status'];
$this->storeCredentials = $data['store_credentials'];
}
/**
* @return Attempt
*/
public function getLastAttempt(): Attempt
{
return $this->lastAttempt;
}
}