GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

EPhpThumb::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
/**
3
 * This extension is a lightweight wrapper for phpthumb (http://phpthumb.gxdlabs.com/)
4
 * After creating a thumbnail object via Yii::app()->phpThumb->create("../images/image.jpg")
5
 * you can use any methods phpthumb provides (@link "https://github.com/masterexploder/PHPThumb/wiki/Basic-Usage")
6
 * inclusing method chaining.
7
 * To update the phpThumb library just put the complete phpThumb folder into "./lib"
8
 *
9
 * @license PHP Thumb is released under MIT license, so is this extension
10
 * @author Johannes "Haensel" Bauer <[email protected]>
11
 */
12 1
require_once(dirname(__FILE__).'/lib/phpThumb/src/ThumbLib.inc.php');
13 1
require_once(dirname(__FILE__).'/EThumbnail.php');
14
15
/**
16
 * This class creates thumbnail objects that can be used to manipulate images. Activate this component
17
 * by adding 
18
 * <p>'phpThumb'=>array('class'=>'ext.EPhpThumb.EPhpThumb')
19
 * <p>to your main config.
20
 * If you need to provide phpThumb specific options as described at 
21
 * <p>@link "https://github.com/masterexploder/PHPThumb/wiki/Getting-Started"
22
 * <p>use the "options" parameter of this component
23
 * <p>
24
 * @author Johannes "Haensel" Bauer <[email protected]>
25
 */
26
class EPhpThumb extends CComponent
27
{
28
    public $options=array();
29
    
30
    private static $_phpThumbOptions;
31
        
32 1
    public function init()
33
    {
34 1
        self::$_phpThumbOptions=$this->options;
35 1
    }
36
    
37
    /**
38
     * Creates a new EThumbnail object allowing to manipulate the image file provided via $filePath
39
     * @param string $filePath the image file path.
40
     * @return PhpThumb object
41
     */
42 1
    public function create($filePath)
43
    {
44 1
        return new EThumbnail(EPhpThumb::thumbFactory($filePath));
45
    }
46
        
47
    /**
48
     * Creates a new phpThumb object.
49
     * @param string $filePath the image file path.
50
     * @return PhpThumb object
51
     */
52 1
    protected static function thumbFactory($filePath)
53
    {
54
        try{
55 1
            return PhpThumbFactory::create($filePath,self::$_phpThumbOptions);
56
        }
57
        catch (Exception $e)
58
        {
59
            throw new CException($e->getMessage(),$e->getCode());
60
        }
61
    }
62
}
63
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
64