protected function checkScope($requiredScope, $availableScope)
{
// The required scope should match or be a subset of the available scope
if (!is_array($requiredScope)) {
$requiredScope = explode(' ', trim($requiredScope));
}
if (!is_array($availableScope)) {
$availableScope = explode(' ', trim($availableScope));
}
return count(array_diff($requiredScope, $availableScope)) == 0;
}