Showing 331 of 503 total issues
Function getUrlRules
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getUrlRules()
{
$rules = [];
// get all rules from the urlManager
foreach ($this->urlManager->rules as $rule) {
- 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 controller
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
controller: ['$scope', function ($scope) {
$scope.input = { showWindow: true };
$scope.content = null;
Function template
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
template: function () {
return '' +
'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
'<div class="form-side form-side-label">' +
'<label>{{label}}</label>' +
Function link
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
link: function ($scope, $element, $attrs) {
$scope.$watch('trigger', function (n, o) {
if (n == 0) {
$($attrs.resizerLeft).removeAttr('style');
Method safeUp
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function safeUp()
{
$this->createTable("{{%admin_queue}}", [
'id' => $this->primaryKey(),
'channel' => $this->string()->notNull(),
Method log
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function log($type, $message, $trace, $groupIdentifier)
{
$hashArray = static::getHashArray($message, $groupIdentifier);
$file = 'unknown';
Function alignModal
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
scope.alignModal = function() {
var documentSize = {width: $(document).width(), height: element.parents('.luya-content')[0].scrollHeight || $(document).height()};
var buttonBcr = button[0].getBoundingClientRect();
var buttonSpaceRight = documentSize.width - (buttonBcr.left + buttonBcr.width + (modalMargin * 2));
Method actionIndex
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionIndex()
{
$userId = Yii::$app->adminuser->id;
// clear user online list
Method actionIndex
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionIndex()
{
$tempName = null;
if ($this->identifier === null) {
$this->identifier = Inflector::variablize($this->prompt('Enter the filter identifier: (e.g. profilePicture)', ['required' => true, 'pattern' => '/^[a-zA-Z0-9]+$/i', 'error' => 'The filter identifer can only contain a-z,A-Z,0-9']));
Consider simplifying this complex logical expression. Open
Open
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) { return PLURAL_CATEGORY.ONE; } if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) { return PLURAL_CATEGORY.FEW; } if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;}
Consider simplifying this complex logical expression. Open
Open
if ( (!scope.pop || lastValue != scope.tooltipText)
&& (typeof scope.tooltipDisabled === 'undefined' || scope.tooltipDisabled === false)
&& (scope.tooltipText || scope.tooltipImageUrl || scope.tooltipPreviewUrl) ) {
lastValue = scope.tooltipText
Consider simplifying this complex logical expression. Open
Open
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) { return PLURAL_CATEGORY.ONE; } if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) { return PLURAL_CATEGORY.FEW; } if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;}
Consider simplifying this complex logical expression. Open
Open
if (navigator.userAgent &&
(navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
Method prepareDataProvider
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function prepareDataProvider()
{
$requestParams = Yii::$app->getRequest()->getBodyParams();
if (empty($requestParams)) {
$requestParams = Yii::$app->getRequest()->getQueryParams();
Function showCalendar
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
, showCalendar = function showCalendar() {
//lets hide all the latest instances of datepicker
pageDatepickers = $window.document.getElementsByClassName('_720kb-datepicker-calendar');
angular.forEach(pageDatepickers, function forEachDatepickerPages(value, key) {
Function update
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var update = function () {
if ($shadow == null) {
$shadow = angular.element('<div></div>').css({
position: 'absolute',
top: -10000,
Method getAvailableApiEndpoints
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getAvailableApiEndpoints()
{
$data = [];
$generic = [];
$userId = $this->model->id;
Method addImage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addImage($fileId, $filterId = 0, $throwException = false)
{
try {
// if the filterId is provded as a string the filter will be looked up by its name in the get filters array list.
if (is_string($filterId) && !is_numeric($filterId)) {
Function searchDetailClick
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$scope.searchDetailClick = function(itemConfig, itemData) {
if (itemConfig.type === 'custom') {
$scope.click(itemConfig.menuItem, true).then(function() {
if (itemConfig.stateProvider) {
var params = {};
Function template
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
template: function () {
return '' +
'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
'<div class="form-side form-side-label">' +
'<label>{{label}}</label>' +