Complex classes like Geometry often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Geometry, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 40 | class Geometry implements ComponentInterface |
||
| 41 | { |
||
| 42 | |||
| 43 | const ALLOWED_PRIMITIVES = array( |
||
| 44 | 'box', |
||
| 45 | 'circle', |
||
| 46 | 'cone', |
||
| 47 | 'cylinder', |
||
| 48 | 'plane', |
||
| 49 | 'ring', |
||
| 50 | 'sphere', |
||
| 51 | 'torus', |
||
| 52 | 'torusKnot' |
||
| 53 | ); |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Properties based on primitive |
||
| 57 | */ |
||
| 58 | const P_COMMON_PROPS = array( |
||
| 59 | |||
| 60 | /* One of box, circle, cone, cylinder, plane, ring, sphere, torus, torusKnot. */ |
||
| 61 | 'primitive' => null, |
||
| 62 | |||
| 63 | /* The translate property translates the geometry. It is provided as a vec3. This is a useful short-hand for |
||
| 64 | * translating the geometry to effectively move its pivot point when running animations. */ |
||
| 65 | 'translate' => '0 0 0', |
||
| 66 | /* Transform geometry into a BufferGeometry to reduce memory usage at the cost of being harder to manipulate. */ |
||
| 67 | 'buffer' => true, |
||
| 68 | /* Disable retrieving the shared geometry object from the cache. */ |
||
| 69 | 'skipCache' => false |
||
| 70 | ); |
||
| 71 | |||
| 72 | /** |
||
| 73 | * The box primitive defines boxes (i.e., any quadilateral, not just cubes). |
||
| 74 | */ |
||
| 75 | const P_BOX = array( |
||
| 76 | /* Width (in meters) of the sides on the X axis. */ |
||
| 77 | 'width' => 1, |
||
| 78 | /* Height (in meters) of the sides on the Y axis. */ |
||
| 79 | 'height' => 1, |
||
| 80 | /* Depth (in meters) of the sides on the Z axis. */ |
||
| 81 | 'depth' => 1 |
||
| 82 | ); |
||
| 83 | |||
| 84 | /** |
||
| 85 | * The circle primitive defines two-dimensional circles, which can be complete circles or partial circles (like Pac-Man). |
||
| 86 | * Note that because it is flat, only a single side of the circle will be rendered if “side: double” is not specified on the material component. |
||
| 87 | */ |
||
| 88 | const P_CIRCLE = array( |
||
| 89 | /* Radius (in meters) of the circle. */ |
||
| 90 | 'radius' => 1, |
||
| 91 | /* Number of triangles to construct the circle, like pizza slices. A higher number of segments means the circle will be more round. */ |
||
| 92 | 'segments' => 32, |
||
| 93 | /* Start angle for first segment. Can be used to define a partial circle. */ |
||
| 94 | 'thetaStart' => 0, |
||
| 95 | /* The central angle (in degrees). Defaults to 360, which makes for a complete circle. */ |
||
| 96 | 'thetaLength' => 360 |
||
| 97 | ); |
||
| 98 | |||
| 99 | /** |
||
| 100 | * The cone primitive under the hood is a cylinder primitive with varying top and bottom radiuses. |
||
| 101 | */ |
||
| 102 | const P_CONE = array( |
||
| 103 | /* Height of the cone. */ |
||
| 104 | 'height' => 2, |
||
| 105 | /* Whether the ends of the cone are open (true) or capped ('false'). */ |
||
| 106 | 'openEnded' => 'false', |
||
| 107 | /* Radius of the bottom end of the cone. */ |
||
| 108 | 'radiusBottom' => 1, |
||
| 109 | /* Radius of the top end of the cone. */ |
||
| 110 | 'radiusTop' => 1, |
||
| 111 | /* Number of segmented faces around the circumference of the cone. */ |
||
| 112 | 'segmentsRadial' => 36, |
||
| 113 | /* Number of rows of faces along the height of the cone. */ |
||
| 114 | 'segmentsHeight' => 18, |
||
| 115 | /* Starting angle in degrees. */ |
||
| 116 | 'thetaStart' => 0, |
||
| 117 | /* Central angle in degrees. */ |
||
| 118 | 'thetaLength' => 360 |
||
| 119 | ); |
||
| 120 | |||
| 121 | /** |
||
| 122 | * The cylinder primitive can define cylinders in the traditional sense like a Coca-Cola™ can, |
||
| 123 | * but it can also define shapes such as tubes and curved surfaces. |
||
| 124 | * We’ll go over some of these cylinder recipes below. |
||
| 125 | * 1. Traditional cylinders can be defined by using only a height and a radius: |
||
| 126 | * 2. Tubes can be defined by making the cylinder open-ended, which removes the top and bottom surfaces of the cylinder such that the inside is visible. |
||
| 127 | * A double-sided material will be needed to render properly: |
||
| 128 | * 3. Curved surfaces can be defined by specifying the angle via thetaLength such that the cylinder doesn’t curve all the way around, |
||
| 129 | * making the cylinder open-ended, and then making the material double-sided. |
||
| 130 | * 4. Other types of prisms can be defined by varying the number of radial segments (i.e., sides). For example, to make a hexagonal prism: |
||
| 131 | */ |
||
| 132 | const P_CYLINDER = array( |
||
| 133 | /* Radius of the cylinder. */ |
||
| 134 | 'height' => 3, |
||
| 135 | /* Height of the cylinder. */ |
||
| 136 | 'radius' => 2, |
||
| 137 | /* Number of segmented faces around the circumference of the cylinder. */ |
||
| 138 | 'segmentsRadial' => 36, |
||
| 139 | /* Number of rows of faces along the height of the cylinder. */ |
||
| 140 | 'segmentsHeight' => 18, |
||
| 141 | /* Whether the ends of the cylinder are open (true) or capped ('false'). */ |
||
| 142 | 'openEnded' => 'false', |
||
| 143 | /* Starting angle in degrees. */ |
||
| 144 | 'thetaStart' => 0, |
||
| 145 | /* Central angle in degrees. */ |
||
| 146 | 'thetaLength' => 360 |
||
| 147 | ); |
||
| 148 | |||
| 149 | /** |
||
| 150 | * The plane primitive defines a flat surface. |
||
| 151 | * Note that because it is flat, |
||
| 152 | * only a single side of the plane will be rendered if side: double is not specified on the material component. |
||
| 153 | */ |
||
| 154 | const P_PLANE = array( |
||
| 155 | /* Width along the X axis. */ |
||
| 156 | 'width' => 1, |
||
| 157 | /* Height along the Y axis. */ |
||
| 158 | 'height' => 1 |
||
| 159 | ); |
||
| 160 | |||
| 161 | /** |
||
| 162 | * The ring geometry defines a flat ring, like a CD. |
||
| 163 | * Note that because it is flat, |
||
| 164 | * only a single side of the ring will be rendered if side: double is not specified on the material component. |
||
| 165 | */ |
||
| 166 | const P_RING = array( |
||
| 167 | /* Radius of the inner hole of the ring. */ |
||
| 168 | 'radiusInner' => 1, |
||
| 169 | /* Radius of the outer edge of the ring. */ |
||
| 170 | 'radiusOuter' => 1, |
||
| 171 | /* Number of segments. A higher number means the ring will be more round */ |
||
| 172 | 'segmentsTheta' => 32, |
||
| 173 | /* Number of triangles within each face defined by segmentsTheta. */ |
||
| 174 | 'segmentsPhi' => 8, |
||
| 175 | /* Starting angle in degrees. */ |
||
| 176 | 'thetaStart' => 0, |
||
| 177 | /* Central angle in degrees. */ |
||
| 178 | 'thetaLength' => 360 |
||
| 179 | ); |
||
| 180 | |||
| 181 | /** |
||
| 182 | * The sphere primitive can define spheres in the traditional sense like a basketball. |
||
| 183 | * |
||
| 184 | * But it can also define various polyhedrons and abstract shapes given that it can specify |
||
| 185 | * the number of horizontal and vertical angles and faces. |
||
| 186 | * |
||
| 187 | * Sticking with a basic sphere, the default number of segments is high enough to make the sphere appear round. |
||
| 188 | */ |
||
| 189 | const P_SPHERE = array( |
||
| 190 | /* Radius of the sphere. */ |
||
| 191 | 'radius' => 1, |
||
| 192 | /* Number of horizontal segments. */ |
||
| 193 | 'segmentsWidth' => 18, |
||
| 194 | /* Number of vertical segments. */ |
||
| 195 | 'segmentsHeight' => 36, |
||
| 196 | /* Horizontal starting angle. */ |
||
| 197 | 'phiStart' => 0, |
||
| 198 | /* Horizontal sweep angle size. */ |
||
| 199 | 'phiLength' => 360, |
||
| 200 | /* Vertical starting angle. */ |
||
| 201 | 'thetaStart' => 0, |
||
| 202 | /* Vertical sweep angle size. */ |
||
| 203 | 'thetaLength' => 360 |
||
| 204 | ); |
||
| 205 | |||
| 206 | /** |
||
| 207 | * The torus primitive defines a donut shape. |
||
| 208 | */ |
||
| 209 | const P_TORUS = array( |
||
| 210 | /* Radius of the outer edge of the torus. */ |
||
| 211 | 'radius' => 1, |
||
| 212 | /* Radius of the tube. */ |
||
| 213 | 'radiusTubular' => 0.2, |
||
| 214 | /* Number of segments along the circumference of the tube ends. A higher number means the tube will be more round. */ |
||
| 215 | 'segmentsRadial' => 36, |
||
| 216 | /* Number of segments along the circumference of the tube face. A higher number means the tube will be more round. */ |
||
| 217 | 'segmentsTubular' => 32, |
||
| 218 | /* Central angle. */ |
||
| 219 | 'arc' => 360 |
||
| 220 | ); |
||
| 221 | |||
| 222 | /** |
||
| 223 | * The torus knot primitive defines a pretzel shape, the particular shape of which is defined by a pair of coprime integers, |
||
| 224 | * p and q. |
||
| 225 | * If p and q are not coprime the result will be a torus link. |
||
| 226 | */ |
||
| 227 | const P_TORUS_KNOT = array( |
||
| 228 | /* Radius that contains the torus knot. */ |
||
| 229 | 'radius' => 1, |
||
| 230 | /* Radius of the tubes of the torus knot. */ |
||
| 231 | 'radiusTubular' => 0.2, |
||
| 232 | /* Number of segments along the circumference of the tube ends. A higher number means the tube will be more round. */ |
||
| 233 | 'segmentsRadial' => 36, |
||
| 234 | /* Number of segments along the circumference of the tube face. A higher number means the tube will be more round. */ |
||
| 235 | 'segmentsTubular' => 32, |
||
| 236 | /* Number that helps define the pretzel shape. */ |
||
| 237 | 'p' => 2, |
||
| 238 | /* Number that helps define the pretzel shape. */ |
||
| 239 | 'q' => 3 |
||
| 240 | ); |
||
| 241 | |||
| 242 | /* DOM atrributes */ |
||
| 243 | protected $primitive; |
||
| 244 | |||
| 245 | /** |
||
| 246 | * Width |
||
| 247 | * |
||
| 248 | * BOX: Width (in meters) of the sides on the X axis. |
||
| 249 | * PLANE: Width along the X axis. |
||
| 250 | * |
||
| 251 | * @var float |
||
| 252 | */ |
||
| 253 | protected $width; |
||
| 254 | |||
| 255 | /** |
||
| 256 | * Height |
||
| 257 | * |
||
| 258 | * BOX: Height (in meters) of the sides on the Y axis. |
||
| 259 | * CONE: Height of the cone. |
||
| 260 | * CYLINDER: Height of the cylinder. |
||
| 261 | * PLANE: Height along the Y axis. |
||
| 262 | * |
||
| 263 | * @var float $height |
||
| 264 | */ |
||
| 265 | protected $height; |
||
| 266 | |||
| 267 | /** |
||
| 268 | * Depth |
||
| 269 | * |
||
| 270 | * BOX: Depth (in meters) of the sides on the Z axis. |
||
| 271 | * |
||
| 272 | * @var float $depth |
||
| 273 | */ |
||
| 274 | protected $depth; |
||
| 275 | |||
| 276 | /** |
||
| 277 | * Segments |
||
| 278 | * |
||
| 279 | * CIRCLE: Number of triangles to construct the circle, like pizza slices. |
||
| 280 | * A higher number of segments means the circle will be more round. |
||
| 281 | * |
||
| 282 | * @var int $segments |
||
| 283 | */ |
||
| 284 | protected $segments; |
||
| 285 | |||
| 286 | /** |
||
| 287 | * Start angle for first segmen |
||
| 288 | * |
||
| 289 | * CIRCLE: Start angle for first segment. Can be used to define a partial circle. |
||
| 290 | * CONE: Starting angle in degrees. |
||
| 291 | * CYLINDER: Starting angle in degrees. |
||
| 292 | * RING: Starting angle in degrees. |
||
| 293 | * SPHERE: Vertical starting angle. |
||
| 294 | * |
||
| 295 | * @var float $thetaStart; |
||
| 296 | */ |
||
| 297 | protected $thetaStart; |
||
| 298 | |||
| 299 | /** |
||
| 300 | * The central angle (in degrees). |
||
| 301 | * |
||
| 302 | * CIRCLE: Defaults to 360, which makes for a complete circle. |
||
| 303 | * CONE: Central angle in degrees. |
||
| 304 | * CYLINDER: Central angle in degrees. |
||
| 305 | * RING: Central angle in degrees. |
||
| 306 | * SPHERE: Vertical sweep angle size. |
||
| 307 | * |
||
| 308 | * @var float $thetaLength |
||
| 309 | */ |
||
| 310 | protected $thetaLength; |
||
| 311 | |||
| 312 | /** |
||
| 313 | * openEnded |
||
| 314 | * |
||
| 315 | * CONE: Whether the ends of the cone are open (true) or capped (false). |
||
| 316 | * CYLINDER: Whether the ends of the cylinder are open (true) or capped (false). |
||
| 317 | * |
||
| 318 | * @var string $openEnded |
||
| 319 | */ |
||
| 320 | protected $openEnded; |
||
| 321 | |||
| 322 | /** |
||
| 323 | * segmentsRadial |
||
| 324 | * |
||
| 325 | * CONE: Number of segmented faces around the circumference of the cone. |
||
| 326 | * CYLINDER: Number of segmented faces around the circumference of the cylinder. |
||
| 327 | * TORUS: Number of segments along the circumference of the tube ends. |
||
| 328 | * A higher number means the tube will be more round. |
||
| 329 | * |
||
| 330 | * @var int $segmentsRadial |
||
| 331 | */ |
||
| 332 | protected $segmentsRadial; |
||
| 333 | |||
| 334 | /** |
||
| 335 | * segmentsHeight |
||
| 336 | * |
||
| 337 | * CONE: Number of rows of faces along the height of the cone. |
||
| 338 | * CYLINDER: Number of rows of faces along the height of the cylinder. |
||
| 339 | * SPHERE: Number of vertical segments. |
||
| 340 | * |
||
| 341 | * @var int $segmentsHeight |
||
| 342 | */ |
||
| 343 | protected $segmentsHeight; |
||
| 344 | |||
| 345 | /** |
||
| 346 | * segmentsWidth |
||
| 347 | * |
||
| 348 | * SPHERE: Number of horizontal segments. |
||
| 349 | * |
||
| 350 | * @var int $segmentsWidth |
||
| 351 | */ |
||
| 352 | protected $segmentsWidth; |
||
| 353 | |||
| 354 | /** |
||
| 355 | * segmentsTheta |
||
| 356 | * |
||
| 357 | * RING: Number of segments. A higher number means the ring will be more round. |
||
| 358 | * |
||
| 359 | * @var int $segmentsTheta |
||
| 360 | */ |
||
| 361 | protected $segmentsTheta; |
||
| 362 | |||
| 363 | /** |
||
| 364 | * segmentsPhi |
||
| 365 | * |
||
| 366 | * RING: Number of triangles within each face defined by segmentsTheta. |
||
| 367 | * |
||
| 368 | * @var int $segmentsPhi |
||
| 369 | */ |
||
| 370 | protected $segmentsPhi; |
||
| 371 | |||
| 372 | /** |
||
| 373 | * segmentsTubular |
||
| 374 | * |
||
| 375 | * TORUS: Number of segments along the circumference of the tube face. |
||
| 376 | * A higher number means the tube will be more round. |
||
| 377 | * |
||
| 378 | * @var int $segmentsTubular |
||
| 379 | */ |
||
| 380 | protected $segmentsTubular; |
||
| 381 | |||
| 382 | /** |
||
| 383 | * phiStart |
||
| 384 | * |
||
| 385 | * SPHERE: Horizontal starting angle. |
||
| 386 | * |
||
| 387 | * @var float $phiStart |
||
| 388 | */ |
||
| 389 | protected $phiStart; |
||
| 390 | |||
| 391 | /** |
||
| 392 | * phiLength |
||
| 393 | * |
||
| 394 | * SPHERE: Horizontal sweep angle size. |
||
| 395 | * |
||
| 396 | * @var float $phiLength |
||
| 397 | */ |
||
| 398 | protected $phiLength; |
||
| 399 | |||
| 400 | /** |
||
| 401 | * Radius |
||
| 402 | * |
||
| 403 | * CIRCLE: Radius (in meters) of the circle. |
||
| 404 | * CYLINDER: Radius of the cylinder. |
||
| 405 | * SPHERE: Radius of the sphere. |
||
| 406 | * TORUS: Radius of the outer edge of the torus. |
||
| 407 | * |
||
| 408 | * @var float $radius |
||
| 409 | */ |
||
| 410 | protected $radius; |
||
| 411 | |||
| 412 | /** |
||
| 413 | * radiusTubular |
||
| 414 | * |
||
| 415 | * TORUS: Radius of the tube. |
||
| 416 | * |
||
| 417 | * @var float $radiusTubular |
||
| 418 | */ |
||
| 419 | protected $radiusTubular; |
||
| 420 | |||
| 421 | /** |
||
| 422 | * radiusTop |
||
| 423 | * |
||
| 424 | * CONE: Radius of the top end of the cone. |
||
| 425 | * |
||
| 426 | * @var float $radiusTop |
||
| 427 | */ |
||
| 428 | protected $radiusTop; |
||
| 429 | |||
| 430 | /** |
||
| 431 | * radiusBottom; |
||
| 432 | * |
||
| 433 | * CONE: Radius of the bottom end of the cone. |
||
| 434 | * |
||
| 435 | * @var float |
||
| 436 | */ |
||
| 437 | protected $radiusBottom; |
||
| 438 | |||
| 439 | /** |
||
| 440 | * radiusInner |
||
| 441 | * |
||
| 442 | * RING: Radius of the inner hole of the ring. |
||
| 443 | * |
||
| 444 | * @var float $radiusInner |
||
| 445 | */ |
||
| 446 | protected $radiusInner; |
||
| 447 | |||
| 448 | /** |
||
| 449 | * radiusOuter |
||
| 450 | * |
||
| 451 | * RING: Radius of the outer edge of the ring. |
||
| 452 | * |
||
| 453 | * @var float $radiusOuter |
||
| 454 | */ |
||
| 455 | protected $radiusOuter; |
||
| 456 | |||
| 457 | /** |
||
| 458 | * arc |
||
| 459 | * |
||
| 460 | * TORUS: Central angle. |
||
| 461 | * |
||
| 462 | * @var float $arc |
||
| 463 | */ |
||
| 464 | protected $arc; |
||
| 465 | |||
| 466 | /** |
||
| 467 | * p |
||
| 468 | * |
||
| 469 | * TORUSKNOT: Number that helps define the pretzel shape. |
||
| 470 | * |
||
| 471 | * @var int $p |
||
| 472 | */ |
||
| 473 | protected $p; |
||
| 474 | |||
| 475 | /** |
||
| 476 | * q |
||
| 477 | * |
||
| 478 | * TORUSKNOT: Number that helps define the pretzel shape. |
||
| 479 | * |
||
| 480 | * @var unknown |
||
| 481 | */ |
||
| 482 | protected $q; |
||
| 483 | |||
| 484 | /** |
||
| 485 | * Translates the geometry relative to its pivot point. |
||
| 486 | * |
||
| 487 | * @var string |
||
| 488 | */ |
||
| 489 | protected $translate = '0 0 0'; |
||
| 490 | |||
| 491 | /** |
||
| 492 | * Magic Call |
||
| 493 | * |
||
| 494 | * @param string $method |
||
| 495 | * @param array $args |
||
| 496 | * @throws InvalidComponentMethodException |
||
| 497 | */ |
||
| 498 | 34 | public function __call($method, $args) |
|
| 509 | |||
| 510 | /** |
||
| 511 | * Get Component scripts |
||
| 512 | * |
||
| 513 | * {@inheritdoc} |
||
| 514 | * |
||
| 515 | * @return array |
||
| 516 | */ |
||
| 517 | 1 | public function getScripts(): array |
|
| 521 | |||
| 522 | /** |
||
| 523 | * Does component have DOM Atributes |
||
| 524 | * |
||
| 525 | * {@inheritdoc} |
||
| 526 | * |
||
| 527 | * @return bool |
||
| 528 | */ |
||
| 529 | 1 | public function hasDOMAttributes(): bool |
|
| 533 | |||
| 534 | /** |
||
| 535 | * Remove default DOMElement Attributes which are not required |
||
| 536 | * |
||
| 537 | * @return void |
||
| 538 | */ |
||
| 539 | 1 | public function removeDefaultDOMAttributes() |
|
| 547 | |||
| 548 | /** |
||
| 549 | * Get DOMAttr for the entity |
||
| 550 | * |
||
| 551 | * @return DOMAttr |
||
| 552 | */ |
||
| 553 | 1 | public function getDOMAttributes(): DOMAttr |
|
| 558 | |||
| 559 | /** |
||
| 560 | * Set primitive |
||
| 561 | * |
||
| 562 | * One of box, circle, cone, cylinder, plane, ring, sphere, torus, torusKnot. |
||
| 563 | * |
||
| 564 | * @param unknown $primitive |
||
| 565 | * @throws InvalidComponentArgumentException |
||
| 566 | */ |
||
| 567 | 35 | public function primitive($primitive = null) |
|
| 588 | |||
| 589 | /** |
||
| 590 | * Set Buffer |
||
| 591 | * |
||
| 592 | * Transform geometry into a BufferGeometry to reduce memory usage at the cost of being harder to manipulate. |
||
| 593 | * |
||
| 594 | * @param bool $buffer |
||
| 595 | */ |
||
| 596 | 1 | protected function buffer($buffer = true) |
|
| 600 | |||
| 601 | /** |
||
| 602 | * skipCache |
||
| 603 | * |
||
| 604 | * Disable retrieving the shared geometry object from the cache. |
||
| 605 | * |
||
| 606 | * @param bool $skipCache |
||
| 607 | */ |
||
| 608 | 1 | protected function skipCache($skipCache = false) |
|
| 612 | |||
| 613 | /** |
||
| 614 | * Width |
||
| 615 | * |
||
| 616 | * {@inheritdoc} |
||
| 617 | * |
||
| 618 | * @param float $width |
||
| 619 | */ |
||
| 620 | 15 | protected function width(float $width = null) |
|
| 624 | |||
| 625 | /** |
||
| 626 | * Height |
||
| 627 | * |
||
| 628 | * {@inheritdoc} |
||
| 629 | * |
||
| 630 | * @param float $height |
||
| 631 | */ |
||
| 632 | 21 | protected function height(float $height = null) |
|
| 636 | |||
| 637 | /** |
||
| 638 | * Depth |
||
| 639 | * |
||
| 640 | * {@inheritdoc} |
||
| 641 | * |
||
| 642 | * @param float $depth |
||
| 643 | */ |
||
| 644 | 10 | protected function depth(float $depth = null) |
|
| 648 | |||
| 649 | /** |
||
| 650 | * Segments |
||
| 651 | * |
||
| 652 | * {@inheritdoc} |
||
| 653 | * |
||
| 654 | * @param int $segments |
||
| 655 | */ |
||
| 656 | 1 | protected function segments($segments) |
|
| 660 | |||
| 661 | /** |
||
| 662 | * Start angle for first segmen |
||
| 663 | * |
||
| 664 | * {@inheritdoc} |
||
| 665 | * |
||
| 666 | * @param float $thetaStart |
||
| 667 | */ |
||
| 668 | 10 | protected function thetaStart($thetaStart) |
|
| 672 | |||
| 673 | /** |
||
| 674 | * The central angle (in degrees). |
||
| 675 | * |
||
| 676 | * {@inheritdoc} |
||
| 677 | * |
||
| 678 | * @param float $thetaLength |
||
| 679 | */ |
||
| 680 | 10 | protected function thetaLength(float $thetaLength = null) |
|
| 684 | |||
| 685 | /** |
||
| 686 | * openEnded |
||
| 687 | * |
||
| 688 | * {@inheritdoc} |
||
| 689 | * |
||
| 690 | * @param bool $openEnded |
||
| 691 | */ |
||
| 692 | 7 | protected function openEnded(bool $openEnded = false) |
|
| 696 | |||
| 697 | /** |
||
| 698 | * segmentsRadial |
||
| 699 | * |
||
| 700 | * {@inheritdoc} |
||
| 701 | * |
||
| 702 | * @param int $segmentsRadial |
||
| 703 | */ |
||
| 704 | 4 | protected function segmentsRadial(int $segmentsRadial = null) |
|
| 708 | |||
| 709 | /** |
||
| 710 | * segmentsHeight |
||
| 711 | * |
||
| 712 | * {@inheritdoc} |
||
| 713 | * |
||
| 714 | * @param int $segmentsHeight |
||
| 715 | */ |
||
| 716 | 16 | protected function segmentsHeight(int $segmentsHeight = null) |
|
| 720 | |||
| 721 | /** |
||
| 722 | * segmentsWidth |
||
| 723 | * |
||
| 724 | * {@inheritdoc} |
||
| 725 | * |
||
| 726 | * @param unknown $segmentsWidth |
||
| 727 | */ |
||
| 728 | 10 | protected function segmentsWidth(int $segmentsWidth = null) |
|
| 732 | |||
| 733 | /** |
||
| 734 | * segmentsTheta |
||
| 735 | * |
||
| 736 | * {@inheritdoc} |
||
| 737 | * |
||
| 738 | * @param int $segmentsTheta |
||
| 739 | */ |
||
| 740 | 1 | protected function segmentsTheta(int $segmentsTheta = null) |
|
| 744 | |||
| 745 | /** |
||
| 746 | * segmentsPhi |
||
| 747 | * |
||
| 748 | * {@inheritdoc} |
||
| 749 | * |
||
| 750 | * @param int $segmentsPhi |
||
| 751 | */ |
||
| 752 | 1 | protected function segmentsPhi(int $segmentsPhi = null) |
|
| 756 | |||
| 757 | /** |
||
| 758 | * segmentsTubular |
||
| 759 | * |
||
| 760 | * {@inheritdoc} |
||
| 761 | * |
||
| 762 | * @param unknown $segmentsTubular |
||
| 763 | */ |
||
| 764 | 2 | protected function segmentsTubular(int $segmentsTubular = null) |
|
| 768 | |||
| 769 | /** |
||
| 770 | * phiStart |
||
| 771 | * |
||
| 772 | * {@inheritdoc} |
||
| 773 | * |
||
| 774 | * @param float $phiStart |
||
| 775 | */ |
||
| 776 | 1 | protected function phiStart(float $phiStart = null) |
|
| 780 | |||
| 781 | /** |
||
| 782 | * phiLength |
||
| 783 | * |
||
| 784 | * {@inheritdoc} |
||
| 785 | * |
||
| 786 | * @param unknown $phiLength |
||
| 787 | */ |
||
| 788 | 1 | protected function phiLength(float $phiLength = null) |
|
| 792 | |||
| 793 | /** |
||
| 794 | * Radius |
||
| 795 | * |
||
| 796 | * {@inheritdoc} |
||
| 797 | * |
||
| 798 | * @param float $radius |
||
| 799 | */ |
||
| 800 | 18 | protected function radius(float $radius = null) |
|
| 804 | |||
| 805 | /** |
||
| 806 | * radiusTubular |
||
| 807 | * |
||
| 808 | * {@inheritdoc} |
||
| 809 | * |
||
| 810 | * @param float $radiusTubular |
||
| 811 | */ |
||
| 812 | 2 | protected function radiusTubular(float $radiusTubular = null) |
|
| 816 | |||
| 817 | /** |
||
| 818 | * radiusTop |
||
| 819 | * |
||
| 820 | * {@inheritdoc} |
||
| 821 | * |
||
| 822 | * @param float $radiusTop |
||
| 823 | */ |
||
| 824 | 1 | protected function radiusTop(float $radiusTop = null) |
|
| 828 | |||
| 829 | /** |
||
| 830 | * radiusBottom |
||
| 831 | * |
||
| 832 | * {@inheritdoc} |
||
| 833 | * |
||
| 834 | * @param float $radiusBottom |
||
| 835 | */ |
||
| 836 | 1 | protected function radiusBottom(float $radiusBottom = null) |
|
| 840 | |||
| 841 | /** |
||
| 842 | * radiusInner |
||
| 843 | * |
||
| 844 | * {@inheritdoc} |
||
| 845 | * |
||
| 846 | * @param unknown $radiusInner |
||
| 847 | */ |
||
| 848 | 1 | protected function radiusInner(float $radiusInner = null) |
|
| 852 | |||
| 853 | /** |
||
| 854 | * radiusOuter |
||
| 855 | * |
||
| 856 | * {@inheritdoc} |
||
| 857 | * |
||
| 858 | * @param unknown $radiusOuter |
||
| 859 | */ |
||
| 860 | 1 | protected function radiusOuter(float $radiusOuter = null) |
|
| 864 | |||
| 865 | /** |
||
| 866 | * arc |
||
| 867 | * |
||
| 868 | * {@inheritdoc} |
||
| 869 | * |
||
| 870 | * @param unknown $arc |
||
| 871 | */ |
||
| 872 | 1 | protected function arc(float $arc = null) |
|
| 876 | |||
| 877 | /** |
||
| 878 | * p |
||
| 879 | * |
||
| 880 | * {@inheritdoc} |
||
| 881 | * |
||
| 882 | * @param int $p |
||
| 883 | */ |
||
| 884 | 1 | protected function p(int $p = null) |
|
| 888 | |||
| 889 | /** |
||
| 890 | * q |
||
| 891 | * |
||
| 892 | * {@inheritdoc} |
||
| 893 | * |
||
| 894 | * @param int $q |
||
| 895 | */ |
||
| 896 | 1 | protected function q(int $q = null) |
|
| 900 | |||
| 901 | /** |
||
| 902 | * translate |
||
| 903 | * |
||
| 904 | * Translates the geometry relative to its pivot point. |
||
| 905 | * |
||
| 906 | * @param float $x |
||
| 907 | * @param float $y |
||
| 908 | * @param float $z |
||
| 909 | */ |
||
| 910 | 7 | protected function translate(float $x = 0, float $y = 0, float $z = 0) |
|
| 915 | |||
| 916 | /** |
||
| 917 | * Is called method allowed for current primitive |
||
| 918 | * |
||
| 919 | * @param unknown $method |
||
| 920 | */ |
||
| 921 | 34 | protected function isPrimitiveMethod($method) |
|
| 956 | |||
| 957 | /** |
||
| 958 | * Get defaults for current primitve type |
||
| 959 | * |
||
| 960 | * @return array; |
||
| 961 | */ |
||
| 962 | 34 | protected function primitiveDefaults(): array |
|
| 997 | } |
||
| 998 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: