CIParamTransformation.php 918 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Qcloud\Cos\ImageParamTemplate;
  3. class CIParamTransformation extends ImageTemplate{
  4. private $tranParams;
  5. private $tranString;
  6. private $spilt;
  7. public function __construct($spilt = "|") {
  8. parent::__construct();
  9. $this->spilt = $spilt;
  10. $this->tranParams = array();
  11. $this->tranString = "";
  12. }
  13. public function addRule(ImageTemplate $template) {
  14. if($template->queryString()){
  15. $this->tranParams[] = $template->queryString();
  16. }
  17. }
  18. public function queryString() {
  19. if($this->tranParams) {
  20. $this->tranString = implode($this->spilt, $this->tranParams);
  21. }
  22. return $this->tranString;
  23. }
  24. public function resetRule() {
  25. $this->tranParams = array();
  26. $this->tranString = "";
  27. }
  28. public function defineRule($value) {
  29. $this->tranParams[] = $value;
  30. }
  31. }