Code Duplication    Length = 10-10 lines in 3 locations

math/Vector.php 3 locations

@@ 114-123 (lines=10) @@
111
     *
112
     * @return  Vector
113
     */
114
    public function abs() : Vector
115
    {
116
        $result = [];
117
118
        foreach ($this->components as $i => $component) {
119
            $result[$i] = abs($component);
120
        }
121
122
        return new static($result);
123
    }
124
125
    /**
126
     * Returns the smallest of the components compared as absolute values. This is *not* the
@@ 524-533 (lines=10) @@
521
     * @param   float   $scale  The scale to multiply by.
522
     * @return  Vector          The result of the multiplication.
523
     */
524
    public function multiply(float $scale) : Vector
525
    {
526
        $result = [];
527
528
        foreach ($this->components as $i => $component) {
529
            $result[$i] = $component * $scale;
530
        }
531
532
        return new static($result);
533
    }
534
535
    /**
536
     * Returns the normalized Vector, ie. a Vector with the same direction but a length of 1.
@@ 564-573 (lines=10) @@
561
     *
562
     * @return  Vector
563
     */
564
    public function reverse()
565
    {
566
        $result = [];
567
568
        foreach ($this->components as $i => $component) {
569
            $result[$i] = $component * -1;
570
        }
571
572
        return new static($result);
573
    }
574
575
    /**
576
     * Subtracts $that Vector/number from this Vector and returns the result as a new Vector.