Completed
Push — master ( 8ca430...3024c9 )
by Michael
03:12
created

XtubeThumbsNails   C

Complexity

Total Complexity 66

Size/Duplication

Total Lines 399
Duplicated Lines 15.04 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 60
loc 399
rs 5.7474
wmc 66
lcom 1
cbo 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
C __construct() 0 31 7
A setUseThumbs() 0 4 1
A setImageType() 0 4 1
C createThumbnail() 0 57 16
A setImageName() 0 4 1
A setImagePath() 0 4 1
A setImgSavePath() 0 4 1
F resizeThumbnail() 60 143 26
B checkPaths() 0 11 5
A checkImage() 0 9 2
A checkGdLibrary() 0 12 3
A useThumbs() 0 8 2

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like XtubeThumbsNails often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use XtubeThumbsNails, and based on these observations, apply Extract Interface, too.

1
<?php
2
/**
3
 * Module: XoopsTube
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 *
9
 * PHP version 5
10
 *
11
 * @category        Module
12
 * @package         Xoopstube
13
 * @author          XOOPS Development Team
14
 * @copyright       2001-2013 The XOOPS Project
15
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
16
 * @version         $Id$
17
 * @link            http://sourceforge.net/projects/xoops/
18
 * @since           1.0.6
19
 */
20
21
if (!defined('_PATH')) {
22
    define("_PATH", XOOPS_ROOT_PATH);
23
}
24
25
if (!defined('DEFAULT_PATH')) {
26
    define('DEFAULT_PATH', XOOPS_UPLOAD_URL . '/blank.gif');
27
}
28
29
/**
30
 * Class XtubeThumbsNails
31
 */
32
class XtubeThumbsNails
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
33
{
34
    public $_imgName = 'blank.gif';
35
    public $_img_path = 'uploads';
36
    public $_img_savepath = 'thumbs';
37
38
    public $_source_path = '';
39
    public $_save_path = '';
40
    public $_source_url = '';
41
    public $_source_image = '';
42
    public $_save_image = '';
43
44
    public $_usethumbs = 0;
45
    public $_image_type = 'gd2';
46
    public $_return_fullpath = 0;
47
48
    public $img_width = 100;
49
    public $img_height = 100;
50
    public $img_quality = 100;
51
    public $img_update = 1;
52
    public $img_aspect = 1;
53
54
    // @access private
55
    public $_img_info = array();
56
57
    /**
58
     * Constructor
59
     *
60
     * @param null $img_name
61
     * @param null $img_path
62
     * @param null $img_savepath
63
     *
64
     * @internal param string $_imgName
65
     * @internal param string $_img_path
66
     * @internal param string $_img_savepath
67
     * @return \XtubeThumbsNails
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
68
     */
69
    public function __construct($img_name = null, $img_path = null, $img_savepath = null)
70
    {
71
        if (!preg_match("/\.(jpg|gif|png|jpeg)$/i", $img_name)) {
72
            return false;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
73
        }
74
75
        // The actual image we will be processing
76
        if (!is_null($img_name)) {
77
            $this->_imgName = strval(trim($img_name));
78
        }
79
80
        // The image path
81
        if (!is_null($img_path)) {
82
            $this->_img_path = strval(trim($img_path));
83
        }
84
85
        // The image save path
86
        if (!is_null($img_savepath)) {
87
            $this->_img_savepath = strval(trim($img_savepath));
88
        }
89
90
        $path_to_check = XOOPS_ROOT_PATH . "/$img_path/$img_savepath";
91
92
        if (!is_dir($path_to_check)) {
93
            if (false == mkdir("$path_to_check", 0777)) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
94
                return false;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
95
            }
96
        }
97
98
        return null;
99
    }
100
101
    /**
102
     * wfThumbsNails::setUseThumbs()
103
     *
104
     * @param integer $value
105
     *
106
     * @return void
107
     */
108
    public function setUseThumbs($value = 1)
109
    {
110
        $this->_usethumbs = $value;
111
    }
