File Catalog.php
has 2953 lines of code (exceeds 500 allowed). Consider refactoring. Open
<?php
declare(strict_types=0);
/**
Function update_song_from_tags
has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring. Open
public static function update_song_from_tags($results, Song $song): array
{
//debug_event(__CLASS__, "update_song_from_tags results: " . print_r($results, true), 4);
// info for the song table. This is all the primary file data that is song related
$new_song = new Song();
- 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
Catalog
has 151 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
Function process_action
has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring. Open
public static function process_action($action, $catalogs, $options = null): void
{
if (empty($options)) {
$options = array(
'gather_art' => 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 update_single_item
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
public static function update_single_item($type, $object_id, $api = false): array
{
// Because single items are large numbers of things too
set_time_limit(0);
- 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 update_song_from_tags
has 344 lines of code (exceeds 200 allowed). Consider refactoring. Open
public static function update_song_from_tags($results, Song $song): array
{
//debug_event(__CLASS__, "update_song_from_tags results: " . print_r($results, true), 4);
// info for the song table. This is all the primary file data that is song related
$new_song = new Song();
Function gather_art_item
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public static function gather_art_item($type, $object_id, $db_art_first = false, $api = false): bool
{
// Should be more generic !
if ($type == 'video') {
$libitem = Video::create_from_id($object_id);
- 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 gather_art
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function gather_art($songs = null, $videos = null): bool
{
// Make sure they've actually got methods
$art_order = AmpConfig::get('art_order');
$gather_song_art = AmpConfig::get('gather_song_art', 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
The class Catalog has 77 non-getter- and setter-methods. Consider refactoring Catalog to keep number of methods under 25. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
- Read upRead up
- Exclude checks
TooManyMethods
Since: 0.1
A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
The default was changed from 10 to 25 in PHPMD 2.3.
Example
Source https://phpmd.org/rules/codesize.html#toomanymethods
The class Catalog has an overall complexity of 799 which is very high. The configured complexity threshold is 50. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
- Exclude checks
The class Catalog has 70 public methods. Consider refactoring Catalog to keep number of public methods under 10. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Function update_from_external
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function update_from_external($object_list, $object_type): void
{
// Prevent the script from timing out
set_time_limit(0);
- 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 get_user_filter
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function get_user_filter($type, $user_id): string
{
switch ($type) {
case "album":
case "song":
- 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 process_action
has 238 lines of code (exceeds 200 allowed). Consider refactoring. Open
public static function process_action($action, $catalogs, $options = null): void
{
if (empty($options)) {
$options = array(
'gather_art' => false,
Function cache_catalogs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function cache_catalogs(): void
{
$path = (string)AmpConfig::get('cache_path', '');
$target = (string)AmpConfig::get('cache_target', '');
// need a destination and target filetype
- 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
The class Catalog has 24 fields. Consider redesigning Catalog to keep the number of fields under 15. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
Function getLastUpdate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getLastUpdate($catalogs = null): int
{
$last_update = 0;
if ($catalogs == null || !is_array($catalogs)) {
$catalogs = self::get_catalogs();
- 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 update_counts
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function update_counts(): void
{
$update_time = self::get_update_info('update_counts', -1);
$now_time = time();
// give the server a 30 min break for this help with load
- 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
The class Catalog has 144 public methods and attributes. Consider reducing the number of public items to less than 45. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Function get_podcasts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function get_podcasts($catalogs = null): array
{
if (!$catalogs) {
$catalogs = self::get_catalogs('podcast');
}
- 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 get_catalogs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function get_catalogs($filter_type = '', $user_id = null, $query = false): array
{
$params = array();
$sql = "SELECT `id` FROM `catalog` ";
$join = 'WHERE';
- 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 get_name_array
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function get_name_array($objects, $table, $sort = '', $order = 'ASC'): array
{
switch ($table) {
case 'album':
case 'artist':
- 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
Avoid deeply nested control flow statements. Open
if ($media->file) {
/** @var Catalog_local $catalog */
if ($catalog->clean_file($media->file, $type)) {
$changed++;
}
Avoid deeply nested control flow statements. Open
if ($changed > 0) {
self::update_catalog_map($catalog->gather_types);
}
Avoid deeply nested control flow statements. Open
switch ($catalog->gather_types) {
case 'podcast':
$type = 'podcast_episode';
$file_ids = Catalog::get_ids_from_folder($clean_path, $type);
$className = Podcast_Episode::class;
Method sort_find_home
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function sort_find_home($song, $sort_pattern, $base = null, $various_artist = "Various Artists", $windowsCompat = false): ?string
Function get_videos
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function get_videos($catalogs = null, $type = ''): array
{
if (!$catalogs) {
$catalogs = self::get_catalogs();
}
- 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 update_media_from_tags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function update_media_from_tags(
$media,
$gather_types = array('music'),
$sort_pattern = '',
$rename_pattern = ''
- 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 get_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function get_info($object_id, $table_name = 'catalog'): array
{
$info = parent::get_info($object_id, $table_name);
$table = 'catalog_' . $this->get_type();
- 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 get_tvshows
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function get_tvshows($catalogs = null): array
{
if (!$catalogs) {
$catalogs = self::get_catalogs();
}
- 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 update_video_from_tags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function update_video_from_tags($results, Video $video): array
{
/* Setup the vars */
$new_video = new Video();
$new_video->file = $results['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
Avoid too many return
statements within this method. Open
return self::update_video_from_tags($results, $media);
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return self::update_podcast_episode_from_tags($results, $media);
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $update;
Avoid too many return
statements within this method. Open
return false;
Function get_songs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function get_songs($offset = 0, $limit = 0): array
{
$songs = array();
$results = array();
if ($offset > 0) {
- 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 get_newest_podcasts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function get_newest_podcasts($count): array
{
$catalogs = self::get_catalogs('podcast');
$results = array();
- 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 get_albums_by_artist
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function get_albums_by_artist($size = 0, $offset = 0, $catalogs = null): array
{
$sql = "SELECT `album`.`id` FROM `album` ";
$sql_where = "";
$sql_group = "GROUP BY `album`.`id`, `artist`.`name`, `artist`.`id`, `album`.`name`, `album`.`mbid`";
- 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 get_artists
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function get_artists($catalogs = null, $size = 0, $offset = 0): array
{
$sql_where = "WHERE `artist`.`album_count` > 0";
if (is_array($catalogs) && count($catalogs)) {
$catlist = '(' . implode(',', $catalogs) . ')';
- 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 get_enable_filter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function get_enable_filter($type, $catalog_id): string
{
$sql = "";
if ($type == "song" || $type == "album" || $type == "artist" || $type == "album_artist") {
if ($type == "song") {
- 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 get_albums
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function get_albums($size = 0, $offset = 0, $catalogs = null): array
{
$sql = "SELECT `album`.`id` FROM `album` ";
if (is_array($catalogs) && count($catalogs)) {
$catlist = '(' . implode(',', $catalogs) . ')';
- 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 delete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function delete($catalog_id): bool
{
$params = array($catalog_id);
$catalog = self::create_from_id($catalog_id);
if (!$catalog) {
- 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
The class Catalog has 4372 lines of code. Current threshold is 1000. Avoid really long classes. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
- Exclude checks
The method gather_art() has an NPath complexity of 352. The configured NPath complexity threshold is 200. Open
public function gather_art($songs = null, $videos = null): bool
{
// Make sure they've actually got methods
$art_order = AmpConfig::get('art_order');
$gather_song_art = AmpConfig::get('gather_song_art', false);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method update_counts() has an NPath complexity of 864. The configured NPath complexity threshold is 200. Open
public static function update_counts(): void
{
$update_time = self::get_update_info('update_counts', -1);
$now_time = time();
// give the server a 30 min break for this help with load
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method update_song_from_tags() has 415 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function update_song_from_tags($results, Song $song): array
{
//debug_event(__CLASS__, "update_song_from_tags results: " . print_r($results, true), 4);
// info for the song table. This is all the primary file data that is song related
$new_song = new Song();
- Exclude checks
The method get_user_filter() has 110 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function get_user_filter($type, $user_id): string
{
switch ($type) {
case "album":
case "song":
- Exclude checks
The method update_single_item() has 127 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function update_single_item($type, $object_id, $api = false): array
{
// Because single items are large numbers of things too
set_time_limit(0);
- Exclude checks
The method process_action() has an NPath complexity of 15456. The configured NPath complexity threshold is 200. Open
public static function process_action($action, $catalogs, $options = null): void
{
if (empty($options)) {
$options = array(
'gather_art' => false,
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method update_single_item() has an NPath complexity of 805860. The configured NPath complexity threshold is 200. Open
public static function update_single_item($type, $object_id, $api = false): array
{
// Because single items are large numbers of things too
set_time_limit(0);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method gather_art_item() has an NPath complexity of 31104. The configured NPath complexity threshold is 200. Open
public static function gather_art_item($type, $object_id, $db_art_first = false, $api = false): bool
{
// Should be more generic !
if ($type == 'video') {
$libitem = Video::create_from_id($object_id);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method update_counts() has 178 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function update_counts(): void
{
$update_time = self::get_update_info('update_counts', -1);
$now_time = time();
// give the server a 30 min break for this help with load
- Exclude checks
The method update_song_from_tags() has an NPath complexity of 9223372036854775807. The configured NPath complexity threshold is 200. Open
public static function update_song_from_tags($results, Song $song): array
{
//debug_event(__CLASS__, "update_song_from_tags results: " . print_r($results, true), 4);
// info for the song table. This is all the primary file data that is song related
$new_song = new Song();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method process_action() has 260 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function process_action($action, $catalogs, $options = null): void
{
if (empty($options)) {
$options = array(
'gather_art' => false,
- Exclude checks
The method update_single_item() has a Cyclomatic Complexity of 49. The configured cyclomatic complexity threshold is 10. Open
public static function update_single_item($type, $object_id, $api = false): array
{
// Because single items are large numbers of things too
set_time_limit(0);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method update_from_external() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function update_from_external($object_list, $object_type): void
{
// Prevent the script from timing out
set_time_limit(0);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method get_name_array() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10. Open
public static function get_name_array($objects, $table, $sort = '', $order = 'ASC'): array
{
switch ($table) {
case 'album':
case 'artist':
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method update_song_from_tags() has a Cyclomatic Complexity of 128. The configured cyclomatic complexity threshold is 10. Open
public static function update_song_from_tags($results, Song $song): array
{
//debug_event(__CLASS__, "update_song_from_tags results: " . print_r($results, true), 4);
// info for the song table. This is all the primary file data that is song related
$new_song = new Song();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method gather_art_item() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10. Open
public static function gather_art_item($type, $object_id, $db_art_first = false, $api = false): bool
{
// Should be more generic !
if ($type == 'video') {
$libitem = Video::create_from_id($object_id);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method process_action() has a Cyclomatic Complexity of 83. The configured cyclomatic complexity threshold is 10. Open
public static function process_action($action, $catalogs, $options = null): void
{
if (empty($options)) {
$options = array(
'gather_art' => false,
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method update_counts() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public static function update_counts(): void
{
$update_time = self::get_update_info('update_counts', -1);
$now_time = time();
// give the server a 30 min break for this help with load
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method get_user_filter() has a Cyclomatic Complexity of 53. The configured cyclomatic complexity threshold is 10. Open
public static function get_user_filter($type, $user_id): string
{
switch ($type) {
case "album":
case "song":
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method gather_art() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public function gather_art($songs = null, $videos = null): bool
{
// Make sure they've actually got methods
$art_order = AmpConfig::get('art_order');
$gather_song_art = AmpConfig::get('gather_song_art', false);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The class Catalog has a coupling between objects value of 59. Consider to reduce the number of dependencies under 13. Open
abstract class Catalog extends database_object
{
protected const DB_TABLENAME = 'catalog';
/**
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Avoid assigning values to variables in if clauses and the like (line '1668', column '13'). Open
public static function get_id_from_file($file_path, $media_type): int
{
$sql = "SELECT `id` FROM `$media_type` WHERE `file` = ?;";
$db_results = Dba::read($sql, array($file_path));
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method gather_art uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$searches['album'] = array();
$searches['artist'] = array();
if ($gather_song_art) {
$searches['song'] = array();
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '3571', column '23'). Open
public static function check_length($string, $max_length = 255): string
{
$string = (string)$string;
if (false !== $encoding = mb_detect_encoding($string, null, true)) {
$string = trim(mb_substr($string, 0, $max_length, $encoding));
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method get_server_counts uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sql = "SELECT `key`, `value` FROM `update_info`;";
$db_results = Dba::read($sql);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '713', column '13'). Open
public function get_info($object_id, $table_name = 'catalog'): array
{
$info = parent::get_info($object_id, $table_name);
$table = 'catalog_' . $this->get_type();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method has_access uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$params = array($catalog_id, $user_id);
$sql = "SELECT `catalog_id` FROM `catalog_filter_group_map` WHERE `catalog_id` = ? AND `enabled` = 1 AND `group_id` IN (SELECT `catalog_filter_group` FROM `user` WHERE `id` = ?);";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method gather_art_item uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
debug_event(__CLASS__, "gather_art_item $type: {{$object_id}} searching", 4);
global $dic;
$results = $dic->get(ArtCollectorInterface::class)->collect(
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method update_song_from_tags uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// always update the time when you update
Song::update_utime($song->id);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method gather_art_item uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
debug_event(__CLASS__, 'Image less than 5 chars, not inserting', 3);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method update_video_from_tags uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// always update the time when you update
Video::update_utime($video->id);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method check_length uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$string = trim(substr($string, 0, $max_length));
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method gather_art_item uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$className = ObjectTypeToClassNameMapper::map($type);
/** @var library_item $libitem */
$libitem = new $className($object_id);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method trim_prefix uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$prefix = null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method update_song_from_tags uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$new_song->license = null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method update_song_from_tags uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$tag_array[] = $tagName;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method update_mapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// 'album', 'album_disk', 'song', 'video', 'podcast', 'podcast_episode', 'live_stream'
$sql = "INSERT IGNORE INTO `catalog_map` (`catalog_id`, `object_type`, `object_id`) SELECT `$table`.`catalog`, '$table', `$table`.`id` FROM `$table` GROUP BY `$table`.`catalog`, '$table', `$table`.`id`;";
Dba::write($sql);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method gather_art uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$searches['video'] = $videos;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused private methods such as 'get_newest_podcasts_ids'. Open
private function get_newest_podcasts_ids(int $count): array
{
$results = array();
$sql = 'SELECT `podcast_episode`.`id` FROM `podcast_episode` INNER JOIN `podcast` ON `podcast`.`id` = `podcast_episode`.`podcast` WHERE `podcast`.`catalog` = ? ORDER BY `podcast_episode`.`pubdate` DESC';
- Read upRead up
- Exclude checks
UnusedPrivateMethod
Since: 0.2
Unused Private Method detects when a private method is declared but is unused.
Example
class Something
{
private function foo() {} // unused
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod
Avoid unused parameters such as '$media'. Open
public function getRemoteStreamingUrl($media): ?string
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
TODO found Open
// https://dev.mysql.com/doc/refman/5.0/en/select.html // TODO mysql8 test
- Exclude checks
TODO found Open
// https://dev.mysql.com/doc/refman/5.0/en/select.html // TODO mysql8 test
- Exclude checks
TODO found Open
// remote catalogs should unlink the temp files if needed //TODO add other types of remote catalog
- Exclude checks
FIXME found Open
* FIXME: This is an ugly mess, this really needs to be consolidated and cleaned up.
- Exclude checks
syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
Open
public int $id = 0;
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
foreach ($media_tables as $table) {
$enabled_sql = ($catalog_disable) ? " WHERE `$table`.`enabled` = '1'" : '';
$sql = "SELECT COUNT(`id`), IFNULL(SUM(`time`), 0), IFNULL(SUM(`size`)/1024/1024, 0) FROM `$table`" . $enabled_sql;
$db_results = Dba::read($sql);
$row = Dba::fetch_row($db_results);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 138.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
switch ($catalog->gather_types) {
case 'podcast':
$type = 'podcast_episode';
$file_ids = Catalog::get_ids_from_folder($clean_path, $type);
$className = Podcast_Episode::class;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 137.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function is_video_file(string $file): bool
{
$ignore_pattern = AmpConfig::get('catalog_ignore_pattern');
$ignore_check = !($ignore_pattern) || preg_match("/(" . $ignore_pattern . ")/i", $file) === 0;
$video_pattern = "/\.(" . AmpConfig::get('catalog_video_pattern') . ")$/i";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 96.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function is_playlist_file(string $file): bool
{
$ignore_pattern = AmpConfig::get('catalog_ignore_pattern');
$ignore_check = !($ignore_pattern) || preg_match("/(" . $ignore_pattern . ")/i", $file) === 0;
$playlist_pattern = "/\.(" . AmpConfig::get('catalog_playlist_pattern') . ")$/i";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 96.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $albumartist_mbid_array. Keep variable name length under 20. Open
$albumartist_mbid_array = $results['mb_albumartistid_array'] ?? array();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $is_upload_albumartist. Keep variable name length under 20. Open
$is_upload_albumartist = false;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $album_map_albumArtist. Keep variable name length under 20. Open
$album_map_albumArtist = $albumRepository->getArtistMap($new_song_album, 'album');
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The parameter $new_path is not named in camelCase. Open
abstract public function move_catalog_proc($new_path): bool;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
public int $id = 0;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The parameter $catalog_id is not named in camelCase. Open
public static function create_from_id($catalog_id): ?Catalog
{
$sql = 'SELECT `catalog_type` FROM `catalog` WHERE `id` = ?';
$db_results = Dba::read($sql, array($catalog_id));
$row = Dba::fetch_assoc($db_results);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_name is not named in camelCase. Open
public static function add_catalog_filter_group(string $filter_name, array $catalogs)
{
// Create the filter
Dba::write(
'INSERT INTO `catalog_filter_group` (`name`) VALUES (?)',
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function update_enabled($new_enabled, $catalog_id)
{
/* Check them Rights! */
if (!Access::check('interface', 75)) {
return false;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function get_stats($catalog_id = 0): array
{
$counts = ($catalog_id) ? self::count_catalog($catalog_id) : self::get_server_counts(0);
$counts = array_merge(self::getUserRepository()->getStatistics(), $counts);
$counts['tags'] = ($catalog_id) ? 0 : self::count_tags();
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $update_time is not named in camelCase. Open
public static function count_table(string $table, ?int $catalog_id = 0, ?int $update_time = 0): int
{
$sql = "SELECT COUNT(`id`) FROM `$table` ";
$params = array();
$where_sql = 'WHERE';
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $sort_pattern is not named in camelCase. Open
public static function update_media_from_tags(
$media,
$gather_types = array('music'),
$sort_pattern = '',
$rename_pattern = ''
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $podcast_episode is not named in camelCase. Open
public static function update_podcast_episode_from_tags($results, Podcast_Episode $podcast_episode): array
{
$sql = "UPDATE `podcast_episode` SET `file` = ?, `size` = ?, `time` = ?, `bitrate` = ?, `rate` = ?, `mode` = ?, `channels` = ?, `state` = 'completed' WHERE `id` = ?";
Dba::write($sql, array($podcast_episode->file, $results['size'], $results['time'], $results['bitrate'], $results['rate'], $results['mode'], $results['channels'], $podcast_episode->id));
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $gather_type is not named in camelCase. Open
public static function get_table_from_type($gather_type): string
{
switch ($gather_type) {
case 'clip':
case 'tvshow':
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_id is not named in camelCase. Open
protected static function getSongTags($type, $object_id): array
{
$tags = array();
$sql = ($type == 'artist')
? "SELECT `tag`.`name` FROM `tag` JOIN `tag_map` ON `tag`.`id` = `tag_map`.`tag_id` JOIN `song` ON `tag_map`.`object_id` = `song`.`id` WHERE `song`.`id` IN (SELECT `object_id` FROM `artist_map` WHERE `artist_id` = ? AND `object_type` = 'song') AND `tag_map`.`object_type` = 'song' GROUP BY `tag`.`id`, `tag`.`name`;"
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_id is not named in camelCase. Open
public static function filter_catalog_count(int $filter_id): int
{
$sql = "SELECT COUNT(1) AS `count` FROM `catalog_filter_group_map` WHERE `group_id` = ? AND `enabled` = 1";
$db_results = Dba::read($sql, array($filter_id));
$row = Dba::fetch_assoc($db_results);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function check_filter_catalog_enabled(int $filter_id, int $catalog_id): bool
{
$sql = "SELECT `enabled` FROM `catalog_filter_group_map` WHERE `group_id` = ? AND `catalog_id` = ? AND `enabled` = 1;";
$db_results = Dba::read($sql, array($filter_id, $catalog_id));
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $song_id is not named in camelCase. Open
protected static function updateArtistTags(int $song_id): void
{
foreach (Song::get_parent_array($song_id) as $artist_id) {
$tags = self::getSongTags('artist', $artist_id);
Tag::update_tag_list(implode(',', $tags), 'artist', $artist_id, true);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $sort_pattern is not named in camelCase. Open
public function sort_find_home($song, $sort_pattern, $base = null, $various_artist = "Various Artists", $windowsCompat = false): ?string
{
$home = '';
if ($base) {
$home = rtrim($base, "\/");
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $new_object_id is not named in camelCase. Open
public static function migrate($object_type, $old_object_id, $new_object_id, $song_id): bool
{
if ($old_object_id != $new_object_id) {
debug_event(__CLASS__, "migrate $song_id $object_type: {{$old_object_id}} to {{$new_object_id}}", 4);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $user_id is not named in camelCase. Open
public static function has_access($catalog_id, $user_id): bool
{
if ($catalog_id === null || !AmpConfig::get('catalog_filter')) {
return true;
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $user_id is not named in camelCase. Open
public static function get_server_counts($user_id): array
{
$results = self::SERVER_COUNTS;
if ($user_id > 0) {
$sql = "SELECT `key`, `value` FROM `user_data` WHERE `user` = ?;";
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $max_length is not named in camelCase. Open
public static function check_length($string, $max_length = 255): string
{
$string = (string)$string;
if (false !== $encoding = mb_detect_encoding($string, null, true)) {
$string = trim(mb_substr($string, 0, $max_length, $encoding));
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_id is not named in camelCase. Open
public static function edit_catalog_filter(int $filter_id, string $filter_name, array $catalogs): bool
{
// Modify the filter name
$results = array();
$sql = "UPDATE `catalog_filter_group` SET `name` = ? WHERE `id` = ?;";
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $table_name is not named in camelCase. Open
public function get_info($object_id, $table_name = 'catalog'): array
{
$info = parent::get_info($object_id, $table_name);
$table = 'catalog_' . $this->get_type();
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $gather_types is not named in camelCase. Open
public function get_media_tags($media, $gather_types, $sort_pattern, $rename_pattern): array
{
// Check for patterns
if (!$sort_pattern || !$rename_pattern) {
$sort_pattern = $this->sort_pattern;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $my_int is not named in camelCase. Open
public static function check_int($my_int, $max, $min): int
{
if ($my_int > $max) {
return $max;
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_type is not named in camelCase. Open
public static function get_catalogs($filter_type = '', $user_id = null, $query = false): array
{
$params = array();
$sql = "SELECT `id` FROM `catalog` ";
$join = 'WHERE';
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $rename_pattern is not named in camelCase. Open
public function get_media_tags($media, $gather_types, $sort_pattern, $rename_pattern): array
{
// Check for patterns
if (!$sort_pattern || !$rename_pattern) {
$sort_pattern = $this->sort_pattern;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $str_array is not named in camelCase. Open
public static function get_unique_string($str_array): string
{
$array = array_unique(array_map('trim', explode(';', $str_array)));
return implode($array);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function delete($catalog_id): bool
{
$params = array($catalog_id);
$catalog = self::create_from_id($catalog_id);
if (!$catalog) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function get_videos_count($catalog_id = 0, $type = ''): int
{
$sql = "SELECT COUNT(`video`.`id`) AS `video_cnt` FROM `video` ";
if (!empty($type)) {
$sql .= "JOIN `" . $type . "` ON `" . $type . "`.`id` = `video`.`id` ";
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $file_path is not named in camelCase. Open
public static function get_id_from_file($file_path, $media_type): int
{
$sql = "SELECT `id` FROM `$media_type` WHERE `file` = ?;";
$db_results = Dba::read($sql, array($file_path));
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $media_type is not named in camelCase. Open
public static function get_ids_from_folder($folder_path, $media_type): array
{
$objects = array();
$folder_path = Dba::escape($folder_path);
$media_type = Dba::escape($media_type);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $gather_types is not named in camelCase. Open
public static function update_media_from_tags(
$media,
$gather_types = array('music'),
$sort_pattern = '',
$rename_pattern = ''
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $various_artist is not named in camelCase. Open
public function sort_find_home($song, $sort_pattern, $base = null, $various_artist = "Various Artists", $windowsCompat = false): ?string
{
$home = '';
if ($base) {
$home = rtrim($base, "\/");
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function count_catalog($catalog_id): array
{
$catalog = self::create_from_id($catalog_id);
$results = array(
'items' => 0,
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $rename_pattern is not named in camelCase. Open
public static function update_media_from_tags(
$media,
$gather_types = array('music'),
$sort_pattern = '',
$rename_pattern = ''
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_id is not named in camelCase. Open
public static function update_map($catalog, $object_type, $object_id): void
{
debug_event(__CLASS__, "update_map $object_type: {{$object_id}}", 5);
if ($object_type == 'artist') {
// insert catalog_map artists
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function get_cache_path($object_id, $catalog_id, $path = '', $target = ''): ?string
{
// need a destination and target filetype
if (!is_dir($path) || empty($target)) {
return null;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function add_catalog_filter_group_map(int $catalog_id): void
{
$results = array();
$sql = "SELECT `id` FROM `catalog_filter_group` ORDER BY `id`";
$db_results = Dba::read($sql);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_id is not named in camelCase. Open
public static function reset_user_filter(int $filter_id): void
{
$sql = "UPDATE `user` SET `catalog_filter_group` = 0 WHERE `catalog_filter_group` = ?";
Dba::write($sql, array($filter_id));
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_id is not named in camelCase. Open
public static function gather_art_item($type, $object_id, $db_art_first = false, $api = false): bool
{
// Should be more generic !
if ($type == 'video') {
$libitem = Video::create_from_id($object_id);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_id is not named in camelCase. Open
public static function update_single_item($type, $object_id, $api = false): array
{
// Because single items are large numbers of things too
set_time_limit(0);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $new_object_id is not named in camelCase. Open
public static function migrate_map($object_type, $old_object_id, $new_object_id)
{
$sql = "UPDATE IGNORE `catalog_map` SET `object_id` = ? WHERE `object_type` = ? AND `object_id` = ?";
$params = array($new_object_id, $object_type, $old_object_id);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_id is not named in camelCase. Open
public static function filter_user_count(int $filter_id): int
{
$sql = "SELECT COUNT(1) AS `count` FROM `user` WHERE `catalog_filter_group` = ?";
$db_results = Dba::read($sql, array($filter_id));
$row = Dba::fetch_assoc($db_results);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function has_access($catalog_id, $user_id): bool
{
if ($catalog_id === null || !AmpConfig::get('catalog_filter')) {
return true;
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $new_enabled is not named in camelCase. Open
public static function update_enabled($new_enabled, $catalog_id)
{
/* Check them Rights! */
if (!Access::check('interface', 75)) {
return false;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $folder_path is not named in camelCase. Open
public static function get_ids_from_folder($folder_path, $media_type): array
{
$objects = array();
$folder_path = Dba::escape($folder_path);
$media_type = Dba::escape($media_type);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
private static function _update_item($field, $value, $catalog_id)
{
/* Can't update to blank */
if (!strlen(trim((string)$value))) {
return false;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_list is not named in camelCase. Open
public function update_from_external($object_list, $object_type): void
{
// Prevent the script from timing out
set_time_limit(0);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_type is not named in camelCase. Open
public function update_from_external($object_list, $object_type): void
{
// Prevent the script from timing out
set_time_limit(0);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $sort_pattern is not named in camelCase. Open
public function get_media_tags($media, $gather_types, $sort_pattern, $rename_pattern): array
{
// Check for patterns
if (!$sort_pattern || !$rename_pattern) {
$sort_pattern = $this->sort_pattern;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $old_object_id is not named in camelCase. Open
public static function migrate($object_type, $old_object_id, $new_object_id, $song_id): bool
{
if ($old_object_id != $new_object_id) {
debug_event(__CLASS__, "migrate $song_id $object_type: {{$old_object_id}} to {{$new_object_id}}", 4);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function getName(int $catalog_id): string
{
$sql = "SELECT `name` FROM `catalog` WHERE `id` = ?";
$db_results = Dba::read($sql, array($catalog_id));
$row = Dba::fetch_assoc($db_results);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_name is not named in camelCase. Open
public static function edit_catalog_filter(int $filter_id, string $filter_name, array $catalogs): bool
{
// Modify the filter name
$results = array();
$sql = "UPDATE `catalog_filter_group` SET `name` = ? WHERE `id` = ?;";
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $user_id is not named in camelCase. Open
public static function get_catalogs($filter_type = '', $user_id = null, $query = false): array
{
$params = array();
$sql = "SELECT `id` FROM `catalog` ";
$join = 'WHERE';
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $old_object_id is not named in camelCase. Open
public static function migrate_map($object_type, $old_object_id, $new_object_id)
{
$sql = "UPDATE IGNORE `catalog_map` SET `object_id` = ? WHERE `object_type` = ? AND `object_id` = ?";
$params = array($new_object_id, $object_type, $old_object_id);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_type is not named in camelCase. Open
public static function migrate($object_type, $old_object_id, $new_object_id, $song_id): bool
{
if ($old_object_id != $new_object_id) {
debug_event(__CLASS__, "migrate $song_id $object_type: {{$old_object_id}} to {{$new_object_id}}", 4);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_id is not named in camelCase. Open
public static function delete_catalog_filter(int $filter_id)
{
if ($filter_id > 0) {
$params = array($filter_id);
$sql = "DELETE FROM `catalog_filter_group` WHERE `id` = ?";
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $user_id is not named in camelCase. Open
public static function get_uploads_sql($type, $user_id = 0): string
{
$sql = '';
$column = ($type == 'song')
? 'user_upload'
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $db_art_first is not named in camelCase. Open
public static function gather_art_item($type, $object_id, $db_art_first = false, $api = false): bool
{
// Should be more generic !
if ($type == 'video') {
$libitem = Video::create_from_id($object_id);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_type is not named in camelCase. Open
public static function migrate_map($object_type, $old_object_id, $new_object_id)
{
$sql = "UPDATE IGNORE `catalog_map` SET `object_id` = ? WHERE `object_type` = ? AND `object_id` = ?";
$params = array($new_object_id, $object_type, $old_object_id);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $file_path is not named in camelCase. Open
abstract public function get_rel_path($file_path): string;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_name is not named in camelCase. Open
public static function filter_name_exists(string $filter_name, int $exclude_id = 0): bool
{
$params = array($filter_name);
$sql = "SELECT `id` FROM `catalog_filter_group` WHERE `name` = ?";
if ($exclude_id >= 0) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_id is not named in camelCase. Open
public function get_info($object_id, $table_name = 'catalog'): array
{
$info = parent::get_info($object_id, $table_name);
$table = 'catalog_' . $this->get_type();
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $user_id is not named in camelCase. Open
public static function get_update_info(string $key, int $user_id): int
{
$sql = ($user_id > 0)
? "SELECT `key`, `value` FROM `user_data` WHERE `key` = ? AND `user` = " . $user_id
: "SELECT `key`, `value` FROM `update_info` WHERE `key` = ?";
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $media_type is not named in camelCase. Open
public function get_gather_types($media_type = ''): array
{
$catalog_media_type = $this->gather_types;
if (empty($catalog_media_type)) {
$catalog_media_type = "music";
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $album_id is not named in camelCase. Open
protected static function updateAlbumArtistTags(int $album_id): void
{
foreach (Song::get_parent_array($album_id, 'album') as $artist_id) {
$tags = self::getSongTags('artist', $artist_id);
Tag::update_tag_list(implode(',', $tags), 'artist', $artist_id, true);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function create_catalog_type($type, $catalog_id = 0): ?Catalog
{
if (!$type) {
return null;
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $artist_list is not named in camelCase. Open
public function gather_artist_info($artist_list = array()): void
{
// Prevent the script from timing out
set_time_limit(0);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $user_id is not named in camelCase. Open
public static function can_remove($libitem, $user_id = 0): bool
{
if (!$user_id) {
$user = Core::get_global('user');
$user_id = $user->id ?? false;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $filter_id is not named in camelCase. Open
public static function check_filter_catalog_enabled(int $filter_id, int $catalog_id): bool
{
$sql = "SELECT `enabled` FROM `catalog_filter_group_map` WHERE `group_id` = ? AND `catalog_id` = ? AND `enabled` = 1;";
$db_results = Dba::read($sql, array($filter_id, $catalog_id));
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function get_enable_filter($type, $catalog_id): string
{
$sql = "";
if ($type == "song" || $type == "album" || $type == "artist" || $type == "album_artist") {
if ($type == "song") {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $user_id is not named in camelCase. Open
public static function get_user_filter($type, $user_id): string
{
switch ($type) {
case "album":
case "song":
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_type is not named in camelCase. Open
public static function update_map($catalog, $object_type, $object_id): void
{
debug_event(__CLASS__, "update_map $object_type: {{$object_id}}", 5);
if ($object_type == 'artist') {
// insert catalog_map artists
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $object_id is not named in camelCase. Open
public static function get_cache_path($object_id, $catalog_id, $path = '', $target = ''): ?string
{
// need a destination and target filetype
if (!is_dir($path) || empty($target)) {
return null;
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $song_id is not named in camelCase. Open
public static function migrate($object_type, $old_object_id, $new_object_id, $song_id): bool
{
if ($old_object_id != $new_object_id) {
debug_event(__CLASS__, "migrate $song_id $object_type: {{$old_object_id}} to {{$new_object_id}}", 4);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $exclude_id is not named in camelCase. Open
public static function filter_name_exists(string $filter_name, int $exclude_id = 0): bool
{
$params = array($filter_name);
$sql = "SELECT `id` FROM `catalog_filter_group` WHERE `name` = ?";
if ($exclude_id >= 0) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function count_table(string $table, ?int $catalog_id = 0, ?int $update_time = 0): int
{
$sql = "SELECT COUNT(`id`) FROM `$table` ";
$params = array();
$where_sql = 'WHERE';
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $media_type is not named in camelCase. Open
public static function get_id_from_file($file_path, $media_type): int
{
$sql = "SELECT `id` FROM `$media_type` WHERE `file` = ?;";
$db_results = Dba::read($sql, array($file_path));
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $catalog_id is not named in camelCase. Open
public static function get_children($name, $catalog_id = 0): array
{
$childrens = array();
$sql = "SELECT DISTINCT `artist`.`id` FROM `artist` ";
if ((int)$catalog_id > 0) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $media_type is not named in camelCase. Open
public static function update_catalog_map($media_type): void
{
if ($media_type == 'music') {
self::update_mapping('artist');
self::update_mapping('album');
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Method name "_create_filecache" should not be prefixed with an underscore to indicate visibility Open
protected function _create_filecache(): void
- Exclude checks
Property name "$_playlists" should not be prefixed with an underscore to indicate visibility Open
protected $_playlists = array();
- Exclude checks
Property name "$_filecache" should not be prefixed with an underscore to indicate visibility Open
protected $_filecache = array();
- Exclude checks
Method name "_update_item" should not be prefixed with an underscore to indicate visibility Open
private static function _update_item($field, $value, $catalog_id)
- Exclude checks