From 29459554418408b8b4122f78d0e25b633b3b66e6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 30 Aug 2022 09:15:31 +0200 Subject: [PATCH] Further extend the ignore list Signed-off-by: Joas Schilling --- .gitignore | 8 ++ fusonic/linq/.gitignore | 4 - fusonic/linq/README.md | 207 ----------------------------- fusonic/linq/composer.json | 22 --- fusonic/opengraph/.gitattributes | 1 - fusonic/opengraph/.gitignore | 3 - fusonic/opengraph/.scrutinizer.yml | 17 --- fusonic/opengraph/README.md | 142 -------------------- fusonic/opengraph/composer.json | 42 ------ 9 files changed, 8 insertions(+), 438 deletions(-) delete mode 100644 fusonic/linq/.gitignore delete mode 100644 fusonic/linq/README.md delete mode 100644 fusonic/linq/composer.json delete mode 100644 fusonic/opengraph/.gitattributes delete mode 100644 fusonic/opengraph/.gitignore delete mode 100644 fusonic/opengraph/.scrutinizer.yml delete mode 100644 fusonic/opengraph/README.md delete mode 100644 fusonic/opengraph/composer.json diff --git a/.gitignore b/.gitignore index 8287730c0..d96108628 100644 --- a/.gitignore +++ b/.gitignore @@ -60,9 +60,17 @@ doctrine/lexer/LICENSE fusonic/linq/examples/ fusonic/linq/tests/ +fusonic/linq/composer.json +fusonic/linq/.gitignore +fusonic/linq/README.md fusonic/opengraph/examples/ +fusonic/opengraph/.gitattributes +fusonic/opengraph/.gitignore +fusonic/opengraph/.scrutinizer.yml +fusonic/opengraph/composer.json fusonic/opengraph/phpunit.xml +fusonic/opengraph/README.md giggsey/libphonenumber-for-php/METADATA-VERSION.txt diff --git a/fusonic/linq/.gitignore b/fusonic/linq/.gitignore deleted file mode 100644 index 9b8467569..000000000 --- a/fusonic/linq/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.idea/ -vendor/ -composer.lock -composer.phar diff --git a/fusonic/linq/README.md b/fusonic/linq/README.md deleted file mode 100644 index 7fe2201c9..000000000 --- a/fusonic/linq/README.md +++ /dev/null @@ -1,207 +0,0 @@ -# fusonic/linq - -[![Build Status](https://travis-ci.org/fusonic/linq.png)](https://travis-ci.org/fusonic/linq) -[![Total Downloads](https://poser.pugx.org/fusonic/linq/downloads.png)](https://packagist.org/packages/fusonic/linq) - -fusonic/linq is a lightweight PHP library inspired by the LINQ 2 Objects extension methods in .NET. - -For a full introduction read my blog-post: http://www.fusonic.net/en/blog/2013/08/14/fusonic-linq-write-less-do-more/ - -LINQ queries offer three main advantages over traditional foreach loops: - -* They are more concise and readable, especially when filtering multiple conditions. - -* They provide powerful filtering, ordering, and grouping capabilities with a minimum of application code. - -* In general, the more complex the operation you want to perform on the data, the more benefit you will realize by using LINQ instead of traditional iteration techniques. - -## Requirements - -fusonic/linq is supported on PHP 5.3 and up. - - -## Installation & Usage - -The most flexible installation method is using Composer: Simply create a composer.json file in the root of your project: -``` json -{ - "require": { - "fusonic/linq": "@dev" - } -} -``` - -Install composer and run install command: -``` bash -curl -s http://getcomposer.org/installer | php -php composer.phar install -``` - -Once installed, include vendor/autoload.php in your script to autoload fusonic/linq. - -``` php -require 'vendor/autoload.php'; -use Fusonic\Linq\Linq; - -Linq::from(array())->count(); -``` - -## Examples - -### Calculate the average file size of files in a directory: -``` php -$source = glob("files/*"); -Linq::from($source) - ->select(function($i) { return filesize($i); }) - ->average(); -``` - -### Find all files bigger than 1024 bytes and return the fileinfo object: -``` php -$source = glob("files/*"); -Linq::from($source) - ->where(function($i) { return filesize($i) > 1024; }) - ->select(function($i) { return pathinfo($i); }); -``` - -### Search for all users containing "Max 1", Skip 5 items, Take 2 items and select the property ID of each user: -```php -$result = Linq::from($users) - ->where(function (User $u) { return strstr($u->surname, "Max 1"); }) - ->skip(5) - ->take(2) - ->select(function (User $u) { return $u->usrId; }); -``` - -### Flatten multiple sequences into one sequence: -```php -$array1 = array("key" => "a", "data" => array("a1", "a2")); -$array2 = array("key" => "b", "data" => array("b1", "b2")); -$array3 = array("key" => "c", "data" => array("c1", "c2")); - -$allArrays = array($array1, $array2, $array3); - -$result = Linq::from($allArrays) - ->selectMany(function($x) { return $x["data"]; }) - ->toArray(); - -// $result is now: array("a1", "a2", "b1", "b2", "c1", "c2"); - -``` -### Map sequence to array with key/value selectors: -```php -$category1 = new stdClass(); $category1->key = 1; $category1->value = "Cars"; -$category2 = new stdClass(); $category2->key = 2; $category2->value = "Ships"; - -$result = Linq::from(array($category1, $category2)) - ->toArray( - function($x) { return $x->key; }, // key-selector - function($x) { return $x->value; } // value-selector - ); - -// $result is now: array(1 => "Cars", 2 => "Ships"); -``` - -### The aggregate method makes it simple to perform a calculation over a sequence of values: -```php -$numbers = Linq::from(array(1,2,3,4)); -$sum = $numbers->aggregate(function($a, $b) { return $a + $b; }); -// echo $sum; // output: 10 (1+2+3+4) - -$chars = Linq::from(array("a", "b", "c")); -$csv = $chars->aggregate(function($a, $b) { return $a . "," . $b; }); -// echo $csv; // output: "a,b,c" - -$chars = Linq::from(array("a", "b", "c")); -$csv = $chars->aggregate(function($a, $b) { return $a . "," . $b; }, "seed"); -// echo $csv; // output: "seed,a,b,c" - -``` - - -### The chunk method makes it simple to split a sequence into chunks of a given size: -```php -$chunks = Linq::from(array("a","b","c","d","e"))->chunk(2); -$i = 0; -foreach($chunk in $chunks) { - $i++; - echo "Row $i
"; - foreach($char in $chunk) { - echo $char . "|"; - } -} -// Result: -// Row 1 -// a|b -// Row 2 -// c|d -// Row 3 -// e| - -``` - -## List of methods provided by fusonic/linq: - -```php -aggregate($func, $seed = null) // Applies an accumulator function over a sequence. -all($func) // Determines wheter all elements satisfy a condition. -any($func) // Determines wheter any element satisfies a condition. -average($func = null) // Computes the average of all numeric values. -concat($second) // Concatenates 2 sequences -contains($value) // Determines whether a sequence contains a specified element. -count() // Counts the elements of the sequence. -chunk($chunksize) // Splits the sequence in chunks according to $chunksize. -except($second) // Returns all items except the ones of the given sequence. -distinct($func = null) // Returns all distinct items of a sequence using the optional selector. -each($func) // Performs the specified action on each element of the sequence. -elementAt($index) // Returns the element at a specified index or throws an exception. -elementAtOrNull($index) // Returns the element at a specified index or returns null -first($func = null) // Returns the first element that satisfies a specified condition or throws an exception. -firstOrNull($func = null) // Returns the first element, or NULL if the sequence contains no elements. -groupBy($keySelector) // Groups the object according to the $keySelector generated key. -intersect($second) // Intersects the Linq sequence with second Iterable sequence. -last($func = null) // Returns the last element that satisfies a specified condition or throws an exception. -lastOrNull($func = null) // Returns the last element that satisfies a condition or NULL if no such element is found. -max($func = null) // Returns the maximum item value according to $func. -min($func = null) // Returns the minimum item value according to $func -orderBy($func) // Sorts the elements in ascending order according to a key provided by $func. -orderByDescending($func) // Sorts the elements in descending order according to a key provided by $func. -select($func) // Projects each element into a new form by invoking the selector function. -selectMany($func) // Projects each element of a sequence to a new Linq and flattens the resulting sequences into one sequence. -single($func = null) // Returns the only element that satisfies a specified condition or throws an exception. -singleOrDefault($func = null) // Returns the only element that satisfies a specified condition or returns Null. -skip($count) // Bypasses a specified number of elements and then returns the remaining elements. -sum($func = null) // Gets the sum of all items or by invoking a transform function on each item to get a numeric value. -take($count) // Returns a specified number of contiguous elements from the start of a sequence. -toArray($keySelector=null, $valueSelector=null) // Creates an Array from this Linq object with an optional key selector. -where($func) // Filters the Linq object according to func return result. -``` - -## Simple, Consistent and Predictable - -One important design goal was the principle of the least surprise. As PHP is a fully dynamic language with nearly no type-safety, it is common to shoot yourself into the foot because of accidentally mixing up incompatible types. - -We protect you from these programing errors by asserting that every callback functions you supply to the library must return a correctly typed value. In addition, every supported aggregate function will throw an exception if you are accidentally mixing up incompatible types. - -This means that we made this library totally predictable in what it does, and verified that every function has its defined exceptions which are thrown when certain operations fail, or if certain types are not correct. - -```php -/* Throws an UnexpectedValueException if the -provided callback function does not return a boolean */ -Linq::from(array("1", "1")) -->where(function($x) { return "NOT A BOOLEAN"; }); - -/* Throws an UnexpectedValueException if one of the values -is not convertible to a numeric value:*/ -Linq::from(array(1, 2, "Not a numeric value")) -->sum(); -``` - -## Running tests - -You can run the test suite with the following command: - -```bash -phpunit --bootstrap tests/bootstrap.php . -``` - diff --git a/fusonic/linq/composer.json b/fusonic/linq/composer.json deleted file mode 100644 index 0b7e84e7b..000000000 --- a/fusonic/linq/composer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "fusonic/linq", - "description": "LINQ 2 objects class for PHP", - "keywords": ["linq", "linq2objects"], - "type": "library", - "homepage": "http://fusonic.github.io/fusonic-linq/", - "license": "MIT", - "authors": [ - { - "name": "Fusonic", - "homepage": "http://www.fusonic.net" - } - ], - "require": { - "php": ">=5.3.2" - }, - "autoload": { - "psr-0": { - "Fusonic\\Linq": "src/" - } - } -} diff --git a/fusonic/opengraph/.gitattributes b/fusonic/opengraph/.gitattributes deleted file mode 100644 index 18e14aad7..000000000 --- a/fusonic/opengraph/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/tests export-ignore diff --git a/fusonic/opengraph/.gitignore b/fusonic/opengraph/.gitignore deleted file mode 100644 index 2942141e3..000000000 --- a/fusonic/opengraph/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.idea/ -composer.lock -vendor/ diff --git a/fusonic/opengraph/.scrutinizer.yml b/fusonic/opengraph/.scrutinizer.yml deleted file mode 100644 index 30a9fcfa6..000000000 --- a/fusonic/opengraph/.scrutinizer.yml +++ /dev/null @@ -1,17 +0,0 @@ -build: - environment: - php: - version: 7.4 - tests: - override: - - - command: 'vendor/bin/phpunit --coverage-clover coverage-report' - coverage: - file: 'coverage-report' - format: 'clover' - -tools: - php_code_sniffer: - enabled: true - config: - standard: PSR2 diff --git a/fusonic/opengraph/README.md b/fusonic/opengraph/README.md deleted file mode 100644 index f778de815..000000000 --- a/fusonic/opengraph/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# fusonic/opengraph - -[![Latest Stable Version](https://poser.pugx.org/fusonic/opengraph/v/stable)](https://packagist.org/packages/fusonic/opengraph) -[![Total Downloads](https://poser.pugx.org/fusonic/opengraph/downloads)](https://packagist.org/packages/fusonic/opengraph) -[![Build Status](https://api.travis-ci.org/fusonic/opengraph.svg)](https://travis-ci.org/fusonic/opengraph) -[![License](https://poser.pugx.org/fusonic/opengraph/license)](https://packagist.org/packages/fusonic/opengraph) - -A simple library to read Open Graph data from the web and generate HTML code to publish your own Open Graph objects. A fallback mode enables you to read data from websites that do not implement the Open Graph protocol. - -Using this library you can easily retrieve stuff like meta data, video information from YouTube or Vimeo or image information from Flickr without using site-specific APIs since they all implement the Open Graph protocol. - -See [ogp.me](http://ogp.me) for information on the Open Graph protocol. - -## Requirements - -* PHP 7.4+ -* [fusonic/linq](https://github.com/fusonic/linq) -* [symfony/css-selector](https://github.com/symfony/CssSelector) -* [symfony/dom-crawler](https://github.com/symfony/DomCrawler) -* [psr/http-client](https://github.com/php-fig/http-client), [psr/http-factory](https://github.com/php-fig/http-factory) and compatible implementation such as [guzzle/guzzle](https://github.com/guzzle/guzzle) - -## Installation - -The most flexible installation method is using Composer: - -``` bash -composer require fusonic/opengraph -``` - -Install composer and run install command: -``` bash -curl -s http://getcomposer.org/installer | php -php composer.phar install -``` - -Once installed, include vendor/autoload.php in your script. - -``` php -require "vendor/autoload.php"; -``` - -## Usage - -### Retrieve Open Graph data from a URL - -``` php -use Fusonic\OpenGraph\Consumer; - -$consumer = new Consumer($httpClient, $httpRequestFactory); -$object = $consumer->loadUrl("http://www.youtube.com/watch?v=P422jZg50X4"); - -// Basic information of the object -echo "Title: " . $object->title; // Getting started with Facebook Open Graph -echo "Site name: " . $object->siteName; // YouTube -echo "Description: " . $object->description; // Originally recorded at the Facebook World ... -echo "Canonical URL: " . $object->url; // http://www.youtube.com/watch?v=P422jZg50X4 - -// Images -$image = $object->images[0]; -echo "Image[0] URL: " . $image->url // https://i1.ytimg.com/vi/P422jZg50X4/maxresdefault.jpg -echo "Image[0] height: " . $image->height // null (May return height in pixels on other pages) -echo "Image[0] width: " . $image->width // null (May return width in pixels on other pages) - -// Videos -$video = $object->videos[0]; -echo "Video URL: " . $video->url // http://www.youtube.com/v/P422jZg50X4?version=3&autohide=1 -echo "Video height: " . $video->height // 1080 -echo "Video width: " . $video->width // 1920 -echo "Video type: " . $video->type // application/x-shockwave-flash -``` - -_There are some more properties but these are the basic and most commonly used ones._ - -### Publish own Open Graph data - -``` php -use Fusonic\OpenGraph\Elements\Image; -use Fusonic\OpenGraph\Elements\Video; -use Fusonic\OpenGraph\Publisher; -use Fusonic\OpenGraph\Objects\Website; - -$publisher = new Publisher(); -$object = new Website(); - -// Basic information of the object -$object->title = "Getting started with Facebook Open Graph"; -$object->siteName = "YouTube"; -$object->description = "Originally recorded at the Facebook World ..." -$object->url = "http://www.youtube.com/watch?v=P422jZg50X4"; - -// Images -$image = new Image("https://i1.ytimg.com/vi/P422jZg50X4/maxresdefault.jpg"); -$object->images[] = $image; - -// Videos -$video = new Video("http://www.youtube.com/v/P422jZg50X4?version=3&autohide=1"); -$video->height = 1080; -$video->width = 1920; -$video->type = "application/x-shockwave-flash"; -$object->videos[] = $video; - -// Generate HTML code -echo $publisher->generateHtml($object); -// -// -// -// -// -// -// -// -// -``` - -_HTML code is formatted just for displaying purposes. You may choose between HTML5/XHTML output using the ```$publisher->doctype``` property._ - -## Running tests - -You can run the test suite by running `phpunit` from the command line. - -## FAQ - -**I don't get any information from a webpage, but Facebook shows information for the same URL. What do I do wrong?** - -It seems that some pages (like Twitter) only publish OpenGraph information if Facebook's user agent string `facebookexternalhit/1.1` is used (see #28). So you should configure your PSR-18 client to use this user agent string: - -```php -$client = new Psr18Client(new NativeHttpClient([ "headers" => [ "User-Agent" => "facebookexternalhit/1.1" ] ])); -``` - -## License - -This library is licensed under the MIT license. diff --git a/fusonic/opengraph/composer.json b/fusonic/opengraph/composer.json deleted file mode 100644 index fae814425..000000000 --- a/fusonic/opengraph/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "fusonic/opengraph", - "description": "PHP library for consuming and publishing Open Graph resources.", - "keywords": ["opengraph"], - "type": "library", - "homepage": "https://github.com/fusonic/fusonic-opengraph", - "license": "MIT", - "authors": [ - { - "name": "Fusonic", - "homepage": "https://www.fusonic.net" - } - ], - "autoload": { - "psr-4": { - "Fusonic\\OpenGraph\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Fusonic\\OpenGraph\\Test\\": "tests/" - } - }, - "require": { - "php": "^7.4|^8.0", - "ext-dom": "*", - "symfony/dom-crawler": "^3.0|^4.0|^5.0|^6.0", - "symfony/css-selector": "^3.0|^4.0|^5.0|^6.0", - "fusonic/linq": "^1.0", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0", - "symfony/http-client": "^6.0", - "nyholm/psr7": "^1.2" - }, - "suggest": { - "symfony/http-client": "^5.0", - "nyholm/psr7": "^1.2" - } -}