112
113
    /**
114
     * XtubeThumbsNails::setImageType()
115
     *
116
     * @param string $value
117
     *
118
     * @return void
119
     */
120
    public function setImageType($value = 'gd2')
121
    {
122
        $this->_image_type = $value;
123
    }
124
125
    /**
126
     * ThumbsNails::createThumbnail()
127
     *
128
     * @param int $img_width
0 ignored issues
show
Documentation introduced by
Should the type for parameter $img_width not be integer|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
129
     * @param int $img_height
0 ignored issues
show
Documentation introduced by
Should the type for parameter $img_height not be integer|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
130
     * @param int $img_quality
0 ignored issues
show
Documentation introduced by
Should the type for parameter $img_quality not be integer|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
131
     * @param int $img_update
0 ignored issues
show
Documentation introduced by
Should the type for parameter $img_update not be integer|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
132
     * @param int $img_aspect
0 ignored issues
show
Documentation introduced by
Should the type for parameter $img_aspect not be integer|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
133
     *
134
     * @return bool|string
135
     */
136
    public function createThumbnail(
137
        $img_width = null,
138
        $img_height = null,
139
        $img_quality = null,
140
        $img_update = null,
141
        $img_aspect = null
142
    ) {
143
        $this->_source_path  = XOOPS_ROOT_PATH . "/{$this->_img_path}";
144
        $this->_save_path    = XOOPS_ROOT_PATH . "/{$this->_img_path}/{$this->_img_savepath}";
145
        $this->_source_url   = XOOPS_URL . "/{$this->_img_path}";
146
        $this->_source_image = "{$this->_source_path}/{$this->_imgName}";
147
148
        if (isset($img_width) && !is_null($img_width)) {
149
            $this->img_width = intval($img_width);
150
        }
151
152
        if (isset($img_height) && !is_null($img_height)) {
153
            $this->img_height = intval($img_height);
154
        }
155
156
        if (isset($img_quality) && !is_null($img_quality)) {
157
            $this->img_quality = intval($img_quality);
158
        }
159
160
        if (isset($img_update) && !is_null($img_update)) {
161
            $this->img_update = intval($img_update);
162
        }
163
164
        if (isset($img_aspect) && !is_null($img_aspect)) {
165
            $this->img_aspect = intval($img_aspect);
166
        }
167
168
        // Return false if we are not using thumb nails
169
        if (!$this->useThumbs()) {
170
            return $this->_source_url . '/' . $this->_imgName;
171
        }
172
        // Return false if the server does not have gd lib installed or activated
173
        if (!$this->checkGdLibrary()) {
174
            return $this->_source_url . '/' . $this->_imgName;
175
        }
176
177
        // Return false if the paths to the file are wrong
178
        if (!$this->checkPaths()) {
179
            return DEFAULT_PATH;
180
        }
181
182
        if (!$this->checkImage()) {
183
            return DEFAULT_PATH;
184
        }
185
186
        $image = $this->resizeThumbnail();
187
        if ($image == false) {
188
            return DEFAULT_PATH;
189
        } else {
190
            return $image;
191
        }
192
    }
193
194
    /**
195
     * @param $value
196
     */
197
    public function setImageName($value)
198
    {
199
        $this->_imgName = strval(trim($value));
200
    }
201
202
    /**
203
     * @param $value
204
     */
205
    public function setImagePath($value)
206
    {
207
        $this->_img_path = strval(trim($value));
208
    }
209
210
    /**
211
     * @param $value
212
     */
213
    public function setImgSavePath($value)
214
    {
215
        $this->_img_savepath = strval(trim($value));
216
    }
217
218
    // ThumbsNails::resizeThumbnail()
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
219
    // @return
220
    /**
221
     * @return bool|string
222
     */
223
    public function resizeThumbnail()
