Resource::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of PHPProject - A pure PHP library for reading and writing
4
 * presentations documents.
5
 *
6
 * PHPProject is free software distributed under the terms of the GNU Lesser
7
 * General Public License version 3 as published by the Free Software Foundation.
8
 *
9
 * For the full copyright and license information, please read the LICENSE
10
 * file that was distributed with this source code. For the full list of
11
 * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
12
 *
13
 * @link        https://github.com/PHPOffice/PHPProject
14
 * @copyright   2009-2014 PHPProject contributors
15
 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16
 */
17
18
namespace PhpOffice\PhpProject;
19
20
/**
21
 * PHPProject_Resource
22
 *
23
 * @category    PHPProject
24
 * @package        PHPProject
25
 * @copyright    Copyright (c) 2012 - 2012 PHPProject (https://github.com/PHPOffice/PHPProject)
26
 */
27
class Resource
28
{
29
    /**
30
     * Title
31
     * 
32
     * @var string
33
     */
34
    private $title;
35
    
36
    /**
37
     * Index
38
     * @var integer
39
     */
40
    private $index;
41
    
42
    /**
43
     * Index of Resource
44
     * @var integer
45
     */
46
    public static $lastIndex = 0;
47
    
48 11
    public function __construct()
49
    {
50 11
        $this->index = self::$lastIndex;
51 11
        self::$lastIndex++;
52 11
    }
53
    
54
    /**
55
     * Get title
56
     *
57
     * @return string
58
     */
59 4
    public function getTitle()
60
    {
61 4
        return $this->title;
62
    }
63
    
64
    /**
65
     * Set title
66
     *
67
     * @param string $pTitle Title of the resource
68
     * @return PHPProject_Resource
69
     */
70 6
    public function setTitle($pTitle)
71
    {
72 6
        $this->title = $pTitle;
73 6
        return $this;
74
    }
75
    
76
    /**
77
     * Get index
78
     *
79
     * @return index
80
     */
81 8
    public function getIndex()
82
    {
83 8
        return $this->index;
84
    }
85
    
86
    /**
87
     * Set index
88
     * @param integer $value
89
     */
90 5
    public function setIndex($value)
91
    {
92 5
        if (is_numeric($value)) {
93 5
            $this->index = (int)$value;
94 5
        }
95 5
        return $this;
96
    }
97
}
98