Skip to content

Commit

Permalink
enableLog feature
Browse files Browse the repository at this point in the history
  • Loading branch information
psrustik committed Jun 30, 2015
1 parent 69cba0b commit 6aae707
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public function isAllowUser($email = '', $nickName = '')

$ctResult = $this->sendRequest($ctRequest, 'isAllowUser');

if ($ctResult->inactive == 1) {
$this->log(sprintf('Need admin approval for "isAllowUser": %s', $ctResult->comment));
}

return [$ctResult->allow == 1, $ctResult->comment];
}

Expand All @@ -87,10 +83,6 @@ public function isAllowMessage($message, $email = '', $nickName = '')

$ctResult = $this->sendRequest($ctRequest, 'isAllowMessage');

if ($ctResult->inactive == 1) {
$this->log(sprintf('Need admin approval for "isAllowMessage": %s', $ctResult->comment));
}

return [$ctResult->allow == 1, $ctResult->comment];
}

Expand Down Expand Up @@ -178,17 +170,11 @@ protected function sendRequest($request, $method)
}
Yii::trace('Sending request to cleantalk:' . var_export($request, true), __METHOD__);

return $ct->$method($request);
}
$response = $ct->$method($request);

/**
* @param string $message
*/
protected function log($message)
{
if ($this->enableLog) {
Yii::info($message, __CLASS__);
Yii::info(sprintf('Cleantalk response is allow=%d, inactive=%d, comment=%s', $response->allow, $response->inactive, $response->comment), __METHOD__);
}
return $response;
}

}

0 comments on commit 6aae707

Please sign in to comment.