224
    {
225
        global $xoopsModuleConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
226
227
        // Get image size and scale ratio
228
        $scale = min($this->img_width / $this->_img_info[0], $this->img_height / $this->_img_info[1]);
229
        // If the image is larger than the max shrink it
230
        $newWidth  = $this->img_width;
231
        $newHeight = $this->img_height;
232
        if ($scale < 1 && $this->img_aspect == 1) {
233
            $newWidth  = floor($scale * $this->_img_info[0]);
234
            $newHeight = floor($scale * $this->_img_info[1]);
235
        }
236
        $newWidth  = ($newWidth > $this->_img_info[0]) ? $this->_img_info[0] : $newWidth;
237
        $newHeight = ($newHeight > $this->_img_info[0]) ? $this->_img_info[0] : $newHeight;
238
239
        $savefile          = "{$newWidth}x{$newHeight}_{$this->_imgName}";
240
        $this->_save_image = "{$this->_save_path}/{$savefile}";
241
242
        if ($this->img_update == 0 && file_exists($this->_save_image)) {
243 View Code Duplication
            if ($this->_return_fullpath == 1) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
244
                return $this->_source_url . "/{$this->_img_savepath}/{$savefile}";
245
            } else {
246
                return "{$this->_img_savepath}/{$savefile}";
247
            }
248
        }
249
250
        switch ($this->_image_type) {
251
            case 'im':
252
                if (!empty($xoopsModuleConfig['path_magick']) && is_dir($xoopsModuleConfig['path_magick'])) {
253
                    if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) {
254
                        $cur_dir     = __DIR__;
255
                        $src_file_im = '"' . $cur_dir . '\\' . strtr($this->_source_image, '/', '\\') . '"';
0 ignored issues
show
Unused Code introduced by
$src_file_im is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
256
                        $new_file_im = '"' . $cur_dir . '\\' . strtr($this->_save_image, '/', '\\') . '"';
257
                    } else {
258
                        $src_file_im = escapeshellarg($this->_source_image);
0 ignored issues
show
Unused Code introduced by
$src_file_im is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
259
                        $new_file_im = escapeshellarg($this->_save_image);
260
                    }
261
                    $magick_command
262
                        = $xoopsModuleConfig['path_magick'] . '/convert -quality {$xoopsModuleConfig["imagequality"]} -antialias -sample {$newWidth}x{$newHeight} {$src_file_im} +profile "*" '
263
                        . str_replace('\\', '/', $new_file_im) . '';
264
                    passthru($magick_command);
265
266
                    return $this->_source_url . "/{$this->_img_savepath}/{$savefile}";
267
                } else {
268
                    return false;
269
                }
270
271
                break;
0 ignored issues
show
Unused Code introduced by
break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
272
273
            case 'gd1':
274
            case 'gd2':
275
            default :
0 ignored issues
show
Coding Style introduced by
There must be no space before the colon in a DEFAULT statement

As per the PSR-2 coding standard, there must not be a space in front of the colon in the default statement.

switch ($expr) {
    default : //wrong
        doSomething();
        break;
}

