<commit_before><?php

/**
 * @copyright   Copyright (c) 2015 ublaboo <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @package     Ublaboo
 */

namespace Ublaboo\DataGrid;

use Nette;
use LeanMapper;
use DibiRow;
use Ublaboo\DataGrid\Utils\PropertyAccessHelper;

class Row extends Nette\Object
{

	/**
	 * @var DataGrid
	 */
	protected $datagrid;

	/**
	 * @var mixed
	 */
	protected $item;

	/**
	 * @var string
	 */
	protected $primary_key;

	/**
	 * @var mixed
	 */
	protected $id;


	/**
	 * @param mixed  $item
	 * @param string $primary_key
	 */
	public function __construct(DataGrid $datagrid, $item, $primary_key)
	{
		$this->datagrid = $datagrid;
		$this->item = $item;
		$this->primary_key = $primary_key;

		$this->id = is_object($item) ? $item->{$primary_key} : $item[$primary_key];
	}


	/**
	 * Get id value of item
	 * @return mixed
	 */
	public function getId()
	{
		return $this->id;
	}


	/**
	 * Get item value of key
	 * @param  mixed $key
	 * @return mixed
	 */<commit_msg>Row: Fixed getting row Id using internal value getter<commit_after><?php

/**
 * @copyright   Copyright (c) 2015 ublaboo <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @package     Ublaboo
 */

namespace Ublaboo\DataGrid;

use Nette;
use LeanMapper;
use DibiRow;
use Ublaboo\DataGrid\Utils\PropertyAccessHelper;

class Row extends Nette\Object
{

	/**
	 * @var DataGrid
	 */
	protected $datagrid;

	/**
	 * @var mixed
	 */
	protected $item;

	/**
	 * @var string
	 */
	protected $primary_key;

	/**
	 * @var mixed
	 */
	protected $id;


	/**
	 * @param mixed  $item
	 * @param string $primary_key
	 */
	public function __construct(DataGrid $datagrid, $item, $primary_key)
	{
		$this->datagrid = $datagrid;
		$this->item = $item;
		$this->primary_key = $primary_key;
		$this->id = $this->getValue($primary_key);
	}


	/**
	 * Get id value of item
	 * @return mixed
	 */
	public function getId()
	{
		return $this->id;
	}


	/**
	 * Get item value of key
	 * @param  mixed $key
	 * @return mixed
	 */
{'fraction_non_alphanumeric': 0.15694164989939638, 'fraction_numerical': 0.004024144869215292, 'mean_word_length': 2.978, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, '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': '6736067', 'n_tokens_mistral': 793, 'n_tokens_neox': 716, 'n_words': 178}