52 lines
1.7 KiB
PHP
52 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Libraries\MyStorage;
|
|
|
|
use App\Libraries\CommonLibrary;
|
|
use App\Entities\Cloudflare\AccountEntity;
|
|
use App\Models\Cloudflare\AccountModel;
|
|
use App\Traits\ImageTrait;
|
|
|
|
class AccountStorage extends CommonLibrary
|
|
{
|
|
private $_accountModel = null;
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
final protected function getAccountModel(): AccountModel
|
|
{
|
|
if ($this->_accountModel === null) {
|
|
$this->_accountModel = new AccountModel();
|
|
}
|
|
return $this->_accountModel;
|
|
}
|
|
|
|
final public function create_process($result, array $formDatas): AccountEntity
|
|
{
|
|
//Result 형태
|
|
// [
|
|
// {"id":"078e88a7735965b661715af13031ecb0",
|
|
// "name":"Cloudwin002@idcjp.jp's Account",
|
|
// "type":"standard",
|
|
// "settings":{
|
|
// "enforce_twofactor":false,
|
|
// "api_access_enabled":null,
|
|
// "access_approval_expiry":null,
|
|
// "use_account_custom_ns_by_default":false
|
|
// },
|
|
// "legacy_flags":{"enterprise_zone_quota":{"maximum":0,"current":0,"available":0}},
|
|
// "created_on":"2017-06-26T05:44:49.470184Z"}
|
|
// ]
|
|
$formDatas[$this->getAccountModel()->PK()] = $result->id;
|
|
$formDatas[$this->getAccountModel()->getTitleField()] = $result->name;
|
|
$formDatas['type'] = $result->type;
|
|
$formDatas['status'] = 'use';
|
|
$formDatas['updated_at'] = $result->created_on;
|
|
$formDatas['created_at'] = $result->created_on;
|
|
$entity = $this->getAccountModel()->create($formDatas);
|
|
log_message("notice", __FUNCTION__ . "=> {$entity->getTitle()} 생성을 완료하였습니다.");
|
|
return $entity;
|
|
}
|
|
}
|