Skip to content

Commit be0f890

Browse files
authored
Merge pull request #1 from bear8421/v2.x
V2.x
2 parents 442a35b + 55c9d2a commit be0f890

7 files changed

Lines changed: 13 additions & 34 deletions

File tree

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
strategy:
77
matrix:
88
operating-system: [ ubuntu-latest, windows-latest, macos-latest ]
9-
php-versions: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
9+
php-versions: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
1010
runs-on: ${{ matrix.operating-system }}
1111
steps:
1212
- name: Checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ GitHub.sublime-settings
120120
## Composer
121121
/vendor/
122122
/tests/*
123+
composer.lock
123124

124125
cache/*
125126
!cache/.htaccess

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=5.4",
21+
"php": ">=7.0",
2222
"ext-curl": "*",
2323
"ext-json": "*"
2424
},

composer.lock

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/PUSH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ $.ajax({
141141
});
142142
```
143143

144-
### Nguồn: https://viblo.asia/p/huong-dan-tao-api-ghi-du-lieu-len-google-sheet-1Je5EPRYlnL
144+
Nguồn: https://viblo.asia/p/huong-dan-tao-api-ghi-du-lieu-len-google-sheet-1Je5EPRYlnL

src/GoogleSpreadsheets.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class GoogleSpreadsheets
4444
* @copyright: 713uk13m <dev@nguyenanhung.com>
4545
* @time : 09/06/2021 49:14
4646
*/
47-
public function setBackgroundRequest($backgroundRequest = true)
47+
public function setBackgroundRequest(bool $backgroundRequest = true): GoogleSpreadsheets
4848
{
4949
$this->backgroundRequest = $backgroundRequest;
5050

@@ -61,7 +61,7 @@ public function setBackgroundRequest($backgroundRequest = true)
6161
* @copyright: 713uk13m <dev@nguyenanhung.com>
6262
* @time : 09/04/2021 25:02
6363
*/
64-
public function setScriptId($scriptId = '')
64+
public function setScriptId(string $scriptId = ''): GoogleSpreadsheets
6565
{
6666
$this->scriptId = $scriptId;
6767

@@ -78,7 +78,7 @@ public function setScriptId($scriptId = '')
7878
* @copyright: 713uk13m <dev@nguyenanhung.com>
7979
* @time : 09/04/2021 32:26
8080
*/
81-
public function setContentData($contentData = [])
81+
public function setContentData(array $contentData = array()): GoogleSpreadsheets
8282
{
8383
$this->contentData = $contentData;
8484

@@ -106,7 +106,7 @@ public function getResponse()
106106
* @copyright: 713uk13m <dev@nguyenanhung.com>
107107
* @time : 09/04/2021 38:44
108108
*/
109-
public function push()
109+
public function push(): GoogleSpreadsheets
110110
{
111111
if (empty($this->scriptId) || empty($this->contentData)) {
112112
$this->response = null;

src/Helper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Helper
4848
* @copyright: 713uk13m <dev@nguyenanhung.com>
4949
* @time : 09/04/2021 30:36
5050
*/
51-
public static function sendToSpreadsheets($url = '', $params = [])
51+
public static function sendToSpreadsheets(string $url = '', array $params = array()): array
5252
{
5353
if (empty($url)) {
5454
return [
@@ -90,7 +90,7 @@ public static function sendToSpreadsheets($url = '', $params = [])
9090
'code' => self::EXIT_SUCCESS,
9191
'status' => 'success',
9292
'message' => 'Success',
93-
'rowId' => isset($res->row) ? $res->row : null
93+
'rowId' => $res->row ?? null
9494
];
9595
}
9696

@@ -112,13 +112,13 @@ public static function sendToSpreadsheets($url = '', $params = [])
112112
* @copyright: 713uk13m <dev@nguyenanhung.com>
113113
* @time : 10/16/18 17:15
114114
*/
115-
public static function backgroundHttpGet($url)
115+
public static function backgroundHttpGet(string $url): array
116116
{
117117
$parts = parse_url($url);
118118
if (strtolower($parts['scheme']) === 'https') {
119-
$fp = fsockopen('ssl://' . $parts['host'], isset($parts['port']) ? $parts['port'] : self::PORT_SSL, $errno, $errStr, self::REQUEST_TIMEOUT);
119+
$fp = fsockopen('ssl://' . $parts['host'], $parts['port'] ?? self::PORT_SSL, $errno, $errStr, self::REQUEST_TIMEOUT);
120120
} else {
121-
$fp = fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : self::PORT_HTTP, $errno, $errStr, self::REQUEST_TIMEOUT);
121+
$fp = fsockopen($parts['host'], $parts['port'] ?? self::PORT_HTTP, $errno, $errStr, self::REQUEST_TIMEOUT);
122122
}
123123
if (!$fp) {
124124
if (function_exists('log_message')) {

0 commit comments

Comments
 (0)