/
kkkuceravin
/
php-code
Обзор
Документация
Войти
/
kkkuceravin
/
php-code
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/Point.php
45 строк
826 B
kuceravink
initial commit
01 дек 2025, 21:17
01 дек 2025, 21:17
117198f
Код
Авторство
О чём код?
<?php namespace App; class Point { public function __construct( private float $x, private float $y ) {} // Перенос точки по оси X public function moveX(float $dx): void { $this->x += $dx; } // Перенос точки по оси Y public function moveY(float $dy): void { $this->y += $dy; } // Перенос точки на вектор public function moveByVector(Vector $vector): void { $this->x += $vector->getX(); $this->y += $vector->getY(); } public function getX(): float { return $this->x; } public function getY(): float { return $this->y; } public function __toString(): string { return "Point({$this->x}, {$this->y})"; } }