Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 3
Point
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 3
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 new
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 from
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
1<?php declare(strict_types=1);
2
3namespace Aviat\Kilo\Type;
4
5/**
6 * A representation of a 2d point
7 */
8final class Point {
9    private function __construct(public int $x, public int $y) {}
10
11    /**
12     * Create a new Point from coordinates
13     *
14     * @param int $x
15     * @param int $y
16     * @return Point
17     */
18    public static function new(int $x = 0, int $y = 0): Point
19    {
20        return new Point($x, $y);
21    }
22
23    /**
24     * Create a new Point from another Point
25     *
26     * @param Point $pos
27     * @return Point
28     */
29    public static function from(Point $pos): Point
30    {
31        return Point::new($pos->x, $pos->y);
32    }
33}