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