protected function validateDependency(&$item, $items, $enabled = false)
    {
        if (empty($item['dependencies'])) {
            return null;
        }

        foreach ($item['dependencies'] as $id => $version) {

            if (!isset($items[$id])) {
                $item['errors'][] = array('Unknown dependency @id', array('@id' => $id));
                continue;
            }

            if ($enabled && empty($items[$id]['status'])) {
                $item['errors'][] = array('Requires @id to be enabled', array('@id' => $items[$id]['name']));
                continue;
            }

            $components = $this->getVersionComponents($version);

            if (empty($components)) {
                $item['errors'][] = array('Unknown version of @name', array('@name' => $id));
                continue;
            }

            list($operator, $number) = $components;

            if ($operator === '=' && strpos($number, 'x') !== false) {
                $allowed = version_compare($items[$id]['version'], $number);
            } else {
                $allowed = version_compare($items[$id]['version'], $number, $operator);
            }

            if (!$allowed) {
                $item['errors'][] = array('Requires incompatible version of @name', array('@name' => $id));
            }
        }

        return null;
    }