/
uchi-pro
/
api-client-php
Обзор
Документация
Войти
/
uchi-pro
/
api-client-php
Код
Запросы
0
Пакеты
0
Релизы
3
Аналитика
4.0.0
src/Identity.php
52 строки
1 KB
Andrey Gladyshev
feat: перевести проект на php 8.2. убрать устаревшие методы
31 май 2024, 13:00
31 май 2024, 13:00
5826891
Код
Авторство
О чём код?
<?php declare(strict_types=1); namespace UchiPro; class Identity { public ?string $url = null; public ?string $urlScheme = null; public ?string $urlHost = null; public ?string $login = null; public ?string $password = null; public ?string $accessToken = null; public static function createByLogin(string $url, string $login, string $password): Identity { $identity = new self(); $identity->url = $url; $identity->urlScheme = parse_url($identity->url, PHP_URL_SCHEME); $identity->urlHost = parse_url($identity->url, PHP_URL_HOST); $identity->login = $login; $identity->password = $password; return $identity; } public static function createByAccessToken(string $url, string $accessToken): Identity { $identity = new self(); $identity->url = $url; $identity->urlScheme = parse_url($identity->url, PHP_URL_SCHEME); $identity->urlHost = parse_url($identity->url, PHP_URL_HOST); $identity->accessToken = $accessToken; return $identity; } }