<commit_before><commit_msg>Added a Rich Snippet builder.<commit_after><?php namespace Noherczeg\Breadcrumb\Builders;

class RichSnippetBuilder extends Builder
{

    public function __construct ($segments, $base_url)
    {
        parent::__construct($segments, $base_url);
    }

    /**
     * build: The builder method which creates HTML style breadcrumbs
     * 
     * @param String|null $casing       Casing option
     * @param boolean $last_not_link    True if last shouldn't be a link
     * @param String|null $separator    Separator String
     * @param array $customizations     Array of properties + values
     * @param String|null $ul_class     Class of <ul> element
     * @return String
     */
    public function build ($casing = null, $last_not_link = true, $separator = null, $properties = array(), $ul_class = null, $different_links = false )
    {
        // always create link on build stage!
        $this->link($last_not_link, $different_links);
        
        // handle defaults
        (is_null($separator))   ? $ts = $this->config->value('separator')      : $ts = $separator;
        (is_null($casing))      ? $tc = $this->config->value('casing') : $tc = $casing;
        (is_null($ul_class))    ? $tu = '' : $tu = ' class="' . $ul_class . '"';

        $result = "<ul{$tu}>";
        
        foreach ($this->segments AS $key => $segment)
		{
            
            // ignore separator after the last element
            if ($key > 0) {
                $result .= $ts;
            }
            
			if (is_null($segment->get('link'))) {
				$result .= '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span' . $this->properties($properties) . ' itemprop="title">' . $this->casing($segment->get('translated'), $tc) . '</span></li>';
			} else {
				$result .= '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . $segment->get('link') . '" ' . $this->properties($properties) . ' itemprop="url">' . '<span itemprop="title">' . $this->casing($segment->get('translated'), $tc) . '</span>' . '</a></li>';
			}
		}

		return $result . '</ul>';
    }
}
{'fraction_non_alphanumeric': 0.17138810198300283, 'fraction_numerical': 0.00047214353163361664, 'mean_word_length': 2.597623089983022, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4820466', 'n_tokens_mistral': 674, 'n_tokens_neox': 640, 'n_words': 150}