Completed
Push — master ( 1a99ba...eaae25 )
by Dominik
15s queued 12s
created

generateImage()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 54
Code Lines 39

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 39
nc 5
nop 0
dl 0
loc 54
rs 9.296
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Flynt\TimberDynamicResize;
4
5
use Flynt\Utils\TimberDynamicResize;
6
7
/**
8
 * Disable dynamic image generation and fall back
9
 * to regular timber resize functionality.
10
 */
11
// add_filter('Flynt/TimberDynamicResize/disableDynamic', '__return_true');
12
13
/**
14
 * Disable WebP generation
15
 */
16
// add_filter('Flynt/TimberDynamicResize/disableWebp', '__return_true');
17
18
/**
19
 * Set upload directory relative to web root.
20
 * If there are issues with image generation,
21
 * this filter most likely needs to be used.
22
 * Can be related to having a custom WordPress folder
23
 * structure or plugins that manipulate home_url.
24
 */
25
// add_filter('Flynt/TimberDynamicResize/relativeUploadDir', function () {
26
//     return '/app/uploads';
27
// });
28
29
new TimberDynamicResize();
30