private function parseAttributes(string $attributeString): Attributes
    {
        $attributes = new Attributes();

        array_map(
            function ($attribute) use ($attributes) {
                $attribute = trim($attribute);

                if (!$attribute) {
                    // @codingStandardsIgnoreStart
                    // phpcs thinks this return statement belongs to the method
                    return;
                    // @codingStandardsIgnoreEnd
                }

                if (preg_match('/([^=]*)="([^"]*)"/', $attribute, $matches)) {
                    $attributes->setAttribute($matches[1], $matches[2]);
                } else {
                    $attributes->setAttribute($attribute, true);
                }
            },
            explode(' ', $attributeString)
        );

        return $attributes;
    }