Showing 331 of 503 total issues
Method generateClassName
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateClassName($tableName, $useSchemaName = null)
{
if (isset($this->classNames[$tableName])) {
return $this->classNames[$tableName];
}
Method actionPasswordReset
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionPasswordReset($token, $id)
{
if (!$this->module->resetPassword) {
throw new ForbiddenHttpException();
}
Method internalGenerateResponseArrayFromModel
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function internalGenerateResponseArrayFromModel($modelClassName, $isArray = false)
{
$object = $this->createObjectFromClassName($modelClassName);
$schema = false;
Function uploadUsingUpload
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.uploadUsingUpload = function (file) {
file.upload = Upload.upload({
url: 'admin/api-admin-storage/files-upload',
fields: { 'folderId': $scope.currentFolderId },
file: file
Method actionSession
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionSession()
{
$user = Yii::$app->adminuser->identity;
$qrcode = null;
Method actionCleanupImageTable
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCleanupImageTable()
{
$rows = Yii::$app->db->createCommand('SELECT file_id, filter_id, COUNT(*) as count FROM {{%admin_storage_image}} GROUP BY file_id, filter_id HAVING COUNT(*) > 1')->queryAll();
if (empty($rows)) {
Function controller
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$timeout', function ($scope, $timeout) {
$scope.init = function () {
if ($scope.truevalue === undefined || $scope.truevalue === "") {
$scope.truevalue = 1;
Function link
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function (scope, element, attrs) {
element.bind("focus", function () {
$rootScope.lastElement = element[0];
var offCallFn = $rootScope.$on('insertPasteListener', function (e, val) {
var domElement = $rootScope.lastElement;
Function submitCreate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.submitCreate = function(close, redirect) {
$http.post($scope.config.apiEndpoint, angular.toJson($scope.data.create, true)).then(function(response) {
AdminToastService.success(i18n['js_ngrest_rm_success']);
$scope.loadList().then(function() {
$scope.applySaveCallback();
Method registerComponents
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function registerComponents()
{
return [
'adminLanguage' => [
'class' => AdminLanguage::class,
Function prepareDataProvider
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function prepareDataProvider()
{
$requestParams = Yii::$app->getRequest()->getBodyParams();
if (empty($requestParams)) {
$requestParams = Yii::$app->getRequest()->getQueryParams();
- 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 i18nAttributeFallbackValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function i18nAttributeFallbackValue($attributeName, $preferredLanguage = null)
{
$value = $this->{$attributeName};
if (empty($value) && $this->isI18n($attributeName)) {
- 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 actionFileReplace
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function actionFileReplace()
{
$fileId = Yii::$app->request->post('fileId', false);
$raw = $_FILES['file'] ?? false;
/** @var $file \luya\admin\file\Item */
- 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 decode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function decode($value, $onEmptyValue = '')
{
$languages = Yii::$app->adminLanguage->getLanguages();
// if its not already unserialized, decode it
- 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 ensureClassName
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function ensureClassName($className)
{
$className = strtolower($className);
foreach ($this->getUseClasses() as $name) {
if (StringHelper::contains(' as ', strtolower($name))) {
- 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 actionCleanup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function actionCleanup()
{
$tagIds = Tag::find()->select(['id'])->column();
$batch = TagRelation::find()->batch();
- 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 internalGenerateResponseArrayFromModel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function internalGenerateResponseArrayFromModel($modelClassName, $isArray = false)
{
$object = $this->createObjectFromClassName($modelClassName);
$schema = false;
- 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 validateAttribute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function validateAttribute($model, $attribute)
{
// if skip if unchanged is enabled and active record and the attribute has not changed, skip this validation rule.
if ($this->skipIfUnchanged && $model instanceof BaseActiveRecord) {
if (!$model->isAttributeChanged($attribute)) {
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', 'ServiceImagesData', function ($scope, ServiceImagesData) {
$scope.imageSrc = null;
$scope.$watch('imageId', function (n, o) {
if (n != o) {
Function pasteUpload
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.pasteUpload = function (e) {
for (var i = 0; i < e.originalEvent.clipboardData.items.length; i++) {
var item = e.originalEvent.clipboardData.items[i];
if (item.kind == 'file') {
LuyaLoading.start(i18n['js_dir_upload_wait']);