Complex classes like BucketManager often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use BucketManager, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 15 | final class BucketManager |
||
| 16 | { |
||
| 17 | private $auth; |
||
| 18 | private $config; |
||
| 19 | |||
| 20 | 42 | public function __construct(Auth $auth, Config $config = null) |
|
| 29 | |||
| 30 | /** |
||
| 31 | * 获取指定账号下所有的空间名。 |
||
| 32 | * |
||
| 33 | * @return string[] 包含所有空间名 |
||
| 34 | */ |
||
| 35 | 3 | public function buckets($shared = true) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * 列举空间,返回bucket列表 |
||
| 46 | * region 指定区域,global 指定全局空间。 |
||
| 47 | * 在指定了 region 参数时, |
||
| 48 | * 如果指定 global 为 true,那么忽略 region 参数指定的区域,返回所有区域的全局空间。 |
||
| 49 | * 如果没有指定 global 为 true,那么返回指定区域中非全局空间。 |
||
| 50 | * 在没有指定 region 参数时(包括指定为空""), |
||
| 51 | * 如果指定 global 为 true,那么返回所有区域的全局空间。 |
||
| 52 | * 如果没有指定 global 为 true,那么返回指定区域中所有的空间,包括全局空间。 |
||
| 53 | * 在指定了line为 true 时,只返回 Line 空间;否则,只返回非 Line 空间。 |
||
| 54 | * share 参数用于指定共享空间。 |
||
| 55 | */ |
||
| 56 | |||
| 57 | public function listbuckets( |
||
| 67 | |||
| 68 | /** |
||
| 69 | * 创建空间 |
||
| 70 | * |
||
| 71 | * @param $name 创建的空间名 |
||
| 72 | * @param $region 创建的区域,默认华东 |
||
| 73 | * |
||
| 74 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 75 | */ |
||
| 76 | public function creatBucket($name, $region = 'z0') |
||
| 81 | |||
| 82 | /** |
||
| 83 | * 删除空间 |
||
| 84 | * |
||
| 85 | * @param $name 删除的空间名 |
||
| 86 | * |
||
| 87 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 88 | */ |
||
| 89 | public function deleteBucket($name) |
||
| 94 | |||
| 95 | /** |
||
| 96 | * 获取指定空间绑定的所有的域名 |
||
| 97 | * |
||
| 98 | * @return string[] 包含所有空间域名 |
||
| 99 | */ |
||
| 100 | public function domains($bucket) |
||
| 104 | |||
| 105 | /** |
||
| 106 | * 获取指定空间的相关信息 |
||
| 107 | * |
||
| 108 | * @return string[] 包含空间信息 |
||
| 109 | */ |
||
| 110 | public function bucketInfo($bucket) |
||
| 116 | |||
| 117 | /** |
||
| 118 | * 获取指定zone的空间信息列表 |
||
| 119 | * 在Region 未指定且Global 不为 true 时(包含未指定的情况,下同),返回用户的所有空间。 |
||
| 120 | * 在指定了 region 参数且 global 不为 true 时,只列举非全局空间。 |
||
| 121 | * 在指定了global为 true 时,返回所有全局空间,忽略region 参数 |
||
| 122 | * shared 不指定shared参数或指定shared为rw或false时,返回包含具有读写权限空间, |
||
| 123 | * 指定shared为rd或true时,返回包含具有读权限空间。 |
||
| 124 | * fs:如果为 true,会返回每个空间当前的文件数和存储量(实时数据)。 |
||
| 125 | * @return string[] 包含空间信息 |
||
| 126 | */ |
||
| 127 | public function bucketInfos($region = null, $global = 'false', $shared = 'false', $fs = 'false') |
||
| 133 | |||
| 134 | /** |
||
| 135 | * 获取空间绑定的域名列表 |
||
| 136 | * @return string[] 包含空间绑定的所有域名 |
||
| 137 | */ |
||
| 138 | |||
| 139 | /** |
||
| 140 | * 列取空间的文件列表 |
||
| 141 | * |
||
| 142 | * @param $bucket 空间名 |
||
| 143 | * @param $prefix 列举前缀 |
||
| 144 | * @param $marker 列举标识符 |
||
| 145 | * @param $limit 单次列举个数限制 |
||
| 146 | * @param $delimiter 指定目录分隔符 |
||
| 147 | * |
||
| 148 | * @return array 包含文件信息的数组,类似:[ |
||
| 149 | * { |
||
| 150 | * "hash" => "<Hash string>", |
||
| 151 | * "key" => "<Key string>", |
||
| 152 | * "fsize" => "<file size>", |
||
| 153 | * "putTime" => "<file modify time>" |
||
| 154 | * }, |
||
| 155 | * ... |
||
| 156 | * ] |
||
| 157 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/list.html |
||
| 158 | */ |
||
| 159 | 3 | public function listFiles( |
|
| 174 | |||
| 175 | /** |
||
| 176 | * 设置Referer防盗链 |
||
| 177 | * |
||
| 178 | * @param $bucket 空间名 |
||
| 179 | * @param $mode 0: 表示关闭Referer(使用此选项将会忽略以下参数并将恢复默认值); |
||
| 180 | * 1: 表示设置Referer白名单; 2:表示设置Referer黑名单 |
||
| 181 | * @param $norefer 0: 表示不允许空 Refer 访问; 1: 表示允许空 Refer 访问 |
||
| 182 | * @param $pattern 规则字符串, 当前允许格式分为三种: 一种为空主机头域名, |
||
| 183 | * 比如 foo.com; 一种是泛域名,比如 *.bar.com; 一种是完全通配符, |
||
| 184 | * 即一个 *; 多个规则之间用;隔开, 比如: foo.com;*.bar.com;sub.foo.com;*.sub.bar.com |
||
| 185 | * @param $source_enabled 源站是否支持,默认为0只给CDN配置, 设置为1表示开启源站防盗链 |
||
| 186 | * |
||
| 187 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 188 | */ |
||
| 189 | // public function referAntiLeech(){ |
||
| 190 | |||
| 191 | // } |
||
| 192 | |||
| 193 | /** |
||
| 194 | * 增加bucket生命规则 |
||
| 195 | * |
||
| 196 | * @param $bucket 空间名 |
||
| 197 | * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为 |
||
| 198 | * 字母、数字、下划线 |
||
| 199 | * @param $prefix 同一个 bucket 里面前缀不能重复 |
||
| 200 | * @param $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, |
||
| 201 | * 大于0表示多少天后删除,需大于 to_line_after_days |
||
| 202 | * @param $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示 |
||
| 203 | * 不转低频存储,小于0表示上传的文件立即变低频存储 |
||
| 204 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 205 | */ |
||
| 206 | public function bucketLifecycleRule( |
||
| 233 | |||
| 234 | /** |
||
| 235 | * 更新bucket生命规则 |
||
| 236 | * |
||
| 237 | * @param $bucket 空间名 |
||
| 238 | * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、 |
||
| 239 | * 数字、下划线 |
||
| 240 | * @param $prefix 同一个 bucket 里面前缀不能重复 |
||
| 241 | * @param $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, |
||
| 242 | * 大于0表示多少天后删除,需大于 to_line_after_days |
||
| 243 | * @param $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示不 |
||
| 244 | * 转低频存储,小于0表示上传的文件立即变低频存储 |
||
| 245 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 246 | */ |
||
| 247 | public function updateBucketLifecycleRule( |
||
| 274 | |||
| 275 | /** |
||
| 276 | * 获取bucket生命规则 |
||
| 277 | * |
||
| 278 | * @param $bucket 空间名 |
||
| 279 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 280 | */ |
||
| 281 | public function getBucketLifecycleRules($bucket) |
||
| 287 | |||
| 288 | /** |
||
| 289 | * 删除bucket生命规则 |
||
| 290 | * |
||
| 291 | * @param $bucket 空间名 |
||
| 292 | * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, |
||
| 293 | * 只能为字母、数字、下划线() |
||
| 294 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 295 | */ |
||
| 296 | public function deleteBucketLifecycleRule($bucket, $name) |
||
| 309 | |||
| 310 | /** |
||
| 311 | * 增加bucket事件通知规则 |
||
| 312 | * |
||
| 313 | * @param $bucket 空间名 |
||
| 314 | * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, |
||
| 315 | * 只能为字母、数字、下划线() |
||
| 316 | * @param $prefix 同一个 bucket 里面前缀不能重复 |
||
| 317 | * @param $suffix 可选,文件配置的后缀 |
||
| 318 | * @param $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append, |
||
| 319 | * disable,enable,deleteMarkerCreate |
||
| 320 | * @param $callbackURL 通知URL,可以指定多个,失败依次重试 |
||
| 321 | * @param $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 |
||
| 322 | * @param $host 可选,通知请求的host |
||
| 323 | * |
||
| 324 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 325 | */ |
||
| 326 | public function putBucketEvent( |
||
| 365 | |||
| 366 | /** |
||
| 367 | * 更新bucket事件通知规则 |
||
| 368 | * |
||
| 369 | * @param $bucket 空间名 |
||
| 370 | * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, |
||
| 371 | * 只能为字母、数字、下划线() |
||
| 372 | * @param $prefix 同一个 bucket 里面前缀不能重复 |
||
| 373 | * @param $suffix 可选,文件配置的后缀 |
||
| 374 | * @param $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append,disable, |
||
| 375 | * enable,deleteMarkerCreate |
||
| 376 | * @param $callbackURL 通知URL,可以指定多个,失败依次重试 |
||
| 377 | * @param $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 |
||
| 378 | * @param $host 可选,通知请求的host |
||
| 379 | * |
||
| 380 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 381 | */ |
||
| 382 | public function updateBucketEvent( |
||
| 421 | |||
| 422 | /** |
||
| 423 | * 获取bucket事件通知规则 |
||
| 424 | * |
||
| 425 | * @param $bucket 空间名 |
||
| 426 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 427 | */ |
||
| 428 | public function getBucketEvents($bucket) |
||
| 434 | |||
| 435 | /** |
||
| 436 | * 删除bucket事件通知规则 |
||
| 437 | * |
||
| 438 | * @param $bucket 空间名 |
||
| 439 | * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, |
||
| 440 | * 只能为字母、数字、下划线 |
||
| 441 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 442 | */ |
||
| 443 | public function deleteBucketEvent($bucket, $name) |
||
| 456 | |||
| 457 | /** |
||
| 458 | * 设置bucket的跨域信息,最多允许设置10条跨域规则。 |
||
| 459 | * 对于同一个域名如果设置了多条规则,那么按顺序使用第一条匹配的规则去生成返回值。 |
||
| 460 | * 对于简单跨域请求,只匹配 Origin; |
||
| 461 | * 对于预检请求, 需要匹配 Origin、AllowedMethod、AllowedHeader; |
||
| 462 | * allowed_orgin: 允许的域名。必填;支持通配符*;*表示全部匹配;只有第一个*生效; |
||
| 463 | * 需要设置"Scheme";大小写敏感。例如 |
||
| 464 | * 规则:http://*.abc.*.com 请求:"http://test.abc.test.com" 结果:不通过 |
||
| 465 | * 规则:"http://abc.com" 请求:"https://abc.com"/"abc.com" 结果:不通过 |
||
| 466 | * 规则:"abc.com" 请求:"http://abc.com" 结果:不通过 |
||
| 467 | * allowed_method: 允许的方法。必填;不支持通配符;大小写不敏感; |
||
| 468 | * allowed_header: 允许的header。选填;支持通配符*, |
||
| 469 | * 但只能是单独的*,表示允许全部header,其他*不生效; |
||
| 470 | * 空则不允许任何header;大小写不敏感; |
||
| 471 | * exposed_header: 暴露的header。选填;不支持通配符; |
||
| 472 | * X-Log, X-Reqid是默认会暴露的两个header; |
||
| 473 | * 其他的header如果没有设置,则不会暴露;大小写不敏感; |
||
| 474 | * max_age: 结果可以缓存的时间。选填;空则不缓存; |
||
| 475 | * allowed_credentials:该配置不支持设置,默认为true。 |
||
| 476 | * 备注:如果没有设置任何corsRules,那么默认允许所有的跨域请求 |
||
| 477 | */ |
||
| 478 | public function putCorsRules($bucket, $params) |
||
| 485 | |||
| 486 | /** |
||
| 487 | * 获取bucket的跨域信息 |
||
| 488 | * $bucket 空间名 |
||
| 489 | */ |
||
| 490 | public function getCorsRules($bucket) |
||
| 496 | |||
| 497 | /** |
||
| 498 | * 设置回源规则 |
||
| 499 | * 使用该API设置源站优先级高于/image设置的源站,即IO优先读取source接口设置的源站配置, |
||
| 500 | * 如果存在会忽略/image设置的源站 |
||
| 501 | * Bucket 空间名 |
||
| 502 | * Host(可选)回源Host |
||
| 503 | * RetryCodes(可选),镜像回源时源站返回Code可以重试,最多指定3个,当前只支持4xx错误码重试 |
||
| 504 | * SourceQiniuAK,SourceQiniuSK(可选)如果存在将在回源时对URL进行签名,客户源站可以验证 |
||
| 505 | * 以保证请求来自Qiniu服务器 |
||
| 506 | * Expires(可选) 签名过期时间,如果不设置默认为1小时 |
||
| 507 | * Addr 回源地址,不可重复。 |
||
| 508 | * Weight 权重,范围限制1-100,不填默认为1,回源时会根据所有源的权重值进行源站选择, |
||
| 509 | * 主备源会分开计算. |
||
| 510 | * Backup 是否备用回源,回源优先尝试主源 |
||
| 511 | */ |
||
| 512 | public function putBucktSourceConfig($params) |
||
| 519 | |||
| 520 | /** |
||
| 521 | * 获取空间回源配置 |
||
| 522 | */ |
||
| 523 | public function getBucktSourceConfig($params) |
||
| 530 | |||
| 531 | /** |
||
| 532 | * 开关原图保护 |
||
| 533 | * mode 为1表示开启原图保护,0表示关闭 |
||
| 534 | */ |
||
| 535 | public function putBucketAccessStyleMode($bucket, $mode) |
||
| 541 | |||
| 542 | /** |
||
| 543 | * 设置Bucket的maxAge |
||
| 544 | * maxAge为0或者负数表示为默认值(31536000) |
||
| 545 | */ |
||
| 546 | public function putBucketMaxAge($bucket, $maxAge) |
||
| 552 | |||
| 553 | /** |
||
| 554 | * 设置配额 |
||
| 555 | * <bucket>: 空间名称,不支持授权空间 |
||
| 556 | * <size>: 空间存储量配额,参数传入0或不传表示不更改当前配置,传入-1表示取消限额, |
||
| 557 | * 新创建的空间默认没有限额。 |
||
| 558 | * <count>: 空间文件数配额,参数含义同<size> |
||
| 559 | */ |
||
| 560 | public function putBucketQuota($bucket, $size, $count) |
||
| 566 | |||
| 567 | /** |
||
| 568 | * 获取配额 |
||
| 569 | * bucket 空间名称 |
||
| 570 | */ |
||
| 571 | public function getBucketQuota($bucket) |
||
| 577 | |||
| 578 | /** |
||
| 579 | * 获取资源的元信息,但不返回文件内容 |
||
| 580 | * |
||
| 581 | * @param $bucket 待获取信息资源所在的空间 |
||
| 582 | * @param $key 待获取资源的文件名 |
||
| 583 | * |
||
| 584 | * @return array 包含文件信息的数组,类似: |
||
| 585 | * [ |
||
| 586 | * "hash" => "<Hash string>", |
||
| 587 | * "key" => "<Key string>", |
||
| 588 | * "fsize" => <file size>, |
||
| 589 | * "putTime" => "<file modify time>" |
||
| 590 | * "fileType" => <file type> |
||
| 591 | * ] |
||
| 592 | * |
||
| 593 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/stat.html |
||
| 594 | */ |
||
| 595 | 3 | public function stat($bucket, $key) |
|
| 600 | |||
| 601 | /** |
||
| 602 | * 删除指定资源 |
||
| 603 | * |
||
| 604 | * @param $bucket 待删除资源所在的空间 |
||
| 605 | * @param $key 待删除资源的文件名 |
||
| 606 | * |
||
| 607 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 608 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/delete.html |
||
| 609 | */ |
||
| 610 | 6 | public function delete($bucket, $key) |
|
| 616 | |||
| 617 | |||
| 618 | /** |
||
| 619 | * 给资源进行重命名,本质为move操作。 |
||
| 620 | * |
||
| 621 | * @param $bucket 待操作资源所在空间 |
||
| 622 | * @param $oldname 待操作资源文件名 |
||
| 623 | * @param $newname 目标资源文件名 |
||
| 624 | * |
||
| 625 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 626 | */ |
||
| 627 | 3 | public function rename($bucket, $oldname, $newname) |
|
| 631 | |||
| 632 | /** |
||
| 633 | * 对资源进行复制。 |
||
| 634 | * |
||
| 635 | * @param $from_bucket 待操作资源所在空间 |
||
| 636 | * @param $from_key 待操作资源文件名 |
||
| 637 | * @param $to_bucket 目标资源空间名 |
||
| 638 | * @param $to_key 目标资源文件名 |
||
| 639 | * |
||
| 640 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 641 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/copy.html |
||
| 642 | */ |
||
| 643 | 12 | public function copy($from_bucket, $from_key, $to_bucket, $to_key, $force = false) |
|
| 654 | |||
| 655 | /** |
||
| 656 | * 将资源从一个空间到另一个空间 |
||
| 657 | * |
||
| 658 | * @param $from_bucket 待操作资源所在空间 |
||
| 659 | * @param $from_key 待操作资源文件名 |
||
| 660 | * @param $to_bucket 目标资源空间名 |
||
| 661 | * @param $to_key 目标资源文件名 |
||
| 662 | * |
||
| 663 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 664 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/move.html |
||
| 665 | */ |
||
| 666 | 3 | public function move($from_bucket, $from_key, $to_bucket, $to_key, $force = false) |
|
| 677 | |||
| 678 | /** |
||
| 679 | * 主动修改指定资源的文件元信息 |
||
| 680 | * |
||
| 681 | * @param $bucket 待操作资源所在空间 |
||
| 682 | * @param $key 待操作资源文件名 |
||
| 683 | * @param $mime 待操作文件目标mimeType |
||
| 684 | * |
||
| 685 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 686 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/chgm.html |
||
| 687 | */ |
||
| 688 | 3 | public function changeMime($bucket, $key, $mime) |
|
| 696 | |||
| 697 | |||
| 698 | /** |
||
| 699 | * 修改指定资源的存储类型 |
||
| 700 | * |
||
| 701 | * @param $bucket 待操作资源所在空间 |
||
| 702 | * @param $key 待操作资源文件名 |
||
| 703 | * @param $fileType 待操作文件目标文件类型 |
||
| 704 | * |
||
| 705 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 706 | * @link https://developer.qiniu.com/kodo/api/3710/modify-the-file-type |
||
| 707 | */ |
||
| 708 | public function changeType($bucket, $key, $fileType) |
||
| 715 | |||
| 716 | /** |
||
| 717 | * 修改文件的存储状态,即禁用状态和启用状态间的的互相转换 |
||
| 718 | * |
||
| 719 | * @param $bucket 待操作资源所在空间 |
||
| 720 | * @param $key 待操作资源文件名 |
||
| 721 | * @param $status 待操作文件目标文件类型 |
||
| 722 | * |
||
| 723 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 724 | * @link https://developer.qiniu.com/kodo/api/4173/modify-the-file-status |
||
| 725 | */ |
||
| 726 | public function changeStatus($bucket, $key, $status) |
||
| 733 | |||
| 734 | /** |
||
| 735 | * 从指定URL抓取资源,并将该资源存储到指定空间中 |
||
| 736 | * |
||
| 737 | * @param $url 指定的URL |
||
| 738 | * @param $bucket 目标资源空间 |
||
| 739 | * @param $key 目标资源文件名 |
||
| 740 | * |
||
| 741 | * @return array 包含已拉取的文件信息。 |
||
| 742 | * 成功时: [ |
||
| 743 | * [ |
||
| 744 | * "hash" => "<Hash string>", |
||
| 745 | * "key" => "<Key string>" |
||
| 746 | * ], |
||
| 747 | * null |
||
| 748 | * ] |
||
| 749 | * |
||
| 750 | * 失败时: [ |
||
| 751 | * null, |
||
| 752 | * Qiniu/Http/Error |
||
| 753 | * ] |
||
| 754 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/fetch.html |
||
| 755 | */ |
||
| 756 | 3 | public function fetch($url, $bucket, $key = null) |
|
| 769 | |||
| 770 | /** |
||
| 771 | * 从镜像源站抓取资源到空间中,如果空间中已经存在,则覆盖该资源 |
||
| 772 | * |
||
| 773 | * @param $bucket 待获取资源所在的空间 |
||
| 774 | * @param $key 代获取资源文件名 |
||
| 775 | * |
||
| 776 | * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error |
||
| 777 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/prefetch.html |
||
| 778 | */ |
||
| 779 | 3 | public function prefetch($bucket, $key) |
|
| 791 | |||
| 792 | /** |
||
| 793 | * 在单次请求中进行多个资源管理操作 |
||
| 794 | * |
||
| 795 | * @param $operations 资源管理操作数组 |
||
| 796 | * |
||
| 797 | * @return array 每个资源的处理情况,结果类似: |
||
| 798 | * [ |
||
| 799 | * { "code" => <HttpCode int>, "data" => <Data> }, |
||
| 800 | * { "code" => <HttpCode int> }, |
||
| 801 | * { "code" => <HttpCode int> }, |
||
| 802 | * { "code" => <HttpCode int> }, |
||
| 803 | * { "code" => <HttpCode int>, "data" => { "error": "<ErrorMessage string>" } }, |
||
| 804 | * ... |
||
| 805 | * ] |
||
| 806 | * @link http://developer.qiniu.com/docs/v6/api/reference/rs/batch.html |
||
| 807 | */ |
||
| 808 | 12 | public function batch($operations) |
|
| 813 | |||
| 814 | /** |
||
| 815 | * 设置文件的生命周期 |
||
| 816 | * |
||
| 817 | * @param $bucket 设置文件生命周期文件所在的空间 |
||
| 818 | * @param $key 设置文件生命周期文件的文件名 |
||
| 819 | * @param $days 设置该文件多少天后删除,当$days设置为0时表示取消该文件的生命周期 |
||
| 820 | * |
||
| 821 | * @return Mixed |
||
| 822 | * @link https://developer.qiniu.com/kodo/api/update-file-lifecycle |
||
| 823 | */ |
||
| 824 | 3 | public function deleteAfterDays($bucket, $key, $days) |
|
| 831 | |||
| 832 | 3 | private function getRsfHost() |
|
| 840 | |||
| 841 | 33 | private function getRsHost() |
|
| 849 | |||
| 850 | private function getApiHost() |
||
| 858 | |||
| 859 | private function getUcHost() |
||
| 867 | |||
| 868 | 27 | private function rsPost($path, $body = null) |
|
| 873 | |||
| 874 | private function apiPost($path, $body = null) |
||
| 879 | |||
| 880 | private function ucPost($path, $body = null) |
||
| 885 | |||
| 886 | private function ucGet($path) |
||
| 891 | |||
| 892 | private function apiGet($path) |
||
| 897 | |||
| 898 | 6 | private function rsGet($path) |
|
| 903 | |||
| 904 | 9 | private function get($url) |
|
| 913 | |||
| 914 | 27 | private function post($url, $body) |
|
| 924 | |||
| 925 | private function ucPostV2($path, $body) |
||
| 930 | |||
| 931 | private function postV2($url, $body) |
||
| 942 | |||
| 943 | 3 | public static function buildBatchCopy($source_bucket, $key_pairs, $target_bucket, $force) |
|
| 947 | |||
| 948 | |||
| 949 | 3 | public static function buildBatchRename($bucket, $key_pairs, $force) |
|
| 953 | |||
| 954 | |||
| 955 | 6 | public static function buildBatchMove($source_bucket, $key_pairs, $target_bucket, $force) |
|
| 959 | |||
| 960 | |||
| 961 | public static function buildBatchDelete($bucket, $keys) |
||
| 965 | |||
| 966 | |||
| 967 | 3 | public static function buildBatchStat($bucket, $keys) |
|
| 971 | |||
| 972 | public static function buildBatchDeleteAfterDays($bucket, $key_day_pairs) |
||
| 980 | |||
| 981 | public static function buildBatchChangeMime($bucket, $key_mime_pairs) |
||
| 989 | |||
| 990 | public static function buildBatchChangeType($bucket, $key_type_pairs) |
||
| 998 | |||
| 999 | 3 | private static function oneKeyBatch($operation, $bucket, $keys) |
|
| 1007 | |||
| 1008 | 9 | private static function twoKeyBatch($operation, $source_bucket, $key_pairs, $target_bucket, $force) |
|
| 1025 | } |
||
| 1026 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.