private static function setProperty(&$object, $property, $value, $errorCode = null)
    {
        if (property_exists($object, $property) &&
            (false === self::subtreeEquals($object->{$property}, $value))) {

            if ($errorCode) {
                throw new JsonLdException(
                    $errorCode,
                    "Object already contains a property \"$property\".",
                    $object
                );
            }

            throw new JsonLdException(
                JsonLdException::UNSPECIFIED,
                "Object already contains a property \"$property\".",
                $object
            );
        }

        $object->{$property} = $value;
    }
private static function setProperty(&$object, $property, $value, $errorCode = null)
    {
        if (property_exists($object, $property) &&
            (false === self::subtreeEquals($object->{$property}, $value))) {

            if ($errorCode) {
                throw new JsonLdException(
                    $errorCode,
                    "Object already contains a property \"$property\".",
                    $object
                );
            }

            throw new JsonLdException(
                JsonLdException::UNSPECIFIED,
                "Object already contains a property \"$property\".",
                $object
            );
        }

        $object->{$property} = $value;
    }
private static function setProperty ( & $ object , $ property , $ value , $ errorCode = null ) { if ( property_exists ( $ object , $ property ) && ( false === self :: subtreeEquals ( $ object -> { $ property } , $ value ) ) ) { if ( $ errorCode ) { throw new JsonLdException ( $ errorCode , "Object already contains a property \"$property\"." , $ object ) ; } throw new JsonLdException ( JsonLdException :: UNSPECIFIED , "Object already contains a property \"$property\"." , $ object ) ; } $ object -> { $ property } = $ value ; }
Adds a property to an object if it doesn't exist yet

If the property already exists, an exception is thrown as otherwise
the existing value would be lost.

@param JsonObject $object   The object.
@param string     $property The name of the property.
@param mixed      $value    The value of the property.

@throws JsonLdException If the property exists already JSON-LD.
Adds a property to an object if it doesn t exist yet