Permalink
Browse files

Rename Object to JsonObject to fix conflict with PHP 7.2

Closes #79, #92
  • Loading branch information...
whikloj authored and lanthaler committed Nov 18, 2018
1 parent da8efc5 commit fee3546915395a1ea0cb37af0fc78a3d9015542d
Showing with 167 additions and 161 deletions.
  1. +1 −0 .travis.yml
  2. +5 −5 Document.php
  3. +6 −4 FileGetContentsLoader.php
  4. +43 −43 JsonLD.php
  5. +2 −2 LanguageTaggedString.php
  6. +2 −2 Node.php
  7. +103 −100 Processor.php
  8. +2 −2 TypedValue.php
  9. +3 −3 Value.php
@@ -6,6 +6,7 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm
matrix:
@@ -9,7 +9,7 @@
namespace ML\JsonLD;
use stdClass as Object;
use stdClass as JsonObject;
use ML\IRI\IRI;
/**
@@ -55,8 +55,8 @@ class Document implements DocumentInterface, JsonLdSerializable
*
* - <em>base</em> The base IRI of the input document.
*
* @param string|array|object $document The JSON-LD document to process.
* @param null|array|object $options Options to configure the processing.
* @param string|array|JsonObject $document The JSON-LD document to process.
* @param null|array|JsonObject $options Options to configure the processing.
*
* @return Document The parsed JSON-LD document.
*
@@ -191,14 +191,14 @@ public function toJsonLd($useNativeTypes = true)
}
foreach ($this->namedGraphs as $graphName => $graph) {
$namedGraph = new Object();
$namedGraph = new JsonObject();
$namedGraph->{'@id'} = $graphName;
$namedGraph->{'@graph'} = $graph->toJsonLd($useNativeTypes);
$defGraph[] = $namedGraph;
}
$document = new Object();
$document = new JsonObject();
$document->{'@graph'} = $defGraph;
return array($document);
@@ -67,10 +67,12 @@ function ($code, $severity, $msg, $msgCode, $bytesTx, $bytesMax) use (
// Extract HTTP Link headers
$linkHeaderValues = array();
for ($i = count($http_response_header) - 1; $i > $httpHeadersOffset; $i--) {
if (0 === substr_compare($http_response_header[$i], 'Link:', 0, 5, true)) {
$value = substr($http_response_header[$i], 5);
$linkHeaderValues[] = $value;
if (is_array($http_response_header)) {
for ($i = count($http_response_header) - 1; $i > $httpHeadersOffset; $i--) {
if (0 === substr_compare($http_response_header[$i], 'Link:', 0, 5, true)) {
$value = substr($http_response_header[$i], 5);
$linkHeaderValues[] = $value;
}
}
}
@@ -9,7 +9,7 @@
namespace ML\JsonLD;
use stdClass as Object;
use stdClass as JsonObject;
use ML\JsonLD\Exception\JsonLdException;
use ML\JsonLD\Exception\InvalidQuadException;
use ML\IRI\IRI;
@@ -72,8 +72,8 @@ class JsonLD
* The options parameter might be passed as associative array or as
* object.
*
* @param string|object|array $input The JSON-LD document to process.
* @param null|array|object $options Options to configure the processing.
* @param string|JsonObject|array $input The JSON-LD document to process.
* @param null|array|JsonObject $options Options to configure the processing.
*
* @return Document The parsed JSON-LD document.
*
@@ -121,9 +121,9 @@ public static function getDocument($input, $options = null)
* The options parameter might be passed as associative array or as
* object.
*
* @param string|object|array $input The JSON-LD document to expand.
* @param null|array|object $options Options to configure the expansion
* process.
* @param string|JsonObject|array $input The JSON-LD document to expand.
* @param null|array|JsonObject $options Options to configure the expansion
* process.
*
* @return array The expanded JSON-LD document.
*
@@ -209,13 +209,13 @@ public static function expand($input, $options = null)
* The options parameter might be passed as associative array or as
* object.
*
* @param string|object|array $input The JSON-LD document to
* @param string|JsonObject|array $input The JSON-LD document to
* compact.
* @param null|string|object|array $context The context.
* @param null|array|object $options Options to configure the
* @param null|string|JsonObject|array $context The context.
* @param null|array|JsonObject $options Options to configure the
* compaction process.
*
* @return object The compacted JSON-LD document.
* @return JsonObject The compacted JSON-LD document.
*
* @throws JsonLdException
*
@@ -236,17 +236,17 @@ public static function compact($input, $context = null, $options = null)
* In contrast to {@link compact()}, this method assumes that the input
* has already been expanded.
*
* @param array $input The JSON-LD document to
* compact.
* @param null|string|object|array $context The context.
* @param object $options Options to configure the
* compaction process.
* @param bool $alwaysGraph If set to true, the resulting
* document will always explicitly
* contain the default graph at
* the top-level.
* @param array $input The JSON-LD document to
* compact.
* @param null|string|JsonObject|array $context The context.
* @param JsonObject $options Options to configure the
* compaction process.
* @param bool $alwaysGraph If set to true, the resulting
* document will always explicitly
* contain the default graph at
* the top-level.
*
* @return object The compacted JSON-LD document.
* @return JsonObject The compacted JSON-LD document.
*
* @throws JsonLdException
*/
@@ -274,7 +274,7 @@ private static function doCompact($input, $context, $options, $alwaysGraph = fal
$processor->compact($input, $activectx, $inversectx);
$compactedDocument = new Object();
$compactedDocument = new JsonObject();
if (null !== $context) {
$compactedDocument->{'@context'} = $context;
}
@@ -335,15 +335,15 @@ private static function doCompact($input, $context, $options, $alwaysGraph = fal
* The options parameter might be passed as associative array or as
* object.
*
* @param string|object|array $input The JSON-LD document to flatten.
* @param null|string|object|array $context The context to compact the
* flattened document. If
* <em>null</em> is passed, the
* result will not be compacted.
* @param null|array|object $options Options to configure the
* flattening process.
* @param string|JsonObject|array $input The JSON-LD document to flatten.
* @param null|string|JsonObject|array $context The context to compact the
* flattened document. If
* <em>null</em> is passed, the
* result will not be compacted.
* @param null|array|JsonObject $options Options to configure the
* flattening process.
*
* @return object The flattened JSON-LD document.
* @return JsonObject The flattened JSON-LD document.
*
* @throws JsonLdException
*
@@ -394,9 +394,9 @@ public static function flatten($input, $context = null, $options = null)
* The options parameter might be passed as associative array or as
* object.
*
* @param string|object|array $input The JSON-LD document to expand.
* @param null|array|object $options Options to configure the expansion
* process.
* @param string|JsonObject|array $input The JSON-LD document to expand.
* @param null|array|JsonObject $options Options to configure the expansion
* process.
*
* @return Quad[] The extracted quads.
*
@@ -445,9 +445,9 @@ public static function toRdf($input, $options = null)
* The options parameter might be passed as associative array or as
* object.
*
* @param Quad[] $quads Array of quads.
* @param null|array|object $options Options to configure the expansion
* process.
* @param Quad[] $quads Array of quads.
* @param null|array|JsonObject $options Options to configure the expansion
* process.
*
* @return array The JSON-LD document in expanded form.
*
@@ -503,12 +503,12 @@ public static function fromRdf(array $quads, $options = null)
* The options parameter might be passed as associative array or as
* object.
*
* @param string|object|array $input The JSON-LD document to compact.
* @param string|object $frame The frame.
* @param null|array|object $options Options to configure the framing
* process.
* @param string|JsonObject|array $input The JSON-LD document to compact.
* @param string|JsonObject $frame The frame.
* @param null|array|JsonObject $options Options to configure the framing
* process.
*
* @return object The framed JSON-LD document.
* @return JsonObject The framed JSON-LD document.
*
* @throws JsonLdException
*
@@ -534,7 +534,7 @@ public static function frame($input, $frame, $options = null)
$processor = new Processor($options);
// Store the frame's context as $frame gets modified
$frameContext = new Object();
$frameContext = new JsonObject();
if (property_exists($frame, '@context')) {
$frameContext->{'@context'} = $frame->{'@context'};
}
@@ -604,9 +604,9 @@ function ($match) {
/**
* Merge the passed options with the options' default values.
*
* @param null|array|object $options The options.
* @param null|array|JsonObject $options The options.
*
* @return object The merged options.
* @return JsonObject The merged options.
*/
private static function mergeOptions($options)
{
@@ -9,7 +9,7 @@
namespace ML\JsonLD;
use stdClass as Object;
use stdClass as JsonObject;
/**
* A LanguageTaggedString is a string which is tagged with a language.
@@ -74,7 +74,7 @@ public function getLanguage()
*/
public function toJsonLd($useNativeTypes = true)
{
$result = new Object();
$result = new JsonObject();
$result->{'@value'} = $this->value;
$result->{'@language'} = $this->language;
@@ -9,7 +9,7 @@
namespace ML\JsonLD;
use stdClass as Object;
use stdClass as JsonObject;
/**
* A Node represents a node in a JSON-LD graph.
@@ -412,7 +412,7 @@ public function toJsonLd($useNativeTypes = true)
} elseif (is_object($value)) { // language-tagged string or typed value
$node->{$prop}[] = $value->toJsonLd($useNativeTypes);
} else {
$val = new Object();
$val = new JsonObject();
$val->{'@value'} = $value;
$node->{$prop}[] = $val;
}
Oops, something went wrong.

0 comments on commit fee3546

Please sign in to comment.