<commit_before><?php namespace Brouwers\Shortcodes\Compilers;

class Shortcode {

    /**
     * Shortcode name
     * @var [type]
     */
    protected $name;

    /**
     * Shortcode Attributes
     * @var array
     */
    protected $attributes = array();

    /**
     * Shortcode content
     * @var [type]
     */
    public $content;

    /**
     * Constructor
     * @param [type] $name       [description]
     * @param array  $attributes [description]
     * @param [type] $content    [description]
     */
    public function __construct($name, $attributes = array(), $content)
    {
        $this->name       = $name;
        $this->attributes = $attributes;
        $this->content    = $content;
    }

    /**
     * Get html attribute
     * @param  [type] $attribute [description]
     * @return [type]            [description]
     */
    public function get($attribute)
    {
        $value = $this->{$attribute};

        if(!is_null($value))
            return $attribute . '="' . $value . '"';
    }

    /**
     * Get shortcode name
     * @return [type] [description]
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Get shortcode attributes
     * @return [type] [description]
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * Return array of attributes;
     * @return [type] [description]
     */
    public function toArray()
    {
        return $this->attributes;
    }

    /**
     * Dynamically get attributes
     * @param  [type] $param [description]
     * @return [type]        [description]
     */
    public function __get($param)
    {
        return isset($this->attributes[$param]) ? $this->attributes[$param] : null;
    }

}<commit_msg>Shortcode register helper fallback<commit_after><?php namespace Brouwers\Shortcodes\Compilers;

class Shortcode {

    /**
     * Shortcode name
     * @var string
     */
    protected $name;

    /**
     * Shortcode Attributes
     * @var array
     */
    protected $attributes = array();

    /**
     * Shortcode content
     * @var string
     */
    public $content;

    /**
     * Constructor
     * @param string $name
     * @param array  $attributes
     * @param string $content
     */
    public function __construct($name, $attributes = array(), $content)
    {
        $this->name       = $name;
        $this->attributes = $attributes;
        $this->content    = $content;
    }

    /**
     * Get html attribute
     * @param  string $attribute
     * @return string|null
     */
    public function get($attribute, $fallback = null)
    {
        $value = $this->{$attribute};

        if(!is_null($value))
        {
            return $attribute . '="' . $value . '"';
        }
        elseif(!is_null($fallback))
        {
            return $attribute . '="' . $fallback . '"';
        }
    }

    /**
     * Get shortcode name
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Get shortcode attributes
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * Return array of attributes;
     * @return array
     */
    public function toArray()
    {
        return $this->attributes;
    }

    /**
     * Dynamically get attributes
     * @param  string $param
     * @return string|null
     */
    public function __get($param)
    {
        return isset($this->attributes[$param]) ? $this->attributes[$param] : null;
    }

}
{'fraction_non_alphanumeric': 0.13953488372093023, 'fraction_numerical': 0.0, 'mean_word_length': 1.763157894736842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6030646', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1027, 'n_words': 237}