Showing 17 of 123 total issues
Method info
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function info(Request $request)
{
$userId = $request->session()->get('user_id');
$color = ['', 'green', 'blue', 'purple', 'pinkpurple', 'red'];
$params = $request->all();
Method getDefaultRight
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDefaultRight()
{
return [
[
'key' => 9999,
Function add
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function add($params, $operUserId) {
$customModel = new Customer();
$result = ['status'=>1, 'error'=>''];
$params['add_user_id'] = $operUserId;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method handle
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle($request, Closure $next)
{
$userId = $request->session()->get('user_id', 0);
if (empty($userId)) {
Method getLogListByCustomerId
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getLogListByCustomerId($customerId, $limit) {
$dictModel = new SystemDict();
$userModel = new SystemUser();
$followUserArray = $userModel->getAllUserWithDelMap();
$dict = $dictModel->getListByGroup($dictModel::GROUP_CUSTOM);
Method get
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get($customId, $followUserId, $operUserId = 0, $assignType = 0) {
$customModel = new Customer();
$custom = $customModel->find($customId);
$oldFollowUserId = $custom->follow_user_id;
if (empty($custom) || $oldFollowUserId == $followUserId) {
Function handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function handle($config) {
echo PHP_EOL;
// 获取今天还有分配名额的用户
$customService = app(CustomerService::class);
$userService = app(UserService::class);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method addNotices
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addNotices(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$customId = $params['id'];
$notices = $params['notices'];
Function handle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function handle() {
echo date('Y-m-d H:i:s') . ' start.......'.PHP_EOL;
// 取到所有分配规则
$model = new CustomerRuleConfig();
$rules = $model->get();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _createWhere
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _createWhere($params) {
$query = $this->leftJoin('customer', 'customer_backs.custom_id', '=', 'customer.id')->where('customer_backs.status', 1);
if (isset($params['customId']) && !empty($params['customId'])) {
$query = $query->where('customer_backs.custom_id', $params['customId']);
}
Method handle
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle($config) {
echo PHP_EOL;
// 获取今天还有分配名额的用户
$customService = app(CustomerService::class);
$userService = app(UserService::class);
Method handle
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle() {
echo date('Y-m-d H:i:s') . ' start.......'.PHP_EOL;
// 取到所有分配规则
$model = new CustomerRuleConfig();
$rules = $model->get();
Function _createWhere
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function _createWhere($params) {
$query = $this->leftJoin('customer', 'customer_backs.custom_id', '=', 'customer.id')->where('customer_backs.status', 1);
if (isset($params['customId']) && !empty($params['customId'])) {
$query = $query->where('customer_backs.custom_id', $params['customId']);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getLogListByCustomerId
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getLogListByCustomerId($customerId, $limit) {
$dictModel = new SystemDict();
$userModel = new SystemUser();
$followUserArray = $userModel->getAllUserWithDelMap();
$dict = $dictModel->getListByGroup($dictModel::GROUP_CUSTOM);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function addChannelCustomer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addChannelCustomer($custom) {
$id = 0;
$hasInfo = Customer::where('source', $custom['source'])->where('channel_id', $custom['channel_id'])->get()->toArray();
// 判断客户已经存在
if (empty($hasInfo)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function login
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function login(Request $request)
{
$params = $request->all();
$userName = $params['username'];
$password = $params['password'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method saveLog
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function saveLog($type, $id, $before, $after, $userId = 0, $remark = '') {