| Conditions | 8 |
| Paths | 20 |
| Total Lines | 55 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
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:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 61 | public function Stroke($aStrokeFileName = '') |
||
| 62 | { |
||
| 63 | if (null !== $this->texts) { |
||
| 64 | for ($i = 0; Configs::safe_count($this->texts) > $i; ++$i) { |
||
| 65 | $this->texts[$i]->Stroke($this->img); |
||
| 66 | } |
||
| 67 | } |
||
| 68 | |||
| 69 | if (null !== $this->iTables) { |
||
| 70 | for ($i = 0; Configs::safe_count($this->iTables) > $i; ++$i) { |
||
| 71 | $this->iTables[$i]->Stroke($this->img); |
||
| 72 | } |
||
| 73 | } |
||
| 74 | $this->StrokeTitles(); |
||
| 75 | |||
| 76 | // If the filename is the predefined value = '_csim_special_' |
||
| 77 | // we assume that the call to stroke only needs to do enough |
||
| 78 | // to correctly generate the CSIM maps. |
||
| 79 | // We use this variable to skip things we don't strictly need |
||
| 80 | // to do to generate the image map to improve performance |
||
| 81 | // a best we can. Therefor you will see a lot of tests !$_csim in the |
||
| 82 | // code below. |
||
| 83 | $_csim = (Configs::getConfig('_CSIM_SPECIALFILE') === $aStrokeFileName); |
||
| 84 | |||
| 85 | // We need to know if we have stroked the plot in the |
||
| 86 | // GetCSIMareas. Otherwise the CSIM hasn't been generated |
||
| 87 | // and in the case of GetCSIM called before stroke to generate |
||
| 88 | // CSIM without storing an image to disk GetCSIM must call Stroke. |
||
| 89 | $this->iHasStroked = true; |
||
| 90 | |||
| 91 | if (!$_csim) { |
||
| 92 | // Should we do any final image transformation |
||
| 93 | if ($this->iImgTrans) { |
||
| 94 | $imgTrans = new Image\ImgTrans($this->img->img); |
||
| 95 | $this->img->img = $imgTrans->Skew3D( |
||
| 96 | $this->iImgTransHorizon, |
||
| 97 | $this->iImgTransSkewDist, |
||
| 98 | $this->iImgTransDirection, |
||
| 99 | $this->iImgTransHighQ, |
||
| 100 | $this->iImgTransMinSize, |
||
| 101 | $this->iImgTransFillColor, |
||
| 102 | $this->iImgTransBorder |
||
| 103 | ); |
||
| 104 | } |
||
| 105 | |||
| 106 | // If the filename is given as the special Configs::getConfig('_IMG_HANDLER') |
||
| 107 | // then the image handler is returned and the image is NOT |
||
| 108 | // streamed back |
||
| 109 | if (Configs::getConfig('_IMG_HANDLER') === $aStrokeFileName) { |
||
| 110 | return $this->img->img; |
||
| 111 | } |
||
| 112 | // Finally stream the generated picture |
||
| 113 | $this->cache->PutAndStream($this->img, $this->cache_name, $this->inline, $aStrokeFileName); |
||
| 114 | |||
| 115 | return true; |
||
| 116 | } |
||
| 127 |