Showing 33 of 43 total issues
Method SDP_Shortcuts_Mime2Ext
has 562 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SDP_Shortcuts_Mime2Ext ($mime_type)
{
$Ext2Mime = array(
'hqx' => array(
'application/mac-binhex40',
File Shortcuts.php
has 612 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/*
* This file is part of Pluf Framework, a simple PHP Application Framework.
* Copyright (C) 2010-2020 Phoinex Scholars Co. (http://dpq.co.ir)
Method init
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init()
{
$this->_a['table'] = 'sdp_asset';
$this->_a['verbose'] = 'SDP Asset';
$this->_a['cols'] = array(
File Asset.php
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/*
* This file is part of Pluf Framework, a simple PHP Application Framework.
* Copyright (C) 2010-2020 Phoinex Scholars Co. (http://dpq.co.ir)
Method init
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init()
{
$this->_a['table'] = 'sdp_link';
$this->_a['verbose'] = 'SDP Link';
$this->_a['cols'] = array(
Method init
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init()
{
$this->_a['table'] = 'sdp_category';
$this->_a['verbose'] = 'SDP Category';
$this->_a['cols'] = array(
Method initFields
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function initFields($extra = array())
{
$this->asset = $extra['asset'];
$this->fields['name'] = new Pluf_Form_Field_Varchar(array(
Method init
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init()
{
$this->_a['table'] = 'sdp_assetrelation';
$this->_a['verbose'] = 'AssetRelation';
$this->_a['cols'] = array(
Method init
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init()
{
$this->_a['table'] = 'sdp_profile';
$this->_a['model'] = 'SDP_Profile';
$this->_model = 'SDP_Profile';
Method init
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init()
{
$this->_a['table'] = 'sdp_drives';
$this->_a['cols'] = array(
'id' => array(
Method getGeneralParam
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getGeneralParam()
{
$params = array();
$params[] = array(
'name' => 'title',
Method init
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init()
{
$this->_a['table'] = 'sdp_tag';
$this->_a['verbose'] = 'SDP Tag';
$this->_a['cols'] = array(
Method relations
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function relations($request, $match)
{
$asset = Pluf_Shortcuts_GetObjectOr404('SDP_Asset', $match['assetId']);
$relatedAsset = new SDP_Asset();
$relatedAssetTable = $relatedAsset->_a['table'];
Method getExtraParam
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getExtraParam()
{
return array(
array(
'name' => 'encrypt_key',
Function createViewQuery
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function createViewQuery($request)
{
$includeTag = isset($request->REQUEST['include_tag']) ? $request->REQUEST['include_tag'] : null;
$excludeTag = isset($request->REQUEST['exclude_tag']) ? $request->REQUEST['exclude_tag'] : 0;
$includeCategory = isset($request->REQUEST['include_category']) ? $request->REQUEST['include_category'] : null;
- 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 initFields
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function initFields($extra = array())
{
$this->userRequest = $extra['request'];
$this->fields['name'] = new Pluf_Form_Field_Varchar(array(
Method find
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function find($request, $match)
{
// Restrict find to current user or user is owner of tenant
$links = new Pluf_Paginator(new SDP_Link());
if (! User_Precondition::isOwner($request)) {
Method payment
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function payment($request, $match)
{
$link = Pluf_Shortcuts_GetObjectOr404('SDP_Link', $match['linkId']);
$asset = $link->get_asset();
Function save
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function save($commit = true)
{
if (! $this->isValid()) {
throw new \Pluf\Exception('cannot save the asset from an invalid form');
}
- 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 categories
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function categories($request, $match)
{
$asset = Pluf_Shortcuts_GetObjectOr404('SDP_Asset', $match['assetId']);
$category = new SDP_Category();
$categoryTable = $category->_con->pfx . $category->_a['table'];