You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Additionally, there is a variety of different ways of setting various configuration options and feature flags, often just by passing a boolean to a positional argument. Depending on the entry point, a boolean in a particular position might do something completely different.
For v1.0 we could make the most of the possibility for breaking changes to improve the API for better consistency, readability and extensibility.
Inspired by the XRay API, one potential improvement could be replacing the fetch and parse functions with a single parse function which does both depending on its arguments:
Mf2\parse($url); // Fetches and parses the contents of $urlMf2\parse($url, $html); // Parses $html using $url as a base URL
One potential solution to the config issue would be to allow passing a $config array or object to any of the main entry points, e.g.
$config = [
'lang' => true,
'curl_info' => &$curlInfo,
'json_mode' => true,
'debug' => true,
'parse_classic' => true
];
// Used with the existing entry point functions:Mf2\fetch('url', $config);
Mf2\parse('html', 'url', $config);
$p = newParser('html', 'url', $config);
// Or, with the fetch/parse change suggested above:Mf2\parse('url', $config);
Mf2\parse('url', 'html', $config);
The config keys themselves are only suggestions and could likely be improved.
With some type checking, it may even be possible to implement this while maintaining back compatibility with the old APIs.
The text was updated successfully, but these errors were encountered:
Currently, the parser has a variety of different entry points:
Additionally, there is a variety of different ways of setting various configuration options and feature flags, often just by passing a boolean to a positional argument. Depending on the entry point, a boolean in a particular position might do something completely different.
For v1.0 we could make the most of the possibility for breaking changes to improve the API for better consistency, readability and extensibility.
Inspired by the XRay API, one potential improvement could be replacing the
fetch
andparse
functions with a singleparse
function which does both depending on its arguments:One potential solution to the config issue would be to allow passing a
$config
array or object to any of the main entry points, e.g.The config keys themselves are only suggestions and could likely be improved.
With some type checking, it may even be possible to implement this while maintaining back compatibility with the old APIs.
The text was updated successfully, but these errors were encountered: