Showing 331 of 503 total issues
Method save
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save()
{
// get the filter model based on the current filter.
$filterModel = $this->findModel();
// update the name of the filter if changed
Method ngRestConfigDefine
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function ngRestConfigDefine(ConfigBuilder $config, $assignedType, array $fields)
{
$types = $this->ngRestAttributeTypes();
$extraTypes = $this->ngRestExtraAttributeTypes();
Function actionExport
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionExport()
{
$extension = null;
$mime = null;
$header = Yii::$app->request->getBodyParam('header', 1);
- 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 getOptionsData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getOptionsData($event)
{
$items = [];
$targetModel = new $this->model();
foreach ($this->model->find()->asArray($this->asArray)->all() as $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 onAfterListFind
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function onAfterListFind($event)
{
if (!$this->assignAfterFind) {
return parent::onAfterListFind($event);
}
- 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 actionReset
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionReset()
{
if (!$this->module->resetPassword) {
throw new ForbiddenHttpException();
}
- 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 run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
$modules = Yii::$app->getModules();
$ids = [];
foreach ($modules as $id => $moduleObject) {
- 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 actionIndex
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionIndex()
{
try {
Image::getImagine();
} catch (\Exception $e) {
- 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 getPathsFromControllerMap
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function getPathsFromControllerMap()
{
foreach ($this->controllerMap as $key => $map) {
if (is_array($map)) {
$controller = Yii::createObject($map['class'], [$key, $map['module']]);
- 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 getUseClasses
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getUseClasses()
{
$file = $this->reflection->getFileName();
$tokens = \PhpToken::tokenize(file_get_contents($file));
- 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 filter
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function filter()
{
$containerData = $this->getDataProvider();
$whereExpression = $this->_where;
Method getResponseContent
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getResponseContent()
{
$modelClass = $this->extractModelClassFromObject($this->getActionObject());
if ($modelClass) {
Function link
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function (scope, element, attrs) {
scope.elementWidth = 0;
var getElementOriginalWidth = function () {
var elementClone = element.clone().insertAfter(element);
Method updateItemIndex
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false)
{
$attributeName = self::sortableField();
$oldPosition = array_key_exists($attributeName, $event->changedAttributes) ? $event->changedAttributes[$attributeName] : false;
$newPosition = $event->sender[$attributeName];
Function controller
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$timeout', function ($scope, $timeout) {
$scope.pageNumberInputVal = $scope.currentPage;
$scope.$watch('currentPage', function(newVal) {
$scope.pageNumberInputVal = newVal;
Function controller
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$filter', function ($scope, $filter) {
if ($scope.model === undefined) {
$scope.model = [];
}
Method addFile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addFile($fileSource, $fileName, $folderId = 0, $isHidden = false)
{
// ensure the file upload
$fileData = $this->ensureFileUpload($fileSource, $fileName);
// generate md5 hash from file source
Method ensureFileUpload
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function ensureFileUpload($fileSource, $fileName)
{
// throw exception if source or name is empty
if (empty($fileSource) || empty($fileName)) {
throw new Exception("Filename and source can not be empty.");
Method safeUp
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function safeUp()
{
// admin_auth
$this->createIndex('index_route', '{{%admin_auth}}', ['route']);
$this->createIndex('index_api', '{{%admin_auth}}', ['api']);
Function addImage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. 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)) {
- 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"