Showing 69 of 84 total issues
Function packAndMinifyScripts
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function packAndMinifyScripts() :void {
// if we are allowed to pack js files
if(self::isPackingOfTheseAssetsAllowed('js')) {
// generate a unique name for a pack that contains that list of scripts only
list(
- Read upRead up
- Create a ticketCreate a ticket
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 authenticateByForm
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected static function authenticateByForm() :void {
// look for users with this login
$account = \Models\Accounts::getByLogin(
Request::post( Config::get('security', 'login') )
- Create a ticketCreate a ticket
Method getPermissions
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getPermissions(
// if we want to keep a trace of what that permission whas inherited from
bool $with_parent_role_id = false
) :array {
- Create a ticketCreate a ticket
Method getBody
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getBody(
Dropdown $security_dropdown
) : Dropdown {
$account = \Polyfony\Security::getAccount();
- Create a ticketCreate a ticket
Method hasValidSignature
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function hasValidSignature(
array $request_parameters_indexed_by_position
) :bool {
// if the route needs a signature to be a match
- Create a ticketCreate a ticket
Method getQueriesAndTheirDuration
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function getQueriesAndTheirDuration($stack) {
$queries_count = 0;
$queries_duration = 0;
$queries = [];
- Create a ticketCreate a ticket
Method configureAndGetDSN
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function configureAndGetDSN() :string {
// alter the configuration
self::$_config = array(
'driver' => Config::get('database','driver'),
- Create a ticketCreate a ticket
Method setLinks
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function setLinks(
array $links,
bool $replace_existing=false
) :void {
// if we want to purge existing links
- Create a ticketCreate a ticket
Method getBody
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function getBody($data) {
$timing_body = [];
// for each stacked element
foreach($data['stack'] as $elem) {
- Create a ticketCreate a ticket
Method forward
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function forward(Route $route) :void {
// get the full destination
list(
$script,
- Create a ticketCreate a ticket
Method valueForDatabase
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function valueForDatabase(string $column, $value) {
// if we find a serialization keyword
if(strpos($column,'_array') !== false) {
// encode the content as JSON, being it array, null, false, whatever
$value = json_encode($value);
- Create a ticketCreate a ticket
Method getLogs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function getLogs($stack) {
$logs_count = 0;
$logs = [];
- Create a ticketCreate a ticket
Method save
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function save() :bool {
// if nothing has changed on this object
if(!count($this->_['altered'])) {
// we consider the object saved without touching the database
- Create a ticketCreate a ticket
Method getAccounts
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getAccounts() :array {
return array_unique(array_merge(
// get account with that permissions directly assigned to them
- Create a ticketCreate a ticket
Method set
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function set(
$column_or_array,
$value = null
) {
// if we want to set a batch of values
- Create a ticketCreate a ticket
Method whereIn
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function whereIn(array $conditions, bool $invert=false) :self {
// for each provided strict condition
foreach($conditions as $column => $values) {
// if we have to conditions
if(!is_array($values) || empty($values)) {
- Create a ticketCreate a ticket
Method packAndMinifyScripts
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function packAndMinifyScripts() :void {
// if we are allowed to pack js files
if(self::isPackingOfTheseAssetsAllowed('js')) {
// generate a unique name for a pack that contains that list of scripts only
list(
- Create a ticketCreate a ticket
Method view
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
final public function view(
string $view_name,
$bundle_or_variables = null,
?array $variables = []
) :void {
- Create a ticketCreate a ticket
Method getBodyMisc
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function getBodyMisc(
Dropdown $cache_dropdown
) :Dropdown {
return $cache_dropdown
- Create a ticketCreate a ticket
Method select
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function select(
string $name,
array $select_options=[],
$selected_value=null,
array $attributes=[]
- Create a ticketCreate a ticket