Compare commits
1 Commits
1.2.0
...
4b0a1a1c34
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4b0a1a1c34 |
@@ -1,37 +1,30 @@
|
||||
{
|
||||
"name": "mirzaev/accounts",
|
||||
"type": "library",
|
||||
"description": "Simple accounts manager",
|
||||
"readme": "README.md",
|
||||
"description": "Менеджер аккаунтов",
|
||||
"keywords": [
|
||||
"accounts"
|
||||
],
|
||||
"homepage": "https://git.mirzaev.sexy/mirzaev/accounts",
|
||||
"homepage": "https://git.hood.su/mirzaev/accounts",
|
||||
"license": "WTFPL",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arsen Mirzaev Tatyano-Muradovich",
|
||||
"email": "arsen@mirzaev.sexy",
|
||||
"homepage": "https://mirzaev.sexy",
|
||||
"name": "Arsen Mirzaev",
|
||||
"email": "red@hood.su",
|
||||
"homepage": "https://hood.su/sex",
|
||||
"role": "Programmer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"email": "arsen@mirzaev.sexy",
|
||||
"wiki": "https://git.mirzaev.sexy/mirzaev/accounts/wiki",
|
||||
"issues": "https://git.mirzaev.sexy/mirzaev/accounts/issues"
|
||||
"docs": "https://git.hood.su/mirzaev/accounts/manual",
|
||||
"issues": "https://git.hood.su/mirzaev/accounts/issues",
|
||||
"chat": "https://vk.me/darkweb228"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "funding",
|
||||
"url": "https://fund.mirzaev.sexy"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "~8.1",
|
||||
"php": "~8.0",
|
||||
"ext-dom": "20031129",
|
||||
"ext-libxml": "~8.1.1",
|
||||
"guzzlehttp/guzzle": "^7.2"
|
||||
"ext-libxml": "~8.0",
|
||||
"guzzlehttp/guzzle": "~7.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpdocumentor/phpdocumentor": ">=2.9",
|
||||
|
146
composer.lock
generated
146
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "692ab4dc45591b983920eb547fc37a45",
|
||||
"content-hash": "23c3ffec0f7ab8375317cd34400df0c6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
@@ -613,86 +613,6 @@
|
||||
],
|
||||
"time": "2020-11-10T18:47:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
"version": "1.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/lexer.git",
|
||||
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042",
|
||||
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^6.0",
|
||||
"phpstan/phpstan": "^0.11.8",
|
||||
"phpunit/phpunit": "^8.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
|
||||
"homepage": "https://www.doctrine-project.org/projects/lexer.html",
|
||||
"keywords": [
|
||||
"annotations",
|
||||
"docblock",
|
||||
"lexer",
|
||||
"parser",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/lexer/issues",
|
||||
"source": "https://github.com/doctrine/lexer/tree/1.2.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpdoctrine",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-05-25T17:44:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "jawira/plantuml",
|
||||
"version": "v1.59.0",
|
||||
@@ -899,16 +819,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem.git",
|
||||
"reference": "18634df356bfd4119fe3d6156bdb990c414c14ea"
|
||||
"reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/18634df356bfd4119fe3d6156bdb990c414c14ea",
|
||||
"reference": "18634df356bfd4119fe3d6156bdb990c414c14ea",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
|
||||
"reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -981,7 +901,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/thephpleague/flysystem/issues",
|
||||
"source": "https://github.com/thephpleague/flysystem/tree/1.1.5"
|
||||
"source": "https://github.com/thephpleague/flysystem/tree/1.1.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -989,7 +909,7 @@
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2021-08-17T13:49:42+00:00"
|
||||
"time": "2021-06-23T21:56:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/mime-type-detection",
|
||||
@@ -1945,21 +1865,20 @@
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/phpdocumentor",
|
||||
"version": "v3.1.1",
|
||||
"version": "v3.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/phpDocumentor.git",
|
||||
"reference": "d4449d5d9765caa92c9647b2ac50131aa5a93106"
|
||||
"reference": "7015b11cf0733aaa94a059328bb8d948991630e1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/phpDocumentor/zipball/d4449d5d9765caa92c9647b2ac50131aa5a93106",
|
||||
"reference": "d4449d5d9765caa92c9647b2ac50131aa5a93106",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/phpDocumentor/zipball/7015b11cf0733aaa94a059328bb8d948991630e1",
|
||||
"reference": "7015b11cf0733aaa94a059328bb8d948991630e1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/event-manager": "^1.1",
|
||||
"doctrine/lexer": "^1.2",
|
||||
"ext-ctype": "*",
|
||||
"ext-hash": "*",
|
||||
"ext-iconv": "*",
|
||||
@@ -2064,22 +1983,22 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/phpDocumentor/issues",
|
||||
"source": "https://github.com/phpDocumentor/phpDocumentor/tree/v3.1.1"
|
||||
"source": "https://github.com/phpDocumentor/phpDocumentor/tree/v3.1.0"
|
||||
},
|
||||
"time": "2021-08-20T07:40:11+00:00"
|
||||
"time": "2021-07-07T18:11:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/Reflection.git",
|
||||
"reference": "140db6834feec47ebebc195463771c7377c73010"
|
||||
"reference": "1b70ad9839e288f98f8d162f88754598f207fcae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/140db6834feec47ebebc195463771c7377c73010",
|
||||
"reference": "140db6834feec47ebebc195463771c7377c73010",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/1b70ad9839e288f98f8d162f88754598f207fcae",
|
||||
"reference": "1b70ad9839e288f98f8d162f88754598f207fcae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2120,9 +2039,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/Reflection/issues",
|
||||
"source": "https://github.com/phpDocumentor/Reflection/tree/5.0.1"
|
||||
"source": "https://github.com/phpDocumentor/Reflection/tree/5.0.0"
|
||||
},
|
||||
"time": "2021-08-08T09:55:07+00:00"
|
||||
"time": "2021-07-01T17:51:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
@@ -2669,16 +2588,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "9.5.8",
|
||||
"version": "9.5.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb"
|
||||
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb",
|
||||
"reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5",
|
||||
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2690,7 +2609,7 @@
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"myclabs/deep-copy": "^1.10.1",
|
||||
"phar-io/manifest": "^2.0.3",
|
||||
"phar-io/manifest": "^2.0.1",
|
||||
"phar-io/version": "^3.0.2",
|
||||
"php": ">=7.3",
|
||||
"phpspec/prophecy": "^1.12.1",
|
||||
@@ -2756,7 +2675,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.7"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -2768,7 +2687,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-07-31T15:17:34+00:00"
|
||||
"time": "2021-07-19T06:14:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
@@ -3820,6 +3739,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"abandoned": true,
|
||||
"time": "2020-09-28T06:45:17+00:00"
|
||||
},
|
||||
{
|
||||
@@ -4879,16 +4799,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/flex",
|
||||
"version": "v1.14.0",
|
||||
"version": "v1.13.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/flex.git",
|
||||
"reference": "b298435b9df8d7c7d7d5473d4b9f850a7844d7ea"
|
||||
"reference": "2597d0dda8042c43eed44a9cd07236b897e427d7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/flex/zipball/b298435b9df8d7c7d7d5473d4b9f850a7844d7ea",
|
||||
"reference": "b298435b9df8d7c7d7d5473d4b9f850a7844d7ea",
|
||||
"url": "https://api.github.com/repos/symfony/flex/zipball/2597d0dda8042c43eed44a9cd07236b897e427d7",
|
||||
"reference": "2597d0dda8042c43eed44a9cd07236b897e427d7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4927,7 +4847,7 @@
|
||||
"description": "Composer plugin for Symfony",
|
||||
"support": {
|
||||
"issues": "https://github.com/symfony/flex/issues",
|
||||
"source": "https://github.com/symfony/flex/tree/v1.14.0"
|
||||
"source": "https://github.com/symfony/flex/tree/v1.13.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -4943,7 +4863,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-08-20T17:26:27+00:00"
|
||||
"time": "2021-05-19T07:19:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/framework-bundle",
|
||||
|
@@ -1,161 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace hood\accounts;
|
||||
|
||||
use GuzzleHttp\Client as guzzle;
|
||||
use GuzzleHttp\Cookie\FileCookieJar;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Аккаунт
|
||||
*
|
||||
* @package hood\accounts
|
||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||
*/
|
||||
abstract class account
|
||||
{
|
||||
/**
|
||||
* @var guzzle $browser Браузер
|
||||
*/
|
||||
protected guzzle $browser;
|
||||
|
||||
/**
|
||||
* @var bool $ssl SSL-протокол
|
||||
*/
|
||||
protected bool $ssl = true;
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @var int $id Идентификатор
|
||||
* @var string $path Корневой каталог аккаунтов
|
||||
*/
|
||||
public function __construct(
|
||||
protected int $id,
|
||||
protected string $path = __DIR__ . DIRECTORY_SEPARATOR . 'accounts'
|
||||
) {
|
||||
// Инициализация
|
||||
$this->path($path . DIRECTORY_SEPARATOR . $id);
|
||||
$this->browser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Деструктор
|
||||
*
|
||||
* @todo Разработать
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
// Деаутентификация
|
||||
// $this->deauth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Инициализация браузера
|
||||
*/
|
||||
protected function browser(): guzzle
|
||||
{
|
||||
return isset($this->path, $this->ssl) ? $this->browser = new guzzle([
|
||||
'verify' => $this->ssl,
|
||||
'cookies' => (new FileCookieJar($this->path . DIRECTORY_SEPARATOR . 'cookie.txt'))
|
||||
]) : throw new Exception('Не удалось записать браузер');
|
||||
}
|
||||
|
||||
/**
|
||||
* Инициализация директории пользователя
|
||||
*
|
||||
* @param string $path Путь к директории
|
||||
*/
|
||||
protected function path(string $path): string
|
||||
{
|
||||
// Инициализация директории
|
||||
if (file_exists($this->path = $path) || mkdir($this->path, 0775, true)) {
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
throw new Exception('Не удалось записать путь к директории');
|
||||
}
|
||||
|
||||
/**
|
||||
* Запись свойства
|
||||
*
|
||||
* @param string $name Название
|
||||
* @param mixed $value Значение
|
||||
*/
|
||||
public function __set(string $name, mixed $value): void
|
||||
{
|
||||
match ($name) {
|
||||
'id' => match (false) {
|
||||
isset($this->id) => $this->id = $value,
|
||||
default => throw new Exception('Запрещено перезаписывать идентификатор')
|
||||
},
|
||||
'browser' => match (false) {
|
||||
isset($this->browser) => $this->browser = $value,
|
||||
default => throw new Exception('Запрещено перезаписывать браузер')
|
||||
},
|
||||
'path' => match (false) {
|
||||
isset($this->path) => $this->path($value),
|
||||
default => throw new Exception('Запрещено перезаписывать путь к директории')
|
||||
},
|
||||
'ssl' => $this->ssl = $value,
|
||||
default => throw new Exception('Не найдено: ' . $name, 404)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Чтение свойства
|
||||
*
|
||||
* @param string $name Название
|
||||
*/
|
||||
public function __get(string $name): mixed
|
||||
{
|
||||
return match ($name) {
|
||||
'id' => $this->id,
|
||||
'browser' => $this->browser,
|
||||
'path' => $this->path,
|
||||
'ssl' => $this->ssl,
|
||||
default => throw new Exception('Не найдено: ' . $name, 404)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка инициализации
|
||||
*
|
||||
* @param mixed $name Название
|
||||
*/
|
||||
public function __isset(string $name): bool
|
||||
{
|
||||
return match ($name) {
|
||||
'id' => isset($this->id),
|
||||
'browser' => isset($this->browser),
|
||||
'path' => isset($this->path),
|
||||
'ssl' => isset($this->ssl),
|
||||
default => false
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Удаление свойства
|
||||
*
|
||||
* @param mixed $name Название
|
||||
*/
|
||||
public function __unset(string $name): void
|
||||
{
|
||||
match ($name) {
|
||||
'id' => throw new Exception('Запрещено деинициализировать идентификатор'),
|
||||
'browser' => function () {
|
||||
unset($this->browser);
|
||||
},
|
||||
'path' => function () {
|
||||
unset($this->path);
|
||||
},
|
||||
'ssl' => function () {
|
||||
unset($this->ssl);
|
||||
},
|
||||
default => null
|
||||
};
|
||||
}
|
||||
}
|
@@ -4,14 +4,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace mirzaev\accounts;
|
||||
|
||||
// Браузер
|
||||
use GuzzleHttp\Client as browser;
|
||||
|
||||
/**
|
||||
* Аккаунт
|
||||
*
|
||||
* @package mirzaev\accounts
|
||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||
* @author Arsen Mirzaev Tatyano-Muradovich <red@hood.su>
|
||||
*/
|
||||
class account
|
||||
{
|
||||
@@ -30,6 +29,7 @@ class account
|
||||
*/
|
||||
protected string $path;
|
||||
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
|
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace mirzaev\accounts\auth;
|
||||
|
||||
/**
|
||||
* Базовая аутентификация
|
||||
* Базовая авторизация
|
||||
*/
|
||||
interface basic
|
||||
{
|
||||
|
Reference in New Issue
Block a user