Artesaos\SEOTools\OpenGraph::eachProperties PHP Method

eachProperties() protected method

Make list of open graph tags.
protected eachProperties ( array $properties, null | string $prefix = null, boolean $ogPrefix = true ) : string
$properties array array of properties
$prefix null | string prefix of property
$ogPrefix boolean opengraph prefix
return string
    protected function eachProperties(array $properties, $prefix = null, $ogPrefix = true)
    {
        $html = [];
        foreach ($properties as $property => $value) {
            // multiple properties
            if (is_array($value)) {
                $subListPrefix = is_string($property) ? $property : $prefix;
                $subList = $this->eachProperties($value, $subListPrefix);
                $html[] = $subList;
            } else {
                if (is_string($prefix)) {
                    $key = is_string($property) ? $prefix . ':' . $property : $prefix;
                } else {
                    $key = $property;
                }
                // if empty jump to next
                if (empty($value)) {
                    continue;
                }
                $html[] = $this->makeTag($key, $value, $ogPrefix);
            }
        }
        return implode($html);
    }