Skip to content

Commit

Permalink
composer: Remove Stringy
Browse files Browse the repository at this point in the history
It is abandoned and incompatible with PHP 8.1:

    Return type of Stringy\Stringy::count() should either be compatible with Countable::count(): int
  • Loading branch information
jtojnar committed Nov 4, 2022
1 parent 9840420 commit 2417f4a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 66 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"ext-gd": "*",
"bcosca/fatfree-core": "^3.8",
"bramus/router": "^1.6",
"danielstjules/stringy": "^3.1",
"fossar/guzzle-transcoder": "^0.2.0",
"fossar/htmlawed": "^1.2.4.1",
"guzzlehttp/guzzle": "^7.0",
Expand All @@ -22,6 +21,7 @@
"php-http/guzzle7-adapter": "^1.0",
"simplepie/simplepie": "^1.6",
"smottt/wideimage": "^1.1",
"symfony/polyfill-php80": "^1.26",
"violet/streaming-json-encoder": "^1.1",
"willwashburn/phpamo": "^1.0"
},
Expand Down
62 changes: 1 addition & 61 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/helpers/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use function Http\Response\send;
use Psr\Http\Message\ResponseInterface;
use Stringy\Stringy as S;

/**
* Helper class for rendering template
Expand Down Expand Up @@ -39,7 +38,7 @@ public function getBaseUrl() {
// base url in config.ini file
$base = $this->configuration->baseUrl;
if ($base !== '') {
$base = (string) S::create($base)->ensureRight('/');
$base = str_ends_with($base, '/') ? $base : ($base . '/');
} else { // auto generate base url
$protocol = 'http';
if ((isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
Expand Down
4 changes: 2 additions & 2 deletions src/spouts/reddit/reddit2.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use helpers\WebClient;
use Psr\Http\Message\ResponseInterface;
use spouts\Item;
use Stringy\Stringy as S;

/**
* Spout for fetching from reddit
Expand Down Expand Up @@ -87,7 +86,8 @@ public function load(array $params) {
$url = UriResolver::resolve(new Uri('https://www.reddit.com/'), new Uri($params['url']));
$this->htmlUrl = (string) $url;
// and that the path ends with .json (Reddit does not seem to recogize Accept header)
$url = $url->withPath((string) S::create($url->getPath())->ensureRight('.json'));
$path = $url->getPath();
$url = $url->withPath(str_ends_with($path, '.json') ? $path : ($path . '.json'));

$response = $this->sendRequest((string) $url);
$json = json_decode((string) $response->getBody(), true);
Expand Down

0 comments on commit 2417f4a

Please # to comment.