brick / schema

Schema.org library for PHP
MIT License
49 stars 6 forks source link

Too few arguments to function Brick\Schema\SchemaReader::readHtml() #4

Closed tksa closed 3 years ago

tksa commented 3 years ago

I am providing html as a string (everything as per example) yet I get thrown error that 2 expected? public function readHtml(string $html, string $url) : array As per documentation, I see nothing regarding $url

` Fatal error: Uncaught ArgumentCountError: Too few arguments to function Brick\Schema\SchemaReader::readHtml(), 1 passed in C:\wamp64\www\issue\webstore\testing.php on line 31 and exactly 2 expected in C:\wamp64\www\issue\webstore\vendor\brick\schema\src\SchemaReader.php on line 138

1 | 0.0006 | 373632 | {main}( ) | ...\testing.php:0 2 | 3.7949 | 1336704 | Brick\Schema\SchemaReader->readHtml( ) | ...\testing.php:31

`

BenMorel commented 3 years ago

Hi, you must provide the URL the document has been retrieved from as second parameter. This was indeed missing from the docs, I've just updated them:

https://github.com/brick/schema/blob/master/README.md#quickstart

The URL the document was retrieved from. This will be used only to resolve relative URLs in property values. No attempt will be performed to connect to this URL.

Thanks for reporting!