File CRUDBooster.php
has 1377 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace crocodicstudio\crudbooster\helpers;
use Cache;
CRUDBooster
has 73 functions (exceeds 20 allowed). Consider refactoring. Open
class CRUDBooster
{
/**
* Comma-delimited data output from the child table
*/
Method generateController
has 258 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function generateController($table, $name = null)
{
$exception = ['id', 'created_at', 'updated_at', 'deleted_at'];
$image_candidate = explode(',', config('crudbooster.IMAGE_FIELDS_CANDIDATE'));
Function generateController
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
public static function generateController($table, $name = null)
{
$exception = ['id', 'created_at', 'updated_at', 'deleted_at'];
$image_candidate = explode(',', config('crudbooster.IMAGE_FIELDS_CANDIDATE'));
- 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 sidebarMenu
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function sidebarMenu()
{
$menu_active = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".self::myPrivilegeId()."')")->where('parent_id', 0)->where('is_active', 1)->where('is_dashboard', 0)->orderby('sorting', 'asc')->select('cms_menus.*')->get();
foreach ($menu_active as &$menu) {
- 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 sidebarMenu
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sidebarMenu()
{
$menu_active = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".self::myPrivilegeId()."')")->where('parent_id', 0)->where('is_active', 1)->where('is_dashboard', 0)->orderby('sorting', 'asc')->select('cms_menus.*')->get();
foreach ($menu_active as &$menu) {
Function uploadFile
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null)
{
if (Request::hasFile($name)) {
if (! self::myId()) {
$userID = 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 sendEmail
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendEmail($config = [])
{
\Config::set('mail.driver', self::getSetting('smtp_driver'));
\Config::set('mail.host', self::getSetting('smtp_host'));
Function urlFilterColumn
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function urlFilterColumn($key, $type, $value = '', $singleSorting = true)
{
$params = Request::all();
$mainpath = trim(self::mainpath(), '/');
- 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 resizeImage
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function resizeImage($fullFilePath, $resize_width = null, $resize_height = null, $qty = 100, $thumbQty = 75)
{
$images_ext = config('crudbooster.IMAGE_EXTENSIONS', 'jpg,png,gif,bmp');
$images_ext = explode(',', $images_ext);
Method uploadFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null)
{
if (Request::hasFile($name)) {
if (! self::myId()) {
$userID = 0;
Method sendEmailQueue
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendEmailQueue($queue)
{
\Config::set('mail.driver', self::getSetting('smtp_driver'));
\Config::set('mail.host', self::getSetting('smtp_host'));
\Config::set('mail.port', self::getSetting('smtp_port'));
Function authAPI
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function authAPI()
{
$allowedUserAgent = config('crudbooster.API_USER_AGENT_ALLOWED');
$user_agent = Request::header('User-Agent');
$authorization = Request::header('Authorization');
- 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 getNameTable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getNameTable($columns)
{
$name_col_candidate = config('crudbooster.NAME_FIELDS_CANDIDATE');
$name_col_candidate = explode(',', $name_col_candidate);
$name_col = '';
- 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 resizeImage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function resizeImage($fullFilePath, $resize_width = null, $resize_height = null, $qty = 100, $thumbQty = 75)
{
$images_ext = config('crudbooster.IMAGE_EXTENSIONS', 'jpg,png,gif,bmp');
$images_ext = explode(',', $images_ext);
- 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 getUrlParameters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getUrlParameters($exception = null)
{
@$get = $_GET;
$inputhtml = '';
- 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 isForeignKey
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function isForeignKey($fieldName)
{
if (substr($fieldName, 0, 3) == 'id_') {
$table = substr($fieldName, 3);
} elseif (substr($fieldName, -3) == '_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
Method sendFCM
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendFCM($regID = [], $data)
{
if (! $data['title'] || ! $data['content']) {
return 'title , content null !';
}
Method timeAgo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function timeAgo($datetime_to, $datetime_from = null, $full = false)
{
$datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
$now = new \DateTime;
if ($datetime_from != '') {
Method authAPI
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function authAPI()
{
$allowedUserAgent = config('crudbooster.API_USER_AGENT_ALLOWED');
$user_agent = Request::header('User-Agent');
$authorization = Request::header('Authorization');
Method generateAPI
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function generateAPI($controller_name, $table_name, $permalink, $method_type = 'post')
{
$php = '
<?php namespace App\Http\Controllers;
Method routeController
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function routeController($prefix, $controller, $namespace = null)
{
$prefix = trim($prefix, '/').'/';
Function isCRUD
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isCRUD()
{
if (self::isSuperadmin()) {
return true;
}
- 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 routeController
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function routeController($prefix, $controller, $namespace = null)
{
$prefix = trim($prefix, '/').'/';
- 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 valid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function valid($arr = [], $type = 'json')
{
$input_arr = Request::all();
foreach ($arr as $a => $b) {
- 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 getModulePath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getModulePath()
{
// Check to position of admin_path
if(config("crudbooster.ADMIN_PATH")) {
$adminPathSegments = explode('/', Request::path());
- 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 uploadFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null)
Method resizeImage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static function resizeImage($fullFilePath, $resize_width = null, $resize_height = null, $qty = 100, $thumbQty = 75)
Method get
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function get($table, $string_conditions = null, $orderby = null, $limit = null, $skip = null)
Function sendEmail
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function sendEmail($config = [])
{
\Config::set('mail.driver', self::getSetting('smtp_driver'));
\Config::set('mail.host', self::getSetting('smtp_host'));
- 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 myPrivilege
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function myPrivilege()
{
$roles = Session::get('admin_privileges_roles');
if ($roles) {
foreach ($roles as $role) {
- 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 listTables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function listTables()
{
$tables = [];
$multiple_db = config('crudbooster.MULTIPLE_DATABASE_MODULE');
$multiple_db = ($multiple_db) ? $multiple_db : [];
- 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 timeAgo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function timeAgo($datetime_to, $datetime_from = null, $full = false)
{
$datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
$now = new \DateTime;
if ($datetime_from != '') {
- 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 uploadBase64
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function uploadBase64($value, $id = null)
{
if (! self::myId()) {
$userID = 0;
} else {
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
try {
switch ($menu->type) {
case 'Route':
$url = route($menu->path);
break;
- 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 130.
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
try {
switch ($c->type) {
case 'Route':
$url = route($c->path);
break;
- 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 130.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (substr($fieldName, 0, 3) == 'id_') {
$table = substr($fieldName, 3);
} elseif (substr($fieldName, -3) == '_id') {
$table = substr($fieldName, 0, (strlen($fieldName) - 3));
}
- 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 90.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (substr($fieldName, 0, 3) == 'id_') {
$table = substr($fieldName, 3);
} elseif (substr($fieldName, -3) == '_id') {
$table = substr($fieldName, 0, (strlen($fieldName) - 3));
}
- 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 90.
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