private function mergeReference($scope, $ref) { if (Utils::isAbsoluteUri($ref)) { return $ref; } $joinedScope = implode('', $scope); $isScopeAbsolute = Utils::isAbsoluteUri($joinedScope); $isScopeRelative = Utils::isRelativeUri($joinedScope); $isRefRelative = Utils::isRelativeUri($ref); if ($isScopeAbsolute && $isRefRelative) { $toRemove = preg_match('/\\/[^\\/]*$/', $joinedScope, $matches, PREG_OFFSET_CAPTURE); if ($toRemove === 1) { list(, $index) = $matches[0]; $joinedScope = substr($joinedScope, 0, $index + 1); } } else { if ($isScopeRelative && $isRefRelative) { $joinedScope = ""; } else { $toRemove = preg_match('/[^#\\/]+$/', $joinedScope, $matches, PREG_OFFSET_CAPTURE); if ($toRemove === 1) { list(, $index) = $matches[0]; $joinedScope = substr($joinedScope, 0, $index + 1); } } } return preg_replace('/##/', '#', $joinedScope . $ref); }
public function isPatternProperties(Report $report, $schema, $key) { if (!is_object($schema->{$key})) { $report->addError('KEYWORD_TYPE_EXPECTED', [$key, 'object']); return; } $report->pathPush($key); foreach ($schema->{$key} as $i => $value) { if (preg_match(Utils::regex($i), null) === false) { $report->addError('KEYWORD_PATTERN', [$key, Utils::regex($i)]); } $report->pathPush($i); $this->validateSchema($report, $schema->{$key}->{$i}); $report->pathPop(); } $report->pathPop(); }