private function calculateMethodPriorities($resourceMetadata)
    {
        $methodPriorities = array();

        foreach ($resourceMetadata->getMethods() as $key => $methodMetadata) {
            if ($key != 'setup') {
                foreach ($methodMetadata->getConditions() as $conditionName => $conditionValues) {
                    if (method_exists($this, $conditionName)) {
                        $this->currentMethodName = $key;
                        $success = false;
                        $error = null;
                        if (!$conditionValues) { // empty condition, process once for null value
                            $conditionValues[] = null;
                        }
                        foreach ($conditionValues as $params) {
                            if (!isset($methodPriorities[$key]['value'])) {
                                $methodPriorities[$key]['value'] = 0;
                            }
                            try {
                                $condition = call_user_func_array(array($this, $conditionName), str_getcsv($params, ' '));
                                if ($condition === true) $condition = 1;
                                if (is_numeric($condition)) {
                                    $methodPriorities[$key]['value'] += $condition;
                                } elseif ($condition) {
                                    $methodPriorities[$key]['value']++;
                                    $methodPriorities[$key]['response'] = $condition;
                                }
                                $success = true;
                            } catch (ConditionException $e) {
                                unset($methodPriorities[$key]);
                                break 2;
                            } catch (Exception $e) {
                                $error = $e;
                            }
                        }
                        if (!$success && $error) {
                            $methodPriorities[$key]['exception'] = $error;
                            break;
                        }
                    } else {
                        throw new \Exception(sprintf(
                            'Condition method "%s" not found in Resource class "%s"',
                            $conditionName,
                            get_class($this)
                        ));
                    }
                }
            }
        }

        return $methodPriorities;
    }