protected function prepareListItem(array &$libraries, $library_id, array &$library)
    {
        if (empty($library['type'])) {
            unset($libraries[$library_id]);
            return null;
        }

        $types = $this->getTypes();

        if (empty($types[$library['type']])) {
            unset($libraries[$library_id]);
            return null;
        }

        $library['id'] = $library_id;

        if (!isset($library['basepath'])) {
            if (isset($library['vendor'])) {
                $library['vendor'] = strtolower($library['vendor']);
                $library['basepath'] = GC_DIR_VENDOR . "/{$library['vendor']}";
            } else if (isset($types[$library['type']]['basepath'])) {
                $library['basepath'] = "{$types[$library['type']]['basepath']}/$library_id";
            } else {
                unset($libraries[$library_id]);
                return null;
            }
        }

        if ($library['type'] === 'php' && empty($library['files']) && !empty($library['vendor'])) {
            $library['files'] = array(GC_FILE_AUTOLOAD);
        }

        if (!isset($library['version'])) {
            $library['errors'][] = array('Unknown version', array());
        }

        if (!$this->validateFiles($library)) {
            $library['errors'][] = array('Missing files', array());
        }

        return null;
    }