switch ($expr) {
    default: //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
Coding Style introduced by
The default body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a default statement must start on the line immediately following the statement.

switch ($expr) {
    default:
        doSomething(); //right
        break;
}


switch ($expr) {
    default:

        doSomething(); //wrong
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
276
277
                $imageCreateFunction = (function_exists('imagecreatetruecolor')
278
                    && $this->_image_type == 'gd2') ? 'imagecreatetruecolor' : 'imagecreate';
279
                $imageCopyfunction   = (function_exists('ImageCopyResampled')
280
                    && $this->_image_type == 'gd2') ? 'imagecopyresampled' : 'imagecopyresized';
281
282
                switch ($this->_img_info[2]) {
283 View Code Duplication
                    case 1:
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
284
                        // GIF image
285
                        $img     = (function_exists('imagecreatefromgif')) ? imagecreatefromgif(
286
                            $this->_source_image
287
                        ) : imageCreateFromPNG($this->_source_image);
288
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
289
                        $imageCopyfunction(
290
                            $tmp_img,
291
                            $img,
292
                            0,
293
                            0,
294
                            0,
295
                            0,
296
                            $newWidth,
297
                            $newHeight,
298
                            $this->_img_info[0],
299
                            $this->_img_info[1]
300
                        );
301
                        if (function_exists('imagegif')) {
302
                            imagegif($tmp_img, $this->_save_image);
303
                        } else {
304
                            imagePNG($tmp_img, $this->_save_image);
305
                        }
306
                        imagedestroy($tmp_img);
307
                        break;
308
309 View Code Duplication
                    case 2:
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
310
                        // echo $this->_save_image;
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
311
                        $img     = (function_exists('imagecreatefromjpeg')) ? imageCreateFromJPEG(
312
                            $this->_source_image
313
                        ) : imageCreateFromPNG($this->_source_image);
314
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
315
                        $imageCopyfunction(
316
                            $tmp_img,
317
                            $img,
318
                            0,
319
                            0,
320
                            0,
321
                            0,
322
                            $newWidth,
323
                            $newHeight,
324
                            $this->_img_info[0],
325
                            $this->_img_info[1]
326
                        );
327
                        if (function_exists('imagejpeg')) {
328
                            imageJPEG($tmp_img, $this->_save_image, $this->img_quality);
329
                        } else {
330
                            imagePNG($tmp_img, $this->_save_image);
331
                        }
332
                        imagedestroy($tmp_img);
333
                        break;
334
335
                    case 3:
336
                        // PNG image
337
                        $img     = imageCreateFromPNG($this->_source_image);
338
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
339
                        $imageCopyfunction(
340
                            $tmp_img,
341
                            $img,
342
                            0,
343
                            0,
344
                            0,
345
                            0,
346
                            $newWidth,
347
                            $newHeight,
348
                            $this->_img_info[0],
349
                            $this->_img_info[1]
350
                        );
351
                        imagePNG($tmp_img, $this->_save_image);
352
                        imagedestroy($tmp_img);
353
                        break;
354
                    default:
355
                        return false;
356
                }
357 View Code Duplication
                if ($this->_return_fullpath == 1) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
358
                    return $this->_source_url . "/{$this->_img_savepath}/{$savefile}";
359
                } else {
360
                    return "{$this->_img_savepath}/{$savefile}";
361
                }
362
                break;
0 ignored issues
show
Unused Code introduced by
break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
363
        }
364
//        return FALSE;
365
    }
366
367
    // ThumbsNails::checkPaths()
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
368
    // @return
369
    /**
370
     * @return bool
371
     */
372
    public function checkPaths()
373
    {
374
        if (file_exists($this->_source_image) || is_readable($this->_source_image)) {
375
            return true;
376
        }
377
        if (is_dir($this->_save_image) || is_writable($this->_save_image)) {
378
            return true;
379
        }
380
381
        return false;
382
    }
383
384
    /**
385
     * @return bool
386
     */
387
    public function checkImage()
388
    {
389
        $this->_img_info = getimagesize($this->_source_image, $imageinfo);
390
        if (null == $this->_img_info) {
391
            return false;
392
        }
393
394
        return true;
395
    }
396
397
    // wfsThumbs::checkGdLibrary()
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
398
    // Private function
399
    // @return false if gd lib not found on the system
400
    /**
401
     * @return array|bool
402
     */
403
    public function checkGdLibrary()
404
    {
405
        if (!extension_loaded('gd')) {
406
            return false;
407
        }
408
        $gdlib = (function_exists('gd_info'));
0 ignored issues
show
Unused Code introduced by
$gdlib is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
409
        if (false == $gdlib = gd_info()) {
410
            return false;
411
        }
412
413
        return $gdlib;
414
    }
415
416
    // ThumbsNails::useThumbs()
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
417
    //
418
    // @return
419
    /**
420
     * @return bool
421
     */
422
    public function useThumbs()
423
    {
424
        if ($this->_usethumbs) {
425
            return true;
426
        }
427
428
        return false;
429
    }
430
}
431