Skip to content

Commit

Permalink
1.0.99
Browse files Browse the repository at this point in the history
* [+] Pre Curl Release
* [*] Always use curl (curl/curl package)
* [-] removed LongreadsHelper class
* [*] `getStoredAll()` always return array
* [*] `getStoredByID()` always return array
* [*] `fetchPagesList()` have optional argument: projects list
* [*] `fetchPagesList()` return list of available pages
* [*] `getPageFullExport()` always return stdClass like structure: longread or LongreadError instance
  • Loading branch information
KarelWintersky committed Aug 9, 2022
1 parent 96e2507 commit e6fedb5
Show file tree
Hide file tree
Showing 6 changed files with 252 additions and 218 deletions.
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
"ext-pdo": "*",
"ext-json": "*",
"ext-curl": "*",
"psr/log": "^1.1"
},
"suggest": {
"curl/curl": "^2.3"
"psr/log": "^1.1",
"curl/curl": "^2.3.0"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 0 additions & 12 deletions interfaces/LongreadsHelperInterface.php

This file was deleted.

25 changes: 15 additions & 10 deletions interfaces/LongreadsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,20 @@ public function getStoredAll(string $order_status = 'DESC', string $order_date =
* @todo: rename
*
* @param $id
* @return bool|mixed
* @return array - вернет пустой массив если лонгрида нет (или
*/
public function getStoredByID($id = null);

/**
* Импортировать лонгрид по идентификатору
*
* @param $id
* @param null $folder
* @param string $folder
* @param string $import_mode
* @return mixed
* @throws RuntimeExceptionAlias
*
*/
public function import($id, $folder = null, string $import_mode = 'update');
public function import($id, string $folder = '', string $import_mode = 'update');

/**
* Добавляем информацию о лонгриде в БД
Expand All @@ -103,13 +102,13 @@ public function deleteStored($id);

/**
* Изменить настройки видимости лонгрида
* @todo: rename
*
* @param $id
* @param string $new_state
* @return string
* @todo: rename
*
*/
public function itemToggleVisibility($id, $new_state = 'hide');
public function itemToggleVisibility($id, string $new_state = 'hide');

/**
* Возвращает список опубликованных лонгридов на Тильде
Expand All @@ -119,10 +118,16 @@ public function itemToggleVisibility($id, $new_state = 'hide');
* @todo: rename
*
*/
public function fetchPagesList(): array;
public function fetchPagesList($projects = []): array;

/**
* Возвращает Json-decoded информацию о лонгриде
* Возвращает Json-decoded информацию о лонгриде.
*
* Структура содержит два поля:
* - status - FOUND|ERROR
* - result - информация о лонгриде:
* - id, projectid, title, descr, img, featureimg, alias, date, sort, published, project_domain итд
*
*
* @param $id
* @param null $associative (null|true)
Expand Down
31 changes: 31 additions & 0 deletions sources/LongreadError.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace AJUR\FSNews;

class LongreadError
{
public string $status = 'ERROR';

public string $result = '';

public bool $error = true;

public string $error_message = '';

/**
* @var int
*/
public int $error_code;

/**
* @var string
*/
public string $url;

public function __construct($error_message = '', $error_code = 0, $url = '')
{
$this->error_message = $error_message;
$this->error_code = $error_code;
$this->url = $url;
}
}
Loading

0 comments on commit e6fedb5

Please sign in to comment.