<commit_before><?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @license    MIT License
 */

require_once dirname(__FILE__) . '/Index.php';
require_once dirname(__FILE__) . '/../builder/util/PropelTemplate.php';

/**
 * Information about behaviors of a table.
 *
 * @author     <NAME>
 * @version    $Revision$
 * @package    propel.generator.model
 */
class Behavior extends XMLElement
{

	protected $table;
	protected $database;
	protected $name;
	protected $parameters = array();
	protected $isTableModified = false;
	protected $dirname;
	protected $additionalBuilders = array();
	protected $tableModificationOrder = 50;

	/**
	 * Sets the name of the Behavior
	 *
	 * @param string $name the name of the behavior
	 */
	public function setName($name)
	{
		$this->name = $name;
	}

	/**
	 * Returns the name of the Behavior
	 *
	 * @return string
	 */
	public function getName()
	{
		return $this->name;
	}

	/**
	 * Sets the table this behavior is applied to 
	 *
	 * @param Table $table the table this behavior is applied to
	 */
	public function setTable(Table $table)
	{
		$this->table = $table;
	}

	/**
	 * Returns the table this behavior is applied to
	 *
	 * @return Table
	 */
	public function getTable()
	{
		return $this->table;
	}

	/**
	 * Sets the database this behavior is applied to
	 * 
	 * @param Database $database the database this behavior is applied to
	 */
	public function setDatabase(Database $database)
	{
		$this->database = $database;
	}

	/**
	 * Returns the table this behavior is applied to if behavior is applied to <database> element.
	 *
	 * @return Database
	 */
	public function getDatabase()
	{
		return $this->database;
	}

	/**
	 * Add a parameter
	 * Expects an associative array looking like array('name' => 'foo', 'value' => bar)
	 *
	 * @param     array associative array with name and value keys
	 */
	public function addParameter($attribute)
	{
		$attribute = array_change_key_case($attribute, CASE_LOWER);
		$this->parameters[$attribute['name']] = $attribute['value'];
	}

	/**
	 * Overrides the behavior parameters
	 * Expects an associative array looking like array('foo' => 'bar')
	 *
	 * @param     array associative array
	 */
	public function setParameters($parameters)
	{
		$this->parameters = $parameters;
	}

	/**
	 * Get the associative array of parameters
	 * @return    array
	 */
	public function getParameters()
	{
		return $this->parameters;
	}

	public function getParameter($name)
	{
		return $this->parameters[$name];
	}

	/**
	 * Define when this behavior must execute its modifyTable() relative to other behaviors.
	 * The bigger the value, the later the behavior is executed. Default is 50.
	 *
	 * @param $tableModificationOrder integer
	 */
	public function setTableModificationOrder($tableModificationOrder)
	{
		$this->tableModificationOrder = $tableModificationOrder;
	}

	/**
	 * Get when this behavior must execute its modifyTable() relative to other behaviors.
	 * The bigger the value, the later the behavior is executed. Default is 50.
	 *
	 * @return integer
	 */
	public function getTableModificationOrder()
	{
		return $this->tableModificationOrder;
	}
<commit_msg>Prevent notice error if no parameter found. Fixes #190<commit_after><?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @license    MIT License
 */

require_once dirname(__FILE__) . '/Index.php';
require_once dirname(__FILE__) . '/../builder/util/PropelTemplate.php';

/**
 * Information about behaviors of a table.
 *
 * @author     <NAME>
 * @version    $Revision$
 * @package    propel.generator.model
 */
class Behavior extends XMLElement
{

	protected $table;
	protected $database;
	protected $name;
	protected $parameters = array();
	protected $isTableModified = false;
	protected $dirname;
	protected $additionalBuilders = array();
	protected $tableModificationOrder = 50;

	/**
	 * Sets the name of the Behavior
	 *
	 * @param string $name the name of the behavior
	 */
	public function setName($name)
	{
		$this->name = $name;
	}

	/**
	 * Returns the name of the Behavior
	 *
	 * @return string
	 */
	public function getName()
	{
		return $this->name;
	}

	/**
	 * Sets the table this behavior is applied to
	 *
	 * @param Table $table the table this behavior is applied to
	 */
	public function setTable(Table $table)
	{
		$this->table = $table;
	}

	/**
	 * Returns the table this behavior is applied to
	 *
	 * @return Table
	 */
	public function getTable()
	{
		return $this->table;
	}

	/**
	 * Sets the database this behavior is applied to
	 *
	 * @param Database $database the database this behavior is applied to
	 */
	public function setDatabase(Database $database)
	{
		$this->database = $database;
	}

	/**
	 * Returns the table this behavior is applied to if behavior is applied to <database> element.
	 *
	 * @return Database
	 */
	public function getDatabase()
	{
		return $this->database;
	}

	/**
	 * Add a parameter
	 * Expects an associative array looking like array('name' => 'foo', 'value' => bar)
	 *
	 * @param     array associative array with name and value keys
	 */
	public function addParameter($attribute)
	{
		$attribute = array_change_key_case($attribute, CASE_LOWER);
		$this->parameters[$attribute['name']] = $attribute['value'];
	}

	/**
	 * Overrides the behavior parameters
	 * Expects an associative array looking like array('foo' => 'bar')
	 *
	 * @param     array associative array
	 */
	public function setParameters($parameters)
	{
		$this->parameters = $parameters;
	}

	/**
	 * Get the associative array of parameters
	 * @return    array
	 */
	public function getParameters()
	{
		return $this->parameters;
	}

	public function getParameter($name)
    {
        if (isset($this->parameters[$name])) {
            return $this->parameters[$name];
        }

        return null;
	}

	/**
	 * Define when this behavior must execute its modifyTable() relative to other behaviors.
	 * The bigger the value, the later the behavior is executed. Default is 50.
	 *
	 * @param $tableModificationOrder integer
	 */
	public function setTableModificationOrder($tableModificationOrder)
	{
		$this->tableModificationOrder = $tableModificationOrder;
	}

	/**
	 * Get when this behavior must execute its modifyTable() relative to other behaviors.
	 * The bigger the value, the later the behavior is executed. Default is 50.
	 *
	 * @return integer
	 */
	public function getTableModificationOrder()
	{
		return $this->tableModificationOrder;
	}

{'fraction_non_alphanumeric': 0.1105475160375951, 'fraction_numerical': 0.0022378039683723706, 'mean_word_length': 3.448573324485733, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 38, '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': '2247502', 'n_tokens_mistral': 2042, 'n_tokens_neox': 1863, 'n_words': 660}