Naming convention fixes.

This commit is contained in:
Dave Longley 2012-04-26 20:46:41 -04:00
parent 75526669b8
commit 3f494ac765

View file

@ -477,9 +477,9 @@ class JsonLdProcessor {
$rval = false; $rval = false;
if(self::hasProperty($subject, $property)) { if(self::hasProperty($subject, $property)) {
$val = $subject->{$property}; $val = $subject->{$property};
$isList = self::_isList($val); $is_list = self::_isList($val);
if(is_array($val) || $isList) { if(is_array($val) || $is_list) {
if($isList) { if($is_list) {
$val = $val->{'@list'}; $val = $val->{'@list'};
} }
foreach($val as $v) { foreach($val as $v) {
@ -879,13 +879,13 @@ class JsonLdProcessor {
// recusively process array values // recusively process array values
foreach($value as $v) { foreach($value as $v) {
$isList = self::_isList($v); $is_list = self::_isList($v);
// compact property // compact property
$prop = $this->_compactIri($ctx, $key, $v); $prop = $this->_compactIri($ctx, $key, $v);
// remove @list for recursion (will be re-added if necessary) // remove @list for recursion (will be re-added if necessary)
if($isList) { if($is_list) {
$v = $v->{'@list'}; $v = $v->{'@list'};
} }
@ -896,7 +896,7 @@ class JsonLdProcessor {
$container = self::getContextValue($ctx, $prop, '@container'); $container = self::getContextValue($ctx, $prop, '@container');
// handle @list // handle @list
if($isList && $container !== '@list') { if($is_list && $container !== '@list') {
// handle messy @list compaction // handle messy @list compaction
if(property_exists($rval, $prop) && $options['strict']) { if(property_exists($rval, $prop) && $options['strict']) {
throw new JsonLdException( throw new JsonLdException(
@ -1034,10 +1034,10 @@ class JsonLdProcessor {
} }
// recurse into @list, @set, or @graph, keeping the active property // recurse into @list, @set, or @graph, keeping the active property
$isList = ($prop === '@list'); $is_list = ($prop === '@list');
if($isList || $prop === '@set' || $prop === '@graph') { if($is_list || $prop === '@set' || $prop === '@graph') {
$value = $this->_expand($ctx, $property, $value, $options, $isList); $value = $this->_expand($ctx, $property, $value, $options, $is_list);
if($isList && self::_isList($value)) { if($is_list && self::_isList($value)) {
throw new JsonLdException( throw new JsonLdException(
'Invalid JSON-LD syntax; lists of lists are not permitted.', 'Invalid JSON-LD syntax; lists of lists are not permitted.',
'jsonld.SyntaxError'); 'jsonld.SyntaxError');
@ -2448,8 +2448,8 @@ class JsonLdProcessor {
// find all possible term matches // find all possible term matches
$terms = array(); $terms = array();
$highest = 0; $highest = 0;
$listContainer = false; $list_container = false;
$isList = self::_isList($value); $is_list = self::_isList($value);
foreach($ctx->mappings as $term => $entry) { foreach($ctx->mappings as $term => $entry) {
$has_container = property_exists($entry, '@container'); $has_container = property_exists($entry, '@container');
@ -2458,15 +2458,15 @@ class JsonLdProcessor {
continue; continue;
} }
// skip @set containers for @lists // skip @set containers for @lists
if($isList && $has_container && $entry->{'@container'} === '@set') { if($is_list && $has_container && $entry->{'@container'} === '@set') {
continue; continue;
} }
// skip @list containers for non-@lists // skip @list containers for non-@lists
if(!$isList && $has_container && $entry->{'@container'} === '@list') { if(!$is_list && $has_container && $entry->{'@container'} === '@list') {
continue; continue;
} }
// for @lists, if listContainer is set, skip non-list containers // for @lists, if list_container is set, skip non-list containers
if($isList && $listContainer && (!$has_container || if($is_list && $list_container && (!$has_container ||
$entry->{'@container'} !== '@list')) { $entry->{'@container'} !== '@list')) {
continue; continue;
} }
@ -2480,9 +2480,9 @@ class JsonLdProcessor {
} }
// for @lists, give preference to @list containers // for @lists, give preference to @list containers
if($isList && !$listContainer && $has_container && if($is_list && !$list_container && $has_container &&
$entry->{'@container'} === '@list') { $entry->{'@container'} === '@list') {
$listContainer = true; $list_container = true;
$terms = array(); $terms = array();
$highest = $rank; $highest = $rank;
$terms[] = $term; $terms[] = $term;