Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nova2 refactoring #62

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ require '<path_to_dir>/src/Delivery/NovaPoshtaApi2.php';
## Создание экземпляра класса
Класс по умолчанию находится в namespace `\LisDev\Delivery`. При создании экземпляра класса необходимо
или использовать Full Qualified Class Name:

```php
$np = new \LisDev\Delivery\NovaPoshtaApi2('Ваш_ключ_API_2.0');
$np = new \LisDev\Controllers\NovaPoshtaApi2('Ваш_ключ_API_2.0');
```
или указать используемый namespace в секции use:

```php
use LisDev\Delivery\NovaPoshtaApi2;
use LisDev\Controllers\NovaPoshtaApi2;
...
$np = new NovaPoshtaApi2('Ваш_ключ_API_2.0');
```
Expand Down
6 changes: 4 additions & 2 deletions README.ua.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ require '<path_to_dir>/src/Delivery/NovaPoshtaApi2.php';
## Створення екземпляру класа
Клас знаходиться в namespace `\LisDev\Delivery`. При створенні екземпляру класу необхідно
або використовувати Full Qualified Class Name:

```php
$np = new \LisDev\Delivery\NovaPoshtaApi2('Ваш_ключ_API_2.0');
$np = new \LisDev\Controllers\NovaPoshtaApi2('Ваш_ключ_API_2.0');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем понимаю зачем менять неймспейс, если прошлый вполне отражал свое назначение, а вот Controllers может вводить в заблуждение

```
або вказати namespace що використовується у секції use:

```php
use LisDev\Delivery\NovaPoshtaApi2;
use LisDev\Controllers\NovaPoshtaApi2;
...
$np = new NovaPoshtaApi2('Ваш_ключ_API_2.0');
```
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
}
],
"require": {
"php": ">=5.3.0"
"php": ">=8.1",
"ext-simplexml": "*",
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
Expand Down
32 changes: 32 additions & 0 deletions src/Common/Format.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace LisDev\Common;

use LisDev\Controllers\NovaPoshtaApi2;

class Format
{
protected string $format;
/**
* Setter for format property.
*
* @param string $format Format of returned data by methods (json, xml, array)
*
* @return NovaPoshtaApi2
*/
public function setFormat(string $format): Format
{
$this->format = $format;
return $this;
}

/**
* Getter for format property.
*
* @return string
*/
public function getFormat(): string
{
return $this->format;
}
}
34 changes: 34 additions & 0 deletions src/Common/Language.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace LisDev\Common;

class Language
{
/**
* @var string Language of response
*/
protected string $language = 'ru';

/**
* Setter for language property.
*
* @param string $language
*
* @return Language
*/
public function setLanguage(string $language): Language
{
$this->language = $language;
return $this;
}

/**
* Getter for language property.
*
* @return string
*/
public function getLanguage(): string
{
return $this->language;
}
}
153 changes: 153 additions & 0 deletions src/Common/ListAreas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?php

namespace LisDev\Common;

class ListAreas
{
public const AREAS = [
'71508129-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Вінниця',
'DescriptionRu' => 'Винница',
'Area' => 'Вінницька',
'AreaRu' => 'Винницкая',
],
'7150812b-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Дніпропетровськ',
'DescriptionRu' => 'Днепропетровск',
'Area' => 'Дніпропетровська',
'AreaRu' => 'Днепропетровская',
],
'7150812c-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Донецьк',
'DescriptionRu' => 'Донецк',
'Area' => 'Донецька',
'AreaRu' => 'Донецкая',
],
'7150812d-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Житомир',
'DescriptionRu' => 'Житомир',
'Area' => 'Житомирська',
'AreaRu' => 'Житомирская',
],
'7150812f-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Запоріжжя',
'DescriptionRu' => 'Запорожье',
'Area' => 'Запорізька',
'AreaRu' => 'Запорожская',
],
'71508130-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Івано-Франківськ',
'DescriptionRu' => 'Ивано-Франковск',
'Area' => 'Івано-Франківська',
'AreaRu' => 'Ивано-Франковская',
],
'71508131-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Київ',
'DescriptionRu' => 'Киев',
'Area' => 'Київська',
'AreaRu' => 'Киевская',
],
'71508132-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Кіровоград',
'DescriptionRu' => 'Кировоград',
'Area' => 'Кіровоградська',
'AreaRu' => 'Кировоградская',
],
'71508133-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Луганськ',
'DescriptionRu' => 'Луганск',
'Area' => 'Луганська',
'AreaRu' => 'Луганская',
],
'7150812a-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Луцьк',
'DescriptionRu' => 'Луцк',
'Area' => 'Волинська',
'AreaRu' => 'Волынская',
],
'71508134-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Львів',
'DescriptionRu' => 'Львов',
'Area' => 'Львівська',
'AreaRu' => 'Львовская',
],
'71508135-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Миколаїв',
'DescriptionRu' => 'Николаев',
'Area' => 'Миколаївська',
'AreaRu' => 'Николаевская',
],
'71508136-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Одеса',
'DescriptionRu' => 'Одесса',
'Area' => 'Одеська',
'AreaRu' => 'Одесская',
],
'71508137-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Полтава',
'DescriptionRu' => 'Полтава',
'Area' => 'Полтавська',
'AreaRu' => 'Полтавская',
],
'71508138-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Рівне',
'DescriptionRu' => 'Ровно',
'Area' => 'Рівненська',
'AreaRu' => 'Ровненская',
],
'71508139-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Суми',
'DescriptionRu' => 'Сумы',
'Area' => 'Сумська',
'AreaRu' => 'Сумская',
],
'7150813a-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Тернопіль',
'DescriptionRu' => 'Тернополь',
'Area' => 'Тернопільська',
'AreaRu' => 'Тернопольская',
],
'7150812e-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Ужгород',
'DescriptionRu' => 'Ужгород',
'Area' => 'Закарпатська',
'AreaRu' => 'Закарпатская',
],
'7150813b-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Харків',
'DescriptionRu' => 'Харьков',
'Area' => 'Харківська',
'AreaRu' => 'Харьковская',
],
'7150813c-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Херсон',
'DescriptionRu' => 'Херсон',
'Area' => 'Херсонська',
'AreaRu' => 'Херсонская',
],
'7150813d-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Хмельницький',
'DescriptionRu' => 'Хмельницкий',
'Area' => 'Хмельницька',
'AreaRu' => 'Хмельницкая',
],
'7150813e-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Черкаси',
'DescriptionRu' => 'Черкассы',
'Area' => 'Черкаська',
'AreaRu' => 'Черкасская',
],
'71508140-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Чернігів',
'DescriptionRu' => 'Чернигов',
'Area' => 'Чернігівська',
'AreaRu' => 'Черниговская',
],
'7150813f-9b87-11de-822f-000c2965ae0e' => [
'Description' => 'Чернівці',
'DescriptionRu' => 'Черновцы',
'Area' => 'Чернівецька',
'AreaRu' => 'Черновицкая',
],
];
}
13 changes: 13 additions & 0 deletions src/Common/PrintMarkingType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace LisDev\Common;

enum PrintMarkingType: string
{
case Pdf = 'pdf';
case NewPdf = 'new_pdf';
case PdfLink = 'pdf_link';
case NewHtml = 'new_html';
case OldHtml = 'old_html';
case HtmlLink = 'html_link';
}
Loading