/** * Returns the ID * * @return string */ public function getId() { if (isset($this->id)) { return $this->id; } $ignoreKeys = array(); if (isset($this->ignoreKeys)) { $ignoreKeys = $this->ignoreKeys; } // Filter ignored keys $hashData = Arr::filterKeys($this->data, $ignoreKeys, true); return md5(serialize($hashData)); }
/** * @covers Fuel\Common\Arr::filterKeys * @group Common */ public function testFilterKeys() { $input = array("user_name" => "John", "user_surname" => "Lastname", "project_name" => "Fuel", "project_type" => "Framework"); $expected = array('project_name' => 'Fuel', 'user_name' => 'John'); $result = Arr::filterKeys($input, array('project_name', 'user_name')); $this->assertEquals($expected, $result); $expected = array('project_name' => 'Fuel', 'project_type' => 'Framework'); $result = Arr::filterKeys($input, array('user_name', 'user_surname'), true); $this->assertEquals($expected, $result); }