Skip to content

Commit 53a7a0a

Browse files
authored
Merge pull request #4 from pkg6/docs
Docs
2 parents 09294a9 + 93c5cfa commit 53a7a0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+877
-355
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
*.DS_Store
22
.scannerwork
33
/vendor
4-
/*.php
54
/.idea
65
/*.log
76
/*.pid
@@ -10,3 +9,4 @@
109
/composer.lock
1110
.php_cs.cache
1211
.phpunit.result.cache
12+
.php-cs-fixer.cache

.php-cs-fixer.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
$header = <<<EOF
4+
This file is part of the pkg6/cloud-print.
5+
6+
(c) pkg6 <https://github.com/pkg6>
7+
8+
This source file is subject to the MIT license that is bundled.
9+
EOF;
10+
11+
$finder = PhpCsFixer\Finder::create()
12+
->in([__DIR__ . '/src',__DIR__ . '/tests']);
13+
14+
return (new PhpCsFixer\Config())
15+
->setRules([
16+
'@PSR2' => true,
17+
'header_comment' => array('header' => $header),
18+
'array_syntax' => ['syntax' => 'short'],
19+
'binary_operator_spaces' => true,
20+
'single_line_after_imports' => true,
21+
'blank_line_before_statement' => ['statements' => ['return']],
22+
'cast_spaces' => true,
23+
'concat_space' => ['spacing' => 'one'],
24+
'no_singleline_whitespace_before_semicolons' => true,
25+
'not_operator_with_space' => true,
26+
'no_unused_imports' => true,
27+
'phpdoc_align' => false,
28+
'phpdoc_indent' => true,
29+
'phpdoc_no_access' => true,
30+
'phpdoc_no_alias_tag' => true,
31+
'phpdoc_no_package' => true,
32+
'phpdoc_scalar' => true,
33+
'phpdoc_separation' => true,
34+
'phpdoc_summary' => true,
35+
'phpdoc_to_comment' => true,
36+
'phpdoc_trim' => true,
37+
'single_blank_line_at_eof' => true,
38+
'ternary_operator_spaces' => true,
39+
'ordered_imports' => [
40+
'sort_algorithm' => 'alpha',
41+
'imports_order' => ['const', 'class', 'function'],
42+
],
43+
'no_extra_blank_lines' => true,
44+
'no_whitespace_in_blank_line' => true,
45+
])
46+
->setFinder($finder);

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 open-package
3+
Copyright (c) 2023 pkg6
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

+13-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
},
3737
"require-dev": {
3838
"phpunit/phpunit": "^6|^7|^8|^9",
39-
"mockery/mockery": "^1.2.3"
39+
"mockery/mockery": "^1.2.3",
40+
"friendsofphp/php-cs-fixer": "^3.9"
4041
},
4142
"autoload": {
4243
"psr-4": {
@@ -47,5 +48,16 @@
4748
"psr-4": {
4849
"Pkg6\\cloudPrint\\Tests\\": "tests/"
4950
}
51+
},
52+
"scripts": {
53+
"fresh": [
54+
"rm -rf vendor composer.lock",
55+
"composer install"
56+
],
57+
"tests": [
58+
"php ./vendor/bin/phpunit"
59+
],
60+
"fixer": "vendor/bin/php-cs-fixer fix",
61+
"try-fixer": "vendor/bin/php-cs-fixer fix --diff --dry-run"
5062
}
5163
}
File renamed without changes.

docs/Home.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## 支持厂商
2+
3+
- [飞鹅云](http://help.feieyun.com/document.php)
4+
- [芯烨云](https://www.xpyun.net/open/index.html)
5+
- [易联云](https://www.yilianyun.net/)
6+
- [快递100](https://api.kuaidi100.com/document/5f0ff6a32977d50a94e10235)
7+
- [映美云](http://open.jolimark.com/)
8+
- [佳博云](https://dev.poscom.cn/)
9+
- [365智能云打印](http://printcenter.cn/)
10+
- [中午云](http://www.zhongwu.co/)
11+
- [优声云](https://www.ushengyun.com/)
12+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/Factory.php

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the pkg6/cloud-print.
5+
*
6+
* (c) pkg6 <https://github.com/pkg6>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
311
namespace Pkg6\cloudPrint;
412

513
use InvalidArgumentException;
@@ -32,12 +40,12 @@ class Factory
3240
*/
3341
protected static function make($name, array $config)
3442
{
35-
$app = __NAMESPACE__.'\\'.$name.'\\AppContainer';
36-
if (!class_exists($app)) {
37-
throw new InvalidArgumentException('class not exists:'.$app);
43+
$app = __NAMESPACE__ . '\\' . $name . '\\AppContainer';
44+
if ( ! class_exists($app)) {
45+
throw new InvalidArgumentException('class not exists:' . $app);
3846
}
39-
$instance = crc32($name.serialize($config));
40-
if (!isset(self::$instances[$instance])) {
47+
$instance = crc32($name . serialize($config));
48+
if ( ! isset(self::$instances[$instance])) {
4149
self::$instances[$instance] = new $app($config);
4250
}
4351

@@ -52,7 +60,7 @@ protected static function make($name, array $config)
5260
*/
5361
public static function __callStatic($name, $arguments)
5462
{
55-
// $config = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
63+
// $config = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
5664
return self::make($name, ...$arguments);
5765
}
5866
}

src/Feieyun/AppContainer.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
<?php
22

3+
/*
4+
* This file is part of the pkg6/cloud-print.
5+
*
6+
* (c) pkg6 <https://github.com/pkg6>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
311
namespace Pkg6\cloudPrint\Feieyun;
412

513
use Pkg6\cloudPrint\Kernel\ServiceContainer;
614

7-
815
class AppContainer extends ServiceContainer
916
{
1017
/**

src/Feieyun/FeieyunClient.php

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the pkg6/cloud-print.
5+
*
6+
* (c) pkg6 <https://github.com/pkg6>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
311
namespace Pkg6\cloudPrint\Feieyun;
412

513
use Exception;
@@ -22,32 +30,33 @@ class FeieyunClient extends BaseClient
2230
* @param array $private_params
2331
*
2432
* @return string
25-
* @throws Exception
2633
*
34+
* @throws Exception
2735
* @throws GuzzleException
2836
*/
2937
public function request($action, array $private_params = [])
3038
{
31-
$timestamp = Timer::timeStamp();
39+
$timestamp = Timer::timeStamp();
3240
$public_params = [
33-
'user' => $this->config['user'],
34-
'stime' => $timestamp,
35-
'sig' => $this->getSig($timestamp),
41+
'user' => $this->config['user'],
42+
'stime' => $timestamp,
43+
'sig' => $this->getSig($timestamp),
3644
'apiname' => $action,
3745
];
38-
$url = $this->config['host'] ?? $this->host;
39-
$params = array_filter(array_merge($public_params, $private_params));
40-
$resp = $this->httpPost($url, $params);
46+
$url = $this->config['host'] ?? $this->host;
47+
$params = array_filter(array_merge($public_params, $private_params));
48+
$resp = $this->httpPost($url, $params);
4149
$this->requestLog('POST:' . $url, $params, $resp);
50+
4251
return $resp;
4352
}
4453

4554
/**
4655
* @param $timestamp
4756
*
4857
* @return string
49-
* @throws Exception
5058
*
59+
* @throws Exception
5160
*/
5261
protected function getSig($timestamp)
5362
{

src/Feieyun/Printer.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the pkg6/cloud-print.
5+
*
6+
* (c) pkg6 <https://github.com/pkg6>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
311
namespace Pkg6\cloudPrint\Feieyun;
412

513
use GuzzleHttp\Exception\GuzzleException;

src/Feieyun/ServiceProvider.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the pkg6/cloud-print.
5+
*
6+
* (c) pkg6 <https://github.com/pkg6>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
311
namespace Pkg6\cloudPrint\Feieyun;
412

513
use Pimple\Container;

src/Jolimark/AppContainer.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the pkg6/cloud-print.
5+
*
6+
* (c) pkg6 <https://github.com/pkg6>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
311
namespace Pkg6\cloudPrint\Jolimark;
412

513
use Pkg6\cloudPrint\Kernel\ServiceContainer;

src/Jolimark/JolimarkClient.php

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the pkg6/cloud-print.
5+
*
6+
* (c) pkg6 <https://github.com/pkg6>
7+
*
8+
* This source file is subject to the MIT license that is bundled.
9+
*/
10+
311
namespace Pkg6\cloudPrint\Jolimark;
412

513
use Exception;
@@ -27,13 +35,13 @@ class JolimarkClient extends BaseClient
2735
* @param $private_params
2836
*
2937
* @return string
30-
* @throws Exception
3138
*
39+
* @throws Exception
3240
* @throws GuzzleException
3341
*/
3442
public function request($method, $action, $private_params)
3543
{
36-
$url = $this->config['host'] ?? $this->host . $action;
44+
$url = $this->config['host'] ?? $this->host . $action;
3745
$public_params = [
3846
'app_id' => $this->config['app_id'],
3947
];
@@ -46,13 +54,14 @@ public function request($method, $action, $private_params)
4654
'form_params' => $params,
4755
]);
4856
$this->requestLog($method . ':' . $url, $params, $resp);
57+
4958
return $resp;
5059
}
5160

5261
/**
5362
* @return string
54-
* @throws Exception
5563
*
64+
* @throws Exception
5665
* @throws GuzzleException
5766
*/
5867
protected function accessToken()
@@ -62,14 +71,14 @@ protected function accessToken()
6271
if ($this->app->cache->hasCache($key)) {
6372
return $this->app->cache->getCache($key);
6473
}
65-
$time = Timer::timeStamp();
74+
$time = Timer::timeStamp();
6675
$params = [
6776
'time_stamp' => $time,
68-
'sign' => $this->sign($time),
69-
'sign_type' => 'MD5',
77+
'sign' => $this->sign($time),
78+
'sign_type' => 'MD5',
7079
];
71-
$resp = $this->request('GET', 'mcp/v2/sys/GetAccessToken', $params);
72-
$data = json_decode($resp, true);
80+
$resp = $this->request('GET', 'mcp/v2/sys/GetAccessToken', $params);
81+
$data = json_decode($resp, true);
7382
if (empty($data['return_data']['access_token'])) {
7483
return $resp;
7584
}
@@ -86,10 +95,10 @@ protected function accessToken()
8695
protected function sign($timestamp)
8796
{
8897
$str = http_build_query([
89-
'app_id' => $this->config['app_id'],
90-
'sign_type' => $this->signType,
98+
'app_id' => $this->config['app_id'],
99+
'sign_type' => $this->signType,
91100
'time_stamp' => $timestamp,
92-
'key' => $this->config['app_key'],
101+
'key' => $this->config['app_key'],
93102
]);
94103

95104
return strtoupper(md5($str));

0 commit comments

Comments
 (0)