<commit_before><?php
/**
 * Nooku Platform - http://www.nooku.org/platform
 *
 * @copyright	Copyright (C) 2011 - 2014 <NAME> and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		https://github.com/nooku/nooku-platform for the canonical source repository
 */

namespace Nooku\Component\Tags;

use Nooku\Library;

/**
 * Taggable Database Behavior
 *   
 * @author  <NAME> <http://github.com/johanjanssens>
 * @package Nooku\Component\Tags
 */
class DatabaseBehaviorTaggable extends Library\DatabaseBehaviorAbstract
{
    /**
     * Initializes the options for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param  Library\ObjectConfig $config A ObjectConfig object with configuration options
     * @return void
     */
    protected function _initialize(Library\ObjectConfig $config)
    {
        $config->append(array(
            'auto_mixin' => true
        ));

        parent::_initialize($config);
    }

    /**
	 * Get a list of tags
	 *
	 * @return Library\DatabaseRowsetInterface
	 */
	public function getTags()
	{
        $model = $this->getObject('com:tags.model.tags');

        if(!$this->isNew())
        {
            $tags = $model->row($this->id)
                ->table($this->getTable()->getName())
                ->fetch();
        }
        else $tags = $model->fetch();

        return $tags;
	}
        
    /**
	 * Modify the select query
	 * 
	 * If the query's where information includes a tag property, auto-join the tags tables with the query and select
     * all the rows that are tagged with a term.
	 */<commit_msg>re #444 - Code cleanup<commit_after><?php
/**
 * Nooku Platform - http://www.nooku.org/platform
 *
 * @copyright	Copyright (C) 2011 - 2014 <NAME>ssens and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		https://github.com/nooku/nooku-platform for the canonical source repository
 */

namespace Nooku\Component\Tags;

use Nooku\Library;

/**
 * Taggable Database Behavior
 *
 * @author  <NAME> <http://github.com/johanjanssens>
 * @package Nooku\Component\Tags
 */
class DatabaseBehaviorTaggable extends Library\DatabaseBehaviorAbstract
{
    /**
	 * Get a list of tags
	 *
	 * @return Library\DatabaseRowsetInterface
	 */
	public function getTags()
	{
        $model = $this->getObject('com:tags.model.tags');

        if(!$this->isNew())
        {
            $tags = $model->row($this->id)
                ->table($this->getTable()->getName())
                ->fetch();
        }
        else $tags = $model->fetch();

        return $tags;
	}

    /**
	 * Modify the select query
	 *
	 * If the query's where information includes a tag property, auto-join the tags tables with the query and select
     * all the rows that are tagged with a term.
	 */
{'fraction_non_alphanumeric': 0.13510711817553558, 'fraction_numerical': 0.007256392536281963, 'mean_word_length': 2.539119804400978, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, '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': '4431755', 'n_tokens_mistral': 922, 'n_tokens_neox': 866, 'n_words': 227}