Skip to content

Commit

Permalink
Check if key and domain exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima K committed Mar 22, 2018
1 parent 512511d commit a648c0a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Services/RequestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ class RequestService

public function __construct()
{
if(!isset(Yii::$app->params['ImageCompressor'])){
throw new Exception('ImageCompressor params is empty');
}

$configs = Yii::$app->params['ImageCompressor'];

if(empty($configs['key']) || empty($configs['domain'])){
throw new Exception('Key and Domain is required params.');
}

$this->key = $configs['key'];
$this->domain = $configs['domain'];

}

public function sendRequest(string $imageExt, string $imageContent, int $compressRatio): string
Expand Down

0 comments on commit a648c0a

Please sign in to comment.