1 | <?php |
||
22 | class ShopifyDatabaseComponent extends Component |
||
|
|||
23 | { |
||
24 | |||
25 | private $shops; |
||
26 | private $access_tokens; |
||
27 | |||
28 | public $controller = null; |
||
29 | |||
30 | /** |
||
31 | * @param array $config |
||
32 | * @return void |
||
33 | */ |
||
34 | 18 | public function initialize(array $config = []) |
|
39 | |||
40 | /** |
||
41 | * @param Event $event |
||
42 | * @return void |
||
43 | */ |
||
44 | 18 | public function startup(Event $event) |
|
48 | |||
49 | /** |
||
50 | * @param controller $controller |
||
51 | * @return void |
||
52 | */ |
||
53 | 18 | public function setController($controller) |
|
57 | |||
58 | /** |
||
59 | * @param array $data |
||
60 | * @return array|false |
||
61 | */ |
||
62 | public function shopDataToDatabase(array $data) |
||
79 | |||
80 | /** |
||
81 | * @param string $accessToken |
||
82 | * @param int $shopId |
||
83 | * @param string $apiKey |
||
84 | * @return array|false |
||
85 | */ |
||
86 | public function accessTokenToDatabase($accessToken, $shopId, $apiKey) |
||
117 | |||
118 | /** |
||
119 | * @param string $domain |
||
120 | * @return int|false |
||
121 | */ |
||
122 | 6 | public function getShopIdFromDomain($domain) |
|
123 | { |
||
124 | 6 | if (empty($domain) || $domain === true) { |
|
125 | 6 | return false; |
|
126 | } |
||
127 | |||
128 | 6 | $query = $this->shops->find('shopDomain', ['domain' => $domain]); |
|
129 | |||
130 | 6 | $shopEntity = $query->first(); |
|
131 | |||
132 | /*if ($shopEntity->isEmpty()) { |
||
133 | return false; |
||
134 | }*/ |
||
135 | |||
136 | 6 | if ($shopEntity->id) { |
|
137 | return (int)$shopEntity->id; |
||
138 | } else { |
||
139 | 6 | return false; |
|
140 | } |
||
141 | } |
||
142 | |||
143 | /** |
||
144 | * @param string $accessToken |
||
145 | * @param string $apiKey |
||
146 | * @return array|false |
||
147 | */ |
||
148 | 6 | public function getShopDataFromAccessToken($accessToken, $apiKey) |
|
177 | |||
178 | /** |
||
179 | * @param string $shopDomain |
||
180 | * @param string $apiKey |
||
181 | * @return string|bool |
||
182 | */ |
||
183 | 6 | public function getAccessTokenFromShopDomain($shopDomain, $apiKey) |
|
210 | } |
||
211 |
This check marks property names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.