for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the light/yii2-apistore.
*
* (c) lichunqiang <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace light\apistore\apis;
/**
* 翻译.
* @see http://apistore.baidu.com/apiworks/servicedetail/118.html
class Translate extends Api
{
private $address_translate = 'http://apis.baidu.com/apistore/tranlateservice/translate?';
* 目前词典接口只支持zh和en两种语言
* @param string $query 请求的词语或待翻译的内容,UTF-8,urlencode编码
$query
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param string $from 源语言语种:语言代码或auto
$from
* @param string $to 目标语言语种:语言代码或auto
$to
* @return array
public function get($queryParams)
$_using_address = $this->address_translate;
if (is_string($queryParams)) {
$queryParams = ['query' => $queryParams, 'from' => 'auto', 'to' => 'auto'];
} elseif (!isset($queryParams['query'])) {
$queryParams = array_combine(['query', 'from', 'to'], $queryParams);
}
return $this->fetch($_using_address . http_build_query($queryParams));
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.