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 = []) |
|
35 | { |
||
36 | 18 | $this->shops = TableRegistry::get('Multidimensional/Cakephpify.Shops'); |
|
37 | 18 | $this->access_tokens = TableRegistry::get('Multidimensional/Cakephpify.AccessTokens'); |
|
38 | 18 | } |
|
39 | |||
40 | /** |
||
41 | * @param Event $event |
||
42 | * @return void |
||
43 | */ |
||
44 | 18 | public function startup(Event $event) |
|
45 | { |
||
46 | 18 | $this->setController($event->subject()); |
|
47 | 18 | } |
|
48 | |||
49 | /** |
||
50 | * @param controller $controller |
||
51 | * @return void |
||
52 | */ |
||
53 | 18 | public function setController($controller) |
|
54 | { |
||
55 | 18 | $this->controller = $controller; |
|
56 | 18 | if (!isset($this->controller->paginate)) { |
|
57 | $this->controller->paginate = []; |
||
58 | } |
||
59 | 18 | } |
|
60 | |||
61 | /** |
||
62 | * @param array $data |
||
63 | * @return array|bool |
||
64 | */ |
||
65 | public function shopDataToDatabase(array $data) |
||
82 | |||
83 | /** |
||
84 | * @param string $accessToken |
||
85 | * @param int $shopId |
||
86 | * @param string $apiKey |
||
87 | * @return array|bool |
||
88 | */ |
||
89 | public function accessTokenToDatabase($accessToken, $shopId, $apiKey) |
||
120 | |||
121 | /** |
||
122 | * @param string $domain |
||
123 | * @return int|false |
||
124 | */ |
||
125 | 6 | public function getShopIdFromDomain($domain) |
|
145 | |||
146 | /** |
||
147 | * @param string $accessToken |
||
148 | * @param string $apiKey |
||
149 | * @return array|false |
||
150 | */ |
||
151 | 6 | public function getShopDataFromAccessToken($accessToken, $apiKey) |
|
180 | |||
181 | /** |
||
182 | * @param string $shopDomain |
||
183 | * @param string $apiKey |
||
184 | * @return string|bool |
||
185 | */ |
||
186 | 6 | public function getAccessTokenFromShopDomain($shopDomain, $apiKey) |
|
213 | } |
||
214 |
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
.