Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
heyjun committed Apr 2, 2024
1 parent 109ebb4 commit bdd5014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
vendor
.idea
cghooks.lock

11 changes: 4 additions & 7 deletions src/DeepLTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@ public function __construct(int $timeout = 5)
$this->timeout = $timeout;
}

/**
* @return DeepLTranslator
*/
public static function withoutVerifying(): DeepLTranslator
{
self::$verify = false;
static::$verify = false;

return new self;
return new static;
}

/**
Expand Down Expand Up @@ -116,7 +113,7 @@ public function translate(string $query, string $to, string $from = 'auto'): Dee
}

/**
* @param int $type 0:format 1:json string 2:array
* @param int $type 0:format 1:json string 2:array
* @return array|string
*/
public function result(int $type = self::TYPE_FORMAT)
Expand Down Expand Up @@ -206,7 +203,7 @@ private function postData(string $url, string $data)
CURLOPT_RETURNTRANSFER => true,
];

if (self::$verify == false) {
if (! static::$verify) {
$opt[CURLOPT_SSL_VERIFYPEER] = false;
$opt[CURLOPT_SSL_VERIFYHOST] = false;
}
Expand Down

0 comments on commit bdd5014

Please sign in to comment.