From d91c744374bac28d22ebdbe6cfb68313cd1ead2e Mon Sep 17 00:00:00 2001 From: hamzadevtech1 Date: Tue, 9 Jan 2024 11:53:06 +0500 Subject: [PATCH 1/3] fixed laravel upgrade --- README.md | 28 ++++++------ build/logs/clover.xml | 44 +++++++++---------- composer.json | 10 ++--- src/Client.php | 18 ++++---- src/Contracts/LinkInterface.php | 2 +- src/Contracts/ParserInterface.php | 10 ++--- src/Contracts/PreviewInterface.php | 2 +- src/Contracts/ReaderInterface.php | 2 +- src/Exceptions/ConnectionErrorException.php | 4 +- src/Exceptions/MalformedUrlException.php | 4 +- src/Exceptions/UnknownFieldException.php | 4 +- src/Exceptions/UnknownParserException.php | 4 +- src/Integrations/LaravelFacade.php | 4 +- src/Integrations/LaravelServiceProvider.php | 6 +-- src/Models/HtmlPreview.php | 8 ++-- src/Models/Link.php | 6 +-- src/Models/VideoPreview.php | 8 ++-- src/Parsers/BaseParser.php | 8 ++-- src/Parsers/HtmlParser.php | 24 +++++----- src/Parsers/VimeoParser.php | 20 ++++----- src/Parsers/YouTubeParser.php | 20 ++++----- src/Readers/HttpReader.php | 8 ++-- src/Traits/HasExportableFields.php | 2 +- src/Traits/HasImportableFields.php | 4 +- tests/LinkPreview/Tests/LinkPreviewTest.php | 16 +++---- .../Tests/Parser/GeneralParserTest.php | 10 ++--- .../Tests/Reader/GeneralReaderTest.php | 6 +-- 27 files changed, 141 insertions(+), 141 deletions(-) diff --git a/README.md b/README.md index 92d2cf6..e1514da 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Link Preview -[![Build Status](https://travis-ci.org/dusterio/link-preview.svg)](https://travis-ci.org/dusterio/link-preview) -[![Code Climate](https://codeclimate.com/github/dusterio/link-preview/badges/gpa.svg)](https://codeclimate.com/github/dusterio/link-preview/badges) -[![Test Coverage](https://codeclimate.com/github/dusterio/link-preview/badges/coverage.svg)](https://codeclimate.com/github/dusterio/link-preview/badges) -[![Total Downloads](https://poser.pugx.org/dusterio/link-preview/d/total.svg)](https://packagist.org/packages/dusterio/link-preview) -[![Latest Stable Version](https://poser.pugx.org/dusterio/link-preview/v/stable.svg)](https://packagist.org/packages/dusterio/link-preview) -[![Latest Unstable Version](https://poser.pugx.org/dusterio/link-preview/v/unstable.svg)](https://packagist.org/packages/dusterio/link-preview) -[![License](https://poser.pugx.org/dusterio/link-preview/license.svg)](https://packagist.org/packages/dusterio/link-preview) +[![Build Status](https://travis-ci.org/Propay/link-preview.svg)](https://travis-ci.org/Propay/link-preview) +[![Code Climate](https://codeclimate.com/github/Propay/link-preview/badges/gpa.svg)](https://codeclimate.com/github/Propay/link-preview/badges) +[![Test Coverage](https://codeclimate.com/github/Propay/link-preview/badges/coverage.svg)](https://codeclimate.com/github/Propay/link-preview/badges) +[![Total Downloads](https://poser.pugx.org/Propay/link-preview/d/total.svg)](https://packagist.org/packages/Propay/link-preview) +[![Latest Stable Version](https://poser.pugx.org/Propay/link-preview/v/stable.svg)](https://packagist.org/packages/Propay/link-preview) +[![Latest Unstable Version](https://poser.pugx.org/Propay/link-preview/v/unstable.svg)](https://packagist.org/packages/Propay/link-preview) +[![License](https://poser.pugx.org/Propay/link-preview/license.svg)](https://packagist.org/packages/Propay/link-preview) A PHP class that consumes an HTTP(S) link and returns an array of preview information. Think of Facebook sharing - whenever you paste a link, it goes to specified page and fetches some details. @@ -25,7 +25,7 @@ Includes integrations with: Laravel 5 To install simply run: ``` -composer require dusterio/link-preview +composer require Propay/link-preview ``` Or add it to `composer.json` manually: @@ -33,7 +33,7 @@ Or add it to `composer.json` manually: ```json { "require": { - "dusterio/link-preview": "~1.2" + "Propay/link-preview": "~1.2" } } ``` @@ -41,7 +41,7 @@ Or add it to `composer.json` manually: ## Direct usage ```php -use Dusterio\LinkPreview\Client; +use Propay\LinkPreview\Client; $previewClient = new Client('https://www.boogiecall.com/en/Melbourne'); @@ -87,7 +87,7 @@ $previewClient->getParser('general')->getReader()->config(['allow_redirects' => // If there is a network error (DNS, connect, etc), we throw ConnectionErrorException try { $previews = $previewClient->getPreviews(); -} catch (\Dusterio\LinkPreview\Exceptions\ConnectionErrorException $e) { +} catch (\Propay\LinkPreview\Exceptions\ConnectionErrorException $e) { echo "Oh no!"; } ``` @@ -95,7 +95,7 @@ try { ### YouTube example ```php -use Dusterio\LinkPreview\Client; +use Propay\LinkPreview\Client; $previewClient = new LinkPreview('https://www.youtube.com/watch?v=v1uKhwN6FtA'); @@ -123,12 +123,12 @@ array(2) { 'providers' => [ '...', - 'Dusterio\LinkPreview\Integrations\LaravelServiceProvider', + 'Propay\LinkPreview\Integrations\LaravelServiceProvider', ]; 'aliases' => [ '...', - 'Preview' => 'Dusterio\LinkPreview\Integrations\LaravelFacade', + 'Preview' => 'Propay\LinkPreview\Integrations\LaravelFacade', ]; // Set target url diff --git a/build/logs/clover.xml b/build/logs/clover.xml index a8e3fae..e2e4a51 100644 --- a/build/logs/clover.xml +++ b/build/logs/clover.xml @@ -1,9 +1,9 @@ - + - + @@ -57,49 +57,49 @@ - + - + - + - + - + - + - + - + - + - + @@ -134,15 +134,15 @@ - + - + - + @@ -160,7 +160,7 @@ - + @@ -209,7 +209,7 @@ - + @@ -230,9 +230,9 @@ - + - + @@ -256,9 +256,9 @@ - + - + @@ -272,7 +272,7 @@ - + diff --git a/composer.json b/composer.json index 3c1524e..cdc4ebc 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "dusterio/link-preview", + "name": "Propay/link-preview", "type": "library", "description": "Link preview generation for PHP with Laravel support", "keywords": ["php","url","scraping","laravel","preview"], - "homepage": "http://github.com/dusterio/link-preview", + "homepage": "http://github.com/Propay/link-preview", "license": "MIT", "authors": [ { @@ -14,7 +14,7 @@ ], "require": { "php": ">=5.5.0", - "illuminate/support": "5.*|6.*|7.*|8.*|9.*", + "illuminate/support": "5.*|6.*|7.*|8.*|9.*|10.*", "guzzlehttp/guzzle": "^6.1|^7.1", "symfony/dom-crawler": "^3.0|^4.0|^5.0|^6.0", "symfony/css-selector": "^3.0|^4.0|^5.0|^6.0" @@ -25,13 +25,13 @@ }, "autoload": { "psr-4": { - "Dusterio\\LinkPreview\\": "src/" + "Propay\\LinkPreview\\": "src/" } }, "extra":{ "laravel": { "providers": [ - "Dusterio\\LinkPreview\\Integrations\\LaravelServiceProvider" + "Propay\\LinkPreview\\Integrations\\LaravelServiceProvider" ] } } diff --git a/src/Client.php b/src/Client.php index f472542..bc2de2d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -1,14 +1,14 @@ getUrl(), FILTER_VALIDATE_URL) === false; } @@ -101,7 +101,7 @@ public function canParseLink(LinkInterface $link) /** * @inheritdoc */ - public function parseLink(LinkInterface $link) + public function parseLink(LinkInterface $link): static { $link = $this->readLink($link); diff --git a/src/Parsers/VimeoParser.php b/src/Parsers/VimeoParser.php index 07092da..daf3ecc 100644 --- a/src/Parsers/VimeoParser.php +++ b/src/Parsers/VimeoParser.php @@ -1,13 +1,13 @@ getUrl())); } @@ -48,7 +48,7 @@ public function canParseLink(LinkInterface $link) /** * @inheritdoc */ - public function parseLink(LinkInterface $link) + public function parseLink(LinkInterface $link): static { preg_match(static::PATTERN, $link->getUrl(), $matches); @@ -60,4 +60,4 @@ public function parseLink(LinkInterface $link) return $this; } -} \ No newline at end of file +} diff --git a/src/Parsers/YouTubeParser.php b/src/Parsers/YouTubeParser.php index 4a9017e..aec77fa 100644 --- a/src/Parsers/YouTubeParser.php +++ b/src/Parsers/YouTubeParser.php @@ -1,13 +1,13 @@ getUrl())); } @@ -48,7 +48,7 @@ public function canParseLink(LinkInterface $link) /** * @inheritdoc */ - public function parseLink(LinkInterface $link) + public function parseLink(LinkInterface $link): static { preg_match(static::PATTERN, $link->getUrl(), $matches); @@ -60,4 +60,4 @@ public function parseLink(LinkInterface $link) return $this; } -} \ No newline at end of file +} diff --git a/src/Readers/HttpReader.php b/src/Readers/HttpReader.php index a41f28f..b76bf81 100644 --- a/src/Readers/HttpReader.php +++ b/src/Readers/HttpReader.php @@ -1,9 +1,9 @@ $this->jar, 'connect_timeout' => 5, 'headers' => [ - 'User-Agent' => 'dusterio/link-preview v1.2' + 'User-Agent' => 'Propay/link-preview v1.2' ] ]; } diff --git a/src/Traits/HasExportableFields.php b/src/Traits/HasExportableFields.php index a1d3312..2d817df 100644 --- a/src/Traits/HasExportableFields.php +++ b/src/Traits/HasExportableFields.php @@ -1,6 +1,6 @@ getMock('Dusterio\LinkPreview\Parsers\HtmlParser', null); - $youtubeParserMock = $this->getMock('Dusterio\LinkPreview\Parsers\YouTubeParser', null); + $generalParserMock = $this->getMock('Propay\LinkPreview\Parsers\HtmlParser', null); + $youtubeParserMock = $this->getMock('Propay\LinkPreview\Parsers\YouTubeParser', null); $linkPreview = new Client('http://www.google.com'); @@ -45,10 +45,10 @@ public function can_add_extra_parsers() */ public function can_parse_an_html_page() { - $linkMock = $this->getMock('Dusterio\LinkPreview\Models\Link', null, ['http://www.google.com']); + $linkMock = $this->getMock('Propay\LinkPreview\Models\Link', null, ['http://www.google.com']); - $generalParserMock = $this->getMock('Dusterio\LinkPreview\Parsers\HtmlParser'); - $previewMock = $this->getMock('Dusterio\LinkPreview\Models\HtmlPreview'); + $generalParserMock = $this->getMock('Propay\LinkPreview\Parsers\HtmlParser'); + $previewMock = $this->getMock('Propay\LinkPreview\Models\HtmlPreview'); $generalParserMock->expects(self::once()) ->method('canParseLink') @@ -100,6 +100,6 @@ public function can_parse_a_youtube_link() { $linkPreview = new Client('https://www.youtube.com/watch?v=ycGfvA1vkR8'); $parsedLink = $linkPreview->getPreview('youtube'); - self::assertInstanceOf('Dusterio\LinkPreview\Models\VideoPreview', $parsedLink); + self::assertInstanceOf('Propay\LinkPreview\Models\VideoPreview', $parsedLink); } } diff --git a/tests/LinkPreview/Tests/Parser/GeneralParserTest.php b/tests/LinkPreview/Tests/Parser/GeneralParserTest.php index 151d2b7..de3e60d 100644 --- a/tests/LinkPreview/Tests/Parser/GeneralParserTest.php +++ b/tests/LinkPreview/Tests/Parser/GeneralParserTest.php @@ -1,21 +1,21 @@ getMock('Dusterio\LinkPreview\Models\Link', null, [$url]); + $linkMock = $this->getMock('Propay\LinkPreview\Models\Link', null, [$url]); $parser = new HtmlParser(); diff --git a/tests/LinkPreview/Tests/Reader/GeneralReaderTest.php b/tests/LinkPreview/Tests/Reader/GeneralReaderTest.php index 43f9a06..bd31355 100644 --- a/tests/LinkPreview/Tests/Reader/GeneralReaderTest.php +++ b/tests/LinkPreview/Tests/Reader/GeneralReaderTest.php @@ -1,8 +1,8 @@ method('request') ->will(self::returnValue($responseMock)); - $linkMock = $this->getMock('Dusterio\LinkPreview\Models\Link', null, ['http://www.google.com']); + $linkMock = $this->getMock('Propay\LinkPreview\Models\Link', null, ['http://www.google.com']); $reader = new HttpReader(); $reader->setClient($clientMock); From aa4a3318c6a7d80355a01dcaf8161103376b64cd Mon Sep 17 00:00:00 2001 From: hamzadevtech1 Date: Tue, 9 Jan 2024 19:36:37 +0500 Subject: [PATCH 2/3] fixed package name and changed it to smaller letter --- README.md | 18 +++++++++--------- composer.json | 4 ++-- src/Readers/HttpReader.php | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e1514da..96532ce 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Link Preview -[![Build Status](https://travis-ci.org/Propay/link-preview.svg)](https://travis-ci.org/Propay/link-preview) -[![Code Climate](https://codeclimate.com/github/Propay/link-preview/badges/gpa.svg)](https://codeclimate.com/github/Propay/link-preview/badges) -[![Test Coverage](https://codeclimate.com/github/Propay/link-preview/badges/coverage.svg)](https://codeclimate.com/github/Propay/link-preview/badges) -[![Total Downloads](https://poser.pugx.org/Propay/link-preview/d/total.svg)](https://packagist.org/packages/Propay/link-preview) -[![Latest Stable Version](https://poser.pugx.org/Propay/link-preview/v/stable.svg)](https://packagist.org/packages/Propay/link-preview) -[![Latest Unstable Version](https://poser.pugx.org/Propay/link-preview/v/unstable.svg)](https://packagist.org/packages/Propay/link-preview) -[![License](https://poser.pugx.org/Propay/link-preview/license.svg)](https://packagist.org/packages/Propay/link-preview) +[![Build Status](https://travis-ci.org/propay/link-preview.svg)](https://travis-ci.org/propay/link-preview) +[![Code Climate](https://codeclimate.com/github/propay/link-preview/badges/gpa.svg)](https://codeclimate.com/github/propay/link-preview/badges) +[![Test Coverage](https://codeclimate.com/github/propay/link-preview/badges/coverage.svg)](https://codeclimate.com/github/propay/link-preview/badges) +[![Total Downloads](https://poser.pugx.org/propay/link-preview/d/total.svg)](https://packagist.org/packages/propay/link-preview) +[![Latest Stable Version](https://poser.pugx.org/propay/link-preview/v/stable.svg)](https://packagist.org/packages/propay/link-preview) +[![Latest Unstable Version](https://poser.pugx.org/propay/link-preview/v/unstable.svg)](https://packagist.org/packages/propay/link-preview) +[![License](https://poser.pugx.org/propay/link-preview/license.svg)](https://packagist.org/packages/propay/link-preview) A PHP class that consumes an HTTP(S) link and returns an array of preview information. Think of Facebook sharing - whenever you paste a link, it goes to specified page and fetches some details. @@ -25,7 +25,7 @@ Includes integrations with: Laravel 5 To install simply run: ``` -composer require Propay/link-preview +composer require propay/link-preview ``` Or add it to `composer.json` manually: @@ -33,7 +33,7 @@ Or add it to `composer.json` manually: ```json { "require": { - "Propay/link-preview": "~1.2" + "propay/link-preview": "~1.2" } } ``` diff --git a/composer.json b/composer.json index cdc4ebc..850510d 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "Propay/link-preview", + "name": "propay/link-preview", "type": "library", "description": "Link preview generation for PHP with Laravel support", "keywords": ["php","url","scraping","laravel","preview"], - "homepage": "http://github.com/Propay/link-preview", + "homepage": "http://github.com/propay/link-preview", "license": "MIT", "authors": [ { diff --git a/src/Readers/HttpReader.php b/src/Readers/HttpReader.php index b76bf81..218e6f5 100644 --- a/src/Readers/HttpReader.php +++ b/src/Readers/HttpReader.php @@ -42,7 +42,7 @@ public function __construct($config = null) 'cookies' => $this->jar, 'connect_timeout' => 5, 'headers' => [ - 'User-Agent' => 'Propay/link-preview v1.2' + 'User-Agent' => 'propay/link-preview v1.2' ] ]; } From 6ead520cbd7fd1f168a673d59beaa58fa351b518 Mon Sep 17 00:00:00 2001 From: hamzadevtech1 <109795911+hamzadevtech1@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:18:17 +0500 Subject: [PATCH 3/3] minor changes --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 850510d..54af1c5 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ ], "require": { "php": ">=5.5.0", - "illuminate/support": "5.*|6.*|7.*|8.*|9.*|10.*", + "illuminate/support": "5.*|6.*|7.*|8.*|9.*|10.*|11.*", "guzzlehttp/guzzle": "^6.1|^7.1", "symfony/dom-crawler": "^3.0|^4.0|^5.0|^6.0", "symfony/css-selector": "^3.0|^4.0|^5.0|^6.0"