Showing 4,217 of 4,217 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($params['include_app']) {
$params['find_php'] && $files['app']['php'] = $this->_scan_files('app', 'php', $params);
$params['find_stpl'] && $files['app']['stpl'] = $this->_scan_files('app', 'stpl', $params);
$params['find_angular'] && $files['app']['ng'] = $this->_scan_files('app', 'ng', $params);
}
- 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 114.
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
if ($params['include_framework']) {
$params['find_php'] && $files['framework']['php'] = $this->_scan_files('framework', 'php', $params);
$params['find_stpl'] && $files['framework']['stpl'] = $this->_scan_files('framework', 'stpl', $params);
$params['find_angular'] && $files['framework']['ng'] = $this->_scan_files('framework', 'ng', $params);
}
- 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 114.
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
Method check_box
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function check_box($name = '', $value = '', $selected = '', $add_str = '', $extra = [])
{
if (is_array($name)) {
$extra = (array) $extra + $name;
$name = $extra['name'];
Method time_box2
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function time_box2($name, $selected = '', $add_str = '', $show_text = 1, $translate = 1)
{
if (is_array($selected)) {
$extra = (array) $extra + $name;
$name = $extra['name'];
Method time_box
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function time_box($selected = '', $name_postfix = '', $add_str = '', $show_text = 1, $translate = 1)
{
if (is_array($selected)) {
$extra = (array) $extra + $name;
$selected = $extra['selected'];
Method _on_validate_ok
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _on_validate_ok($params = [], $form)
{
$vars_db = $this->_parent->_get_all_vars_from_db();
$found_vars = $this->_parse_sources($params);
Method _currency_rates_load
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _currency_rates_load($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
Method payment
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function payment($options = null)
{
$_ = &$options;
$is_transaction = isset( $_['is_transaction'] ) ? $_['is_transaction'] : true;
$_['type_name'] = __FUNCTION__;
Method view_item
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function view_item()
{
if ( ! empty($_GET['id'])) {
$file_name = urldecode($_GET['id']);
$file_path = $file_name;
Method _form_options
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _form_options($options)
{
if ( ! $this->ENABLE) {
return null;
}
Method clone_item
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function clone_item($params = [])
{
if (is_string($params)) {
$params = [
'table' => $params,
Method _payout_status_handler
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _payout_status_handler($xml)
{
if ( ! $this->ENABLE) {
return null;
}
Method __api_response__success
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __api_response__success($operation_id, $response)
{
if ( ! $this->ENABLE) {
return null;
}
Method stars_select
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stars_select($name = '', $desc = '', $extra = [], $replace = [], $form)
{
if (is_array($desc)) {
$extra += $desc;
$desc = '';
Method truncate_database
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function truncate_database($db_name, $extra = [], &$error = false)
{
if ( ! strlen($db_name)) {
$error = 'db_name is empty';
return false;
Method add_foreign_key
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_foreign_key($table, $index_name = '', $fields = [], $ref_table = '', $ref_fields = [], $extra = [], &$error = false)
{
if (is_array($table)) {
$extra = (array) $extra + $table;
$table = '';
Method add_index
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_index($table, $index_name = '', $fields = [], $extra = [], &$error = false)
{
if (is_array($table)) {
$extra = (array) $extra + $table;
$table = '';
Method _check_if_need_to_cache
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check_if_need_to_cache()
{
// Fast implementation of disabling output caching for the current page
if (conf('no_output_cache')) {
$this->NO_NEED_TO_CACHE = true;
Method _get_available_widgets_hooks
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_available_widgets_hooks()
{
if (isset($this->_avail_widgets)) {
return $this->_avail_widgets;
}
Method _unaccent_test2
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _unaccent_test2($string = '')
{
$transliteration = [
'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A',
'Å' => 'A', 'Æ' => 'A', 'Ā' => 'A', 'Ą' => 'A', 'Ă' => 'A',