File en.inc.php
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* JPGraph v4.0.3
*/
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
/**
* JPGraph v4.0.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 4149.
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
Line exceeds 120 characters; contains 139 characters Open
6023 => ['If you display both hour and minutes the hour interval must be 1 (Otherwise it doesn\'t make sense to display minutes).', 0],
- Exclude checks
Line exceeds 120 characters; contains 341 characters Open
12001 => ['You are using GD 2.x and are trying to use a background images on a non truecolor image. To use background images with GD 2.x it is necessary to enable truecolor by setting the USE_TRUECOLOR constant to TRUE. Due to a bug in GD 2.0.1 using any truetype fonts with truecolor images will result in very poor quality fonts.', 0],
- Exclude checks
Line exceeds 120 characters; contains 205 characters Open
25001 => ['This PHP installation is not configured with the GD library. Please recompile PHP with GD support to run JpGraph. (Neither function imagetypes() nor imagecreatefromstring() does exist)', 0],
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
6019 => ['The available width (%d) for minutes are to small for this scale to be displayed. Please use auto-sizing or increase the width of the graph.', 1],
- Exclude checks
Line exceeds 120 characters; contains 185 characters Open
15006 => ['PiePlot::SetSize() Radius for pie must either be specified as a fraction [0, 0.5] of the size of the image or as an absolute size in pixels in the range [10, 1000]', 0],
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
13 => ['The installed PHP version (%s) is not compatible with this release of the library. The library requires at least PHP version %s', 2],
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
6004 => ['Invalid format for Progress parameter at index=%d in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Progress)', 1],
- Exclude checks
Line exceeds 120 characters; contains 201 characters Open
11004 => ['Scale error for logarithmic scale. You have a problem with your data values. The max value must be greater than 0. It is mathematically impossible to have 0 in a logarithmic scale.', 0],
- Exclude checks
Line exceeds 120 characters; contains 219 characters Open
6007 => ['Sanity check for automatic Gantt chart size failed. Either the width (=%d) or height (=%d) is larger than MAX_GANTTIMG_SIZE. This could potentially be caused by a wrong date in one of the activities.', 2],
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
25005 => ['Can\'t access PHP_SELF, PHP global variable. You can\'t run PHP from command line if you want to use the \'auto\' naming of cache or image files.', 0],
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
6016 => ['Date string (%s) specified for Gantt activity can not be interpretated. Please make sure it is a valid time string, e.g. 2005-04-23 13:30', 1],
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
12002 => ['Incorrect file name for MGraph::SetBackgroundImage() : %s Must have a valid image extension (jpg,gif,png) when using auto detection of image type', 1],
- Exclude checks
Line exceeds 120 characters; contains 203 characters Open
25006 => ['Usage of FF_CHINESE (FF_BIG5) font family requires that your PHP setup has the iconv() function. By default this is not compiled into PHP (needs the "--width-iconv" when configured).', 0],
- Exclude checks
Line exceeds 120 characters; contains 183 characters Open
5004 => ['The (partial) country name %s does not have a corresponding flag image. The flag may still exist but under another name, e.g. instead of "usa" try "united states".', 1],
- Exclude checks
Line exceeds 120 characters; contains 179 characters Open
6003 => ['Invalid format for Constrain parameter at index=%d in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Constrain-To,Constrain-Type)', 1],
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
6018 => ['Interval for minutes must divide the hour evenly, e.g. 1,5,10,12,15,20,30 etc You have specified an interval of %d minutes.', 1],
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
6002 => ['You can\'t specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension.', 0],
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
14006 => ['Pie3D Internal Error: Z-Sorting algorithm for 3D Pies is not working properly (2). Trying to wrap twice while stroking.', 0],
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
12 => ['No path specified for TTF_DIR and path can not be determined automatically. Please specify TTF_DIR manually (in jpg-config.inc).', 0],
- Exclude checks
Line exceeds 120 characters; contains 163 characters Open
2012 => ['One of the objects submitted to AccBar is not a BarPlot. Make sure that you create the AccBar plot from an array of BarPlot objects. (Class=%s)', 1],
- Exclude checks
Line exceeds 120 characters; contains 867 characters Open
HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at line <b>%d</b>.</td></tr><tr><td><b>Explanation:</b><br>HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it\'s image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).<p>Most likely you have some text in your script before the call to <i>Graph::Stroke()</i>. If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser. <p>For example it is a common mistake to leave a blank line before the opening "<b><?php</b>".</td></tr></table>', 2],
- Exclude checks
Line exceeds 120 characters; contains 183 characters Open
2009 => ['One of the objects submitted to GroupBar is not a BarPlot. Make sure that you create the GroupBar plot from an array of BarPlot or AccBarPlot objects. (Class = %s)', 1],
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
6020 => ['Interval for hours must divide the day evenly, e.g. 0:30, 1:00, 1:30, 4:00 etc. You have specified an interval of %d', 1],
- Exclude checks
Line exceeds 120 characters; contains 263 characters Open
19002 => ['Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.', 0],
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
25002 => ['Your PHP installation does not seem to have the required GD library. Please see the PHP documentation on how to install and enable the GD library.', 0],
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
9001 => ['Value for image transformation out of bounds. Vanishing point on horizon must be specified as a value between 0 and 1.', 0],
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
12010 => ['Can\'t create or stream image to file %s Check that PHP has enough permission to write a file to the current directory.', 1],
- Exclude checks
Line exceeds 120 characters; contains 178 characters Open
25007 => ['You are trying to use the locale (%s) which your PHP installation does not support. Hint: Use \'\' to indicate the default locale for this geographic region.', 1],
- Exclude checks
Line exceeds 120 characters; contains 409 characters Open
25086 => ['You only seem to have GD 1.x installed. To enable Alphablending requires GD 2.x or higher. Please install GD or make sure the constant USE_GD2 is specified correctly to reflect your installation. By default it tries to auto detect what version of GD you have installed. On some very rare occasions it may falsely detect GD2 where only GD1 is installed. You must then set USE_GD2 to false.', 0],
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
25124 => ['The input data array must have consecutive values from position 0 and forward. The given y-array starts with empty values (NULL)', 0],
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
11005 => ['Specifying tick interval for a logarithmic scale is undefined. Remove any calls to SetTextLabelStart() or SetTextTickInterval() on the logarithmic scale.', 0],
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
25038 => ['Background image seems to be of different type (has different file extension) than specified imagetype. Specified: %s File: %s', 2],
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
25044 => ['Cannot use auto scaling since it is impossible to determine a valid min/max value of the Y-axis (only null values).', 0],
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
25072 => ['You have specified a max value with SetAutoMax() which is smaller than the minimum value used for the scale. This is not possible.', 0],
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
25108 => ['Can\'t stream image. This is most likely due to a faulty PHP/GD setup. Try to recompile PHP and use the built-in GD library that comes with PHP.', 0],
- Exclude checks
Line exceeds 120 characters; contains 200 characters Open
25093 => ['Can not read font file "%s" in call to Image::GetBBoxTTF. Please make sure that you have set a font before calling this method and that the font is installed in the TTF directory.', 1],
- Exclude checks
Line exceeds 120 characters; contains 341 characters Open
25017 => ['You are using GD 2.x and are trying to use a background images on a non truecolor image. To use background images with GD 2.x it is necessary to enable truecolor by setting the USE_TRUECOLOR constant to TRUE. Due to a bug in GD 2.0.1 using any truetype fonts with truecolor images will result in very poor quality fonts.', 0],
- Exclude checks
Line exceeds 120 characters; contains 180 characters Open
25130 => ['Too small plot area. (%d x %d). With the given image size and margins there is to little space left for the plot. Increase the plot size or reduce the margins.', 2],
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
22009 => ['You have specified the same direction twice, once with an angle and once with a compass direction (%f degrees)', 0],
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
26004 => ['PDF417: Can\'t encode given data with error level %d and %d columns since it results in too many symbols or more than 90 rows.', 2],
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
25018 => ['Incorrect file name for Graph::SetBackgroundImage() : "%s" Must have a valid image extension (jpg,gif,png) when using auto detection of image type', 1],
- Exclude checks
Line exceeds 120 characters; contains 181 characters Open
25035 => ['You have enabled clipping. Clipping is only supported for graphs at 0 or 90 degrees rotation. Please adjust you current angle (=%d degrees) or disable clipping.', 1],
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
25087 => ['This PHP build has not been configured with TTF support. You need to recompile your PHP installation with FreeType support.', 0],
- Exclude checks
Line exceeds 120 characters; contains 247 characters Open
25100 => ['Problem with color palette and your GD setup. Please disable anti-aliasing or use GD2 with true-color. If you have GD2 library installed please make sure that you have set the USE_GD2 constant to true and truecolor is enabled.', 0],
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
25128 => ['The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.', 0],
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
22001 => ['Total percentage for all windrose legs in a windrose plot can not exceed 100%% !\n(Current max is: %d)', 1],
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
25067 => ['Your manually specified scale and ticks is not correct. The scale seems to be too small to hold any of the specified tick marks.', 0],
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
25030 => ['Missing script name in call to StrokeCSIM(). You must specify the name of the actual image script as the first parameter to StrokeCSIM().', 0],
- Exclude checks
Line exceeds 120 characters; contains 278 characters Open
25074 => ['Internal error. The scale range is negative (%f) [for %s scale] This problem could potentially be caused by trying to use \"illegal\" values in the input data arrays (like trying to send in strings or only NULL values) which causes the auto scaling to fail.', 2],
- Exclude checks
Line exceeds 120 characters; contains 185 characters Open
25096 => ['Can\'t allocate any more colors in palette image. Image has already allocated maximum of %d colors and the palette is now full. Change to a truecolor image instead', 0],
- Exclude checks
Line exceeds 120 characters; contains 270 characters Open
25064 => ['Minor or major step size is 0. Check that you haven\'t got an accidental SetTextTicks(0) in your code. If this is not the case you might have stumbled upon a bug in JpGraph. Please report this and if possible include the data that caused the problem', 0],
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
25071 => ['You have specified a min value with SetAutoMin() which is larger than the maximum value used for the scale. This is not possible.', 0],
- Exclude checks
Line exceeds 120 characters; contains 276 characters Open
25109 => ['Your PHP (and GD-lib) installation does not appear to support any known graphic formats. You need to first make sure GD is compiled as a module to PHP. If you also want to use JPEG images you must get the JPEG library. Please see the PHP docs for details.', 0],
- Exclude checks
Line exceeds 120 characters; contains 272 characters Open
25046 => ['Specified TTF font family (id=%d) is unknown or does not exist. Please note that TTF fonts are not distributed with JpGraph for copyright reasons. You can find the MS TTF WEB-fonts (arial, courier etc) for download at http://corefonts.sourceforge.net/', 1],
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
22018 => ['You have specified data for the same compass direction twice, once with text and once with index (Index=%d)', 1],
- Exclude checks
Line exceeds 120 characters; contains 198 characters Open
26000 => ['PDF417: The PDF417 module requires that the PHP installation must support the function bcmod(). This is normally enabled at compile time. See documentation for more information.', 0],
- Exclude checks
Line exceeds 120 characters; contains 234 characters Open
25045 => ['Font families FF_HANDWRT and FF_BOOK are no longer available due to copyright problem with these fonts. Fonts can no longer be distributed with JpGraph. Please download fonts from http://corefonts.sourceforge.net/', 0],
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
25066 => ['When manually specifying tick positions and labels the number of labels must be the same as the number of specified ticks.', 0],
- Exclude checks
Line exceeds 120 characters; contains 225 characters Open
25070 => ['Either X or Y data arrays contains non-numeric values. Check that the data is really specified as numeric data and not as strings. It is an error to specify data for example as \'-2345.2\' (using quotes).', 0],
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
25085 => ['An image can not be created from the supplied string. It is either in a format not supported or the string is representing an corrupt image.', 0],
- Exclude checks
Line exceeds 120 characters; contains 261 characters Open
25127 => ['The library has been configured for automatic encoding conversion of Japanese fonts. This requires that PHP has the mb_convert_encoding() function. Your PHP installation lacks this function (PHP needs the "--enable-mbstring" when compiled).', 0],
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
25063 => ['Ticks::SetPrecision() is deprecated. Use Ticks::SetLabelFormat() (or Ticks::SetFormatCallback()) instead', 0],
- Exclude checks
Line exceeds 120 characters; contains 279 characters Open
25068 => ['A plot has an illegal scale. This could for example be that you are trying to use text auto scaling to draw a line plot with only one point or that the plot area is too small. It could also be that no input data value is numeric (perhaps only \'-\' or \'x\')', 0],
- Exclude checks
Line exceeds 120 characters; contains 200 characters Open
25500 => ['Multibyte strings must be enabled in the PHP installation in order to run the LED module so that the function mb_strlen() is available. See PHP documentation for more information.', 0],
- Exclude checks
Line exceeds 120 characters; contains 211 characters Open
22020 => ['Windrose plot is too large to fit the specified Graph size. Please use WindrosePlot::SetSize() to make the plot smaller or increase the size of the Graph in the initial WindroseGraph() call.', 0],
- Exclude checks
Line exceeds 120 characters; contains 458 characters Open
25092 => ['There is either a configuration problem with TrueType or a problem reading font file "%s" Make sure file exists and is in a readable place for the HTTP process. (If \'basedir\' restriction is enabled in PHP then the font file must be located in the document root.). It might also be a wrongly installed FreeType library. Try upgrading to at least FreeType 2.1.13 and recompile GD with the correct setup so it can find the new FT library.', 1],
- Exclude checks
Line exceeds 120 characters; contains 215 characters Open
25026 => ['Can\'t draw unspecified Y-scale. You have either: 1. Specified an Y axis for auto scaling but have not supplied any plots. 2. Specified a scale manually but have forgot to specify the tick steps', 0],
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
22013 => ['You have specified the look&feel for the same compass direction twice, once with text and once with index (Index=%d)', 1],
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
22019 => ['Index for direction must be between 0 and 15. You can\'t specify angles for a Regular Windplot, only index and compass directions.', 0],
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
29204 => ['Number of colors (%d) is invalid for this colormap. It must be a number that can be written as: %d + k*%d', 3],
- Exclude checks
Line exceeds 120 characters; contains 211 characters Open
25114 => ['PHP has not enough permissions to write to the cache file "%s". Please make sure that the user running PHP has write permission for this file if you wan to use the cache system with JpGraph.', 1],
- Exclude checks