Issues (31)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/PhpPresentation/Shape/Group.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * This file is part of PHPPresentation - A pure PHP library for reading and writing
4
 * presentations documents.
5
 *
6
 * PHPPresentation 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/PHPPresentation/contributors.
12
 *
13
 * @link        https://github.com/PHPOffice/PHPPresentation
14
 * @copyright   2009-2015 PHPPresentation contributors
15
 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16
 */
17
18
namespace PhpOffice\PhpPresentation\Shape;
19
20
use PhpOffice\PhpPresentation\AbstractShape;
21
use PhpOffice\PhpPresentation\GeometryCalculator;
22
use PHPOffice\PhpPresentation\ShapeContainerInterface;
23
use PhpOffice\PhpPresentation\Shape\Drawing;
24
use PhpOffice\PhpPresentation\Shape\RichText;
25
use PhpOffice\PhpPresentation\Shape\Table;
26
27
class Group extends AbstractShape implements ShapeContainerInterface
28
{
29
    /**
30
    * Collection of shapes
31
    *
32
    * @var \ArrayObject|\PhpOffice\PhpPresentation\AbstractShape[]
33
    */
34
    private $shapeCollection = null;
35
36
    /**
37
    * Extent X
38
    *
39
    * @var int
40
    */
41
    protected $extentX;
42
43
    /**
44
    * Extent Y
45
    *
46
    * @var int
47
    */
48
    protected $extentY;
49
50 11
    public function __construct()
51
    {
52 11
        parent::__construct();
53
54
        // For logic purposes.
55 11
        $this->offsetX = null;
56 11
        $this->offsetY = null;
57
58
        // Shape collection
59 11
        $this->shapeCollection = new \ArrayObject();
60 11
    }
61
62
    /**
63
    * Get collection of shapes
64
    *
65
     * @return \ArrayObject|AbstractShape[]
66
    */
67 10
    public function getShapeCollection()
68
    {
69 10
        return $this->shapeCollection;
70
    }
71
72
    /**
73
     * Add shape to slide
74
     *
75
     * @param  \PhpOffice\PhpPresentation\AbstractShape $shape
76
     * @return \PhpOffice\PhpPresentation\AbstractShape
77
     * @throws \Exception
78
     */
79 9
    public function addShape(AbstractShape $shape)
80
    {
81 9
        $shape->setContainer($this);
82
83 9
        return $shape;
84
    }
85
86
    /**
87
    * Get X Offset
88
    *
89
    * @return int
90
    */
91 7
    public function getOffsetX()
92
    {
93 7
        if ($this->offsetX === null) {
94 7
            $offsets = GeometryCalculator::calculateOffsets($this);
95 7
            $this->offsetX = $offsets[GeometryCalculator::X];
96 7
            $this->offsetY = $offsets[GeometryCalculator::Y];
97
        }
98
99 7
        return $this->offsetX;
100
    }
101
102
    /**
103
    * Ignores setting the X Offset, preserving the default behavior.
104
    *
105
    * @param  int                 $pValue
106
    * @return $this
107
    */
108 1
    public function setOffsetX($pValue = 0)
109
    {
110 1
        return $this;
111
    }
112
113
    /**
114
    * Get Y Offset
115
    *
116
    * @return int
117
    */
118 7
    public function getOffsetY()
119
    {
120 7
        if ($this->offsetY === null) {
121 1
            $offsets = GeometryCalculator::calculateOffsets($this);
122 1
            $this->offsetX = $offsets[GeometryCalculator::X];
123 1
            $this->offsetY = $offsets[GeometryCalculator::Y];
124
        }
125
126 7
        return $this->offsetY;
127
    }
128
129
    /**
130
    * Ignores setting the Y Offset, preserving the default behavior.
131
    *
132
    * @param  int                 $pValue
133
    * @return $this
134
    */
135 1
    public function setOffsetY($pValue = 0)
136
    {
137 1
        return $this;
138
    }
139
140
    /**
141
    * Get X Extent
142
    *
143
    * @return int
144
    */
145 5
    public function getExtentX()
146
    {
147 5
        if ($this->extentX === null) {
148 5
            $extents = GeometryCalculator::calculateExtents($this);
149 5
            $this->extentX = $extents[GeometryCalculator::X] - $this->getOffsetX();
0 ignored issues
show
Documentation Bug introduced by
It seems like $extents[\PhpOffice\PhpP...] - $this->getOffsetX() can also be of type double. However, the property $extentX is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
150 5
            $this->extentY = $extents[GeometryCalculator::Y] - $this->getOffsetY();
0 ignored issues
show
Documentation Bug introduced by
It seems like $extents[\PhpOffice\PhpP...] - $this->getOffsetY() can also be of type double. However, the property $extentY is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
151
        }
152
153 5
        return $this->extentX;
154
    }
155
156
    /**
157
    * Get Y Extent
158
    *
159
    * @return int
160
    */
161 5
    public function getExtentY()
162
    {
163 5
        if ($this->extentY === null) {
164 1
            $extents = GeometryCalculator::calculateExtents($this);
165 1
            $this->extentX = $extents[GeometryCalculator::X] - $this->getOffsetX();
0 ignored issues
show
Documentation Bug introduced by
It seems like $extents[\PhpOffice\PhpP...] - $this->getOffsetX() can also be of type double. However, the property $extentX is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
166 1
            $this->extentY = $extents[GeometryCalculator::Y] - $this->getOffsetY();
0 ignored issues
show
Documentation Bug introduced by
It seems like $extents[\PhpOffice\PhpP...] - $this->getOffsetY() can also be of type double. However, the property $extentY is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
167
        }
168
169 5
        return $this->extentY;
170
    }
171
172
    /**
173
    * Ignores setting the width, preserving the default behavior.
174
    *
175
    * @param  int                 $pValue
176
    * @return $this
177
    */
178 1
    public function setWidth($pValue = 0)
179
    {
180 1
        return $this;
181
    }
182
183
    /**
184
    * Ignores setting the height, preserving the default behavior.
185
    *
186
    * @param  int                 $pValue
187
    * @return $this
188
    */
189 1
    public function setHeight($pValue = 0)
190
    {
191 1
        return $this;
192
    }
193
194
    /**
195
     * Create rich text shape
196
     *
197
     * @return \PhpOffice\PhpPresentation\Shape\RichText
198
     * @throws \Exception
199
     */
200 1
    public function createRichTextShape()
201
    {
202 1
        $shape = new RichText();
203 1
        $this->addShape($shape);
204
205 1
        return $shape;
206
    }
207
208
    /**
209
     * Create line shape
210
     *
211
     * @param  int $fromX Starting point x offset
212
     * @param  int $fromY Starting point y offset
213
     * @param  int $toX Ending point x offset
214
     * @param  int $toY Ending point y offset
215
     * @return \PhpOffice\PhpPresentation\Shape\Line
216
     * @throws \Exception
217
     */
218 1
    public function createLineShape($fromX, $fromY, $toX, $toY)
219
    {
220 1
        $shape = new Line($fromX, $fromY, $toX, $toY);
221 1
        $this->addShape($shape);
222
223 1
        return $shape;
224
    }
225
226
    /**
227
     * Create chart shape
228
     *
229
     * @return \PhpOffice\PhpPresentation\Shape\Chart
230
     * @throws \Exception
231
     */
232 1
    public function createChartShape()
233
    {
234 1
        $shape = new Chart();
235 1
        $this->addShape($shape);
236
237 1
        return $shape;
238
    }
239
240
    /**
241
     * Create drawing shape
242
     *
243
     * @return \PhpOffice\PhpPresentation\Shape\Drawing\File
244
     * @throws \Exception
245
     */
246 2
    public function createDrawingShape()
247
    {
248 2
        $shape = new Drawing\File();
249 2
        $this->addShape($shape);
250
251 2
        return $shape;
252
    }
253
254
    /**
255
     * Create table shape
256
     *
257
     * @param  int $columns Number of columns
258
     * @return \PhpOffice\PhpPresentation\Shape\Table
259
     * @throws \Exception
260
     */
261 1
    public function createTableShape($columns = 1)
262
    {
263 1
        $shape = new Table($columns);
264 1
        $this->addShape($shape);
265
266 1
        return $shape;
267
    }
268
}
269