public function search(
        $query,
        $categories = Category::ALL,
        $purity = Purity::SFW,
        $sorting = Sorting::RELEVANCE,
        $order = Order::DESC,
        $resolutions = [],
        $ratios = [],
        $page = 1
    ) {
        $result = $this->client->get(self::URL_SEARCH, [
            'query'   => [
                'q'           => $query,
                'categories'  => self::getBinary($categories),
                'purity'      => self::getBinary($purity),
                'sorting'     => $sorting,
                'order'       => $order,
                'resolutions' => implode(',', $resolutions),
                'ratios'      => implode(',', $ratios),
                'page'        => $page
            ],
            'headers' => [
                'X-Requested-With' => 'XMLHttpRequest'
            ]
        ]);

        $body = $result->getBody()->getContents();
        $dom = new Dom();
        $dom->load($body);

        $figures = $dom->find('figure.thumb');

        $wallpapers = new WallpaperList();

        foreach ($figures as $figure) {
            $id = preg_split('#' . self::URL_HOME . self::URL_WALLPAPER . '/#',
                $figure->find('a.preview')->getAttribute('href'))[1];

            $classText = $figure->getAttribute('class');
            preg_match("/thumb thumb-(sfw|sketchy|nsfw) thumb-(general|anime|people)/", $classText, $classMatches);

            $purity = constant('Wallhaven\Purity::' . strtoupper($classMatches[1]));
            $category = constant('Wallhaven\Category::' . strtoupper($classMatches[2]));
            $resolution = str_replace(' ', '', trim($figure->find('span.wall-res')->text));
            $favorites = (int)$figure->find('.wall-favs')->text;

            $w = new Wallpaper($id, $this->client);

            $w->setProperties([
                'purity'     => $purity,
                'category'   => $category,
                'resolution' => $resolution,
                'favorites'  => $favorites
            ]);

            $wallpapers[] = $w;
        }

        return $wallpapers;
    }