{"action":"created","comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/24604174","id":24604174,"diff_hunk":"@@ -176,25 +141,72 @@ public function bind($data)\n \t */\n \tprotected function bindLevel($group, $data)\n \t{\n-\t\t// Ensure the input data is an array.\n-\t\tsettype($data, 'array');\n-\n+\t\t$data = $this->toArray($data);\n+\t\t\n \t\t// Process the input data.\n-\t\tforeach ($data as $k => $v)\n+\t\tforeach ($data as $name => $value)\n \t\t{\n-\t\t\tif ($this->findField($k, $group))\n+\t\t\tif ($this->findField($name, $group))\n \t\t\t{\n+\t\t\t\t$name = $this->getGroupName($name, $group);\n+\t\t\t\t\n \t\t\t\t// If the field exists set the value.\n-\t\t\t\t$this->data->set($group . '.' . $k, $v);\n+\t\t\t\t$this->data->set($name, $value);\n \t\t\t}\n-\t\t\telseif (is_object($v) || JArrayHelper::isAssociative($v))\n+\t\t\telseif (is_object($value) || JArrayHelper::isAssociative($value))\n \t\t\t{\n-\t\t\t\t// If the value is an object or an associative array, hand it off to the recursive bind level method\n-\t\t\t\t$this->bindLevel($group . '.' . $k, $v);\n+\t\t\t\t$name = $this->getGroupName($name, $group);\n+\t\t\t\t\n+\t\t\t\t// If the value is an object or an associative array hand it off to the recursive bind level method.\n+\t\t\t\t$this->bindLevel($name, $value);\n \t\t\t}\n \t\t}\n \t}\n-\n+\t\n+\t/**\n+\t * Method to convert the data into an array\n+\t *\n+\t * @param   mixed  $data  object or array to normalize\n+\t *\n+\t * @return array\n+\t */\n+\tprotected function toArray($data)\n+\t{\n+\t\tif (is_array($data)) \n+\t\t{\n+\t\t\t// nothing to do\n+\t\t\treturn $data;\n+\t\t}\n+\t\t\n+\t\tif (is_callable(array($data, 'toArray')))\n+\t\t{\n+\t\t\treturn $data->toArray();\n+\t\t}\n+\t\t\n+\t\tif (is_callable(array($data, 'getProperties')))\n+\t\t{\n+\t\t\treturn $data->getProperties();\n+\t\t}\n+\t\treturn (array) $data;\n+\t}\n+\t\n+\t/**\n+\t * Method to get a dot delimited group name\n+\t *\n+\t * @param   string  $name   of the field within the group\n+\t * @param   string  $group  The dot-separated form group path\n+\t *\n+\t * @return string\n+\t */\n+\tprotected function getGroupName($name, $group = null)","path":"libraries/joomla/form/form.php","position":122,"original_position":122,"commit_id":"4306b6b27909820a7b508675e3987e3f48cbfbf8","original_commit_id":"4306b6b27909820a7b508675e3987e3f48cbfbf8","user":{"login":"Mathewlenning","id":3743651,"avatar_url":"https://avatars.githubusercontent.com/u/3743651?v=3","gravatar_id":"","url":"https://api.github.com/users/Mathewlenning","html_url":"https://github.com/Mathewlenning","followers_url":"https://api.github.com/users/Mathewlenning/followers","following_url":"https://api.github.com/users/Mathewlenning/following{/other_user}","gists_url":"https://api.github.com/users/Mathewlenning/gists{/gist_id}","starred_url":"https://api.github.com/users/Mathewlenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mathewlenning/subscriptions","organizations_url":"https://api.github.com/users/Mathewlenning/orgs","repos_url":"https://api.github.com/users/Mathewlenning/repos","events_url":"https://api.github.com/users/Mathewlenning/events{/privacy}","received_events_url":"https://api.github.com/users/Mathewlenning/received_events","type":"User","site_admin":false},"body":"4. Added getGroupName method so that we can avoid repeating\r\n\r\n$this->data->get($group . '.' . $name, $default);  && $this->data->set($group . '.' . $name, $value);","created_at":"2015-02-12T18:28:18Z","updated_at":"2015-02-12T18:28:18Z","html_url":"https://github.com/joomla/joomla-cms/pull/6072#discussion_r24604174","pull_request_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072","_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/24604174"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/6072#discussion_r24604174"},"pull_request":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072"}}},"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072","id":29200666,"html_url":"https://github.com/joomla/joomla-cms/pull/6072","diff_url":"https://github.com/joomla/joomla-cms/pull/6072.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/6072.patch","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/6072","number":6072,"state":"open","locked":false,"title":"REDO Small JForm Improvements #6067","user":{"login":"Mathewlenning","id":3743651,"avatar_url":"https://avatars.githubusercontent.com/u/3743651?v=3","gravatar_id":"","url":"https://api.github.com/users/Mathewlenning","html_url":"https://github.com/Mathewlenning","followers_url":"https://api.github.com/users/Mathewlenning/followers","following_url":"https://api.github.com/users/Mathewlenning/following{/other_user}","gists_url":"https://api.github.com/users/Mathewlenning/gists{/gist_id}","starred_url":"https://api.github.com/users/Mathewlenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mathewlenning/subscriptions","organizations_url":"https://api.github.com/users/Mathewlenning/orgs","repos_url":"https://api.github.com/users/Mathewlenning/repos","events_url":"https://api.github.com/users/Mathewlenning/events{/privacy}","received_events_url":"https://api.github.com/users/Mathewlenning/received_events","type":"User","site_admin":false},"body":"Untainted version of #6067 ","created_at":"2015-02-12T17:52:52Z","updated_at":"2015-02-12T18:28:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"63c0f24d7a7826beb01e8be84569c7023f535be0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072/commits","review_comments_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072/comments","review_comment_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/{number}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/6072/comments","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/4306b6b27909820a7b508675e3987e3f48cbfbf8","head":{"label":"Mathewlenning:JForm-Cleaning","ref":"JForm-Cleaning","sha":"4306b6b27909820a7b508675e3987e3f48cbfbf8","user":{"login":"Mathewlenning","id":3743651,"avatar_url":"https://avatars.githubusercontent.com/u/3743651?v=3","gravatar_id":"","url":"https://api.github.com/users/Mathewlenning","html_url":"https://github.com/Mathewlenning","followers_url":"https://api.github.com/users/Mathewlenning/followers","following_url":"https://api.github.com/users/Mathewlenning/following{/other_user}","gists_url":"https://api.github.com/users/Mathewlenning/gists{/gist_id}","starred_url":"https://api.github.com/users/Mathewlenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mathewlenning/subscriptions","organizations_url":"https://api.github.com/users/Mathewlenning/orgs","repos_url":"https://api.github.com/users/Mathewlenning/repos","events_url":"https://api.github.com/users/Mathewlenning/events{/privacy}","received_events_url":"https://api.github.com/users/Mathewlenning/received_events","type":"User","site_admin":false},"repo":{"id":30701297,"name":"joomla-cms","full_name":"Mathewlenning/joomla-cms","owner":{"login":"Mathewlenning","id":3743651,"avatar_url":"https://avatars.githubusercontent.com/u/3743651?v=3","gravatar_id":"","url":"https://api.github.com/users/Mathewlenning","html_url":"https://github.com/Mathewlenning","followers_url":"https://api.github.com/users/Mathewlenning/followers","following_url":"https://api.github.com/users/Mathewlenning/following{/other_user}","gists_url":"https://api.github.com/users/Mathewlenning/gists{/gist_id}","starred_url":"https://api.github.com/users/Mathewlenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mathewlenning/subscriptions","organizations_url":"https://api.github.com/users/Mathewlenning/orgs","repos_url":"https://api.github.com/users/Mathewlenning/repos","events_url":"https://api.github.com/users/Mathewlenning/events{/privacy}","received_events_url":"https://api.github.com/users/Mathewlenning/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mathewlenning/joomla-cms","description":"Home of the Joomla! Content Management System","fork":true,"url":"https://api.github.com/repos/Mathewlenning/joomla-cms","forks_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/forks","keys_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/teams","hooks_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/events","assignees_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/tags","blobs_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/subscription","commits_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/issues/comments/{number}","contents_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/merges","archive_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/downloads","issues_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/Mathewlenning/joomla-cms/releases{/id}","created_at":"2015-02-12T12:25:22Z","updated_at":"2015-02-12T12:25:36Z","pushed_at":"2015-02-12T18:08:50Z","git_url":"git://github.com/Mathewlenning/joomla-cms.git","ssh_url":"git@github.com:Mathewlenning/joomla-cms.git","clone_url":"https://github.com/Mathewlenning/joomla-cms.git","svn_url":"https://github.com/Mathewlenning/joomla-cms","homepage":"http://joomla.org","size":304447,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"staging"}},"base":{"label":"joomla:staging","ref":"staging","sha":"a1e77191d94a293918b4d0d41bfb92052e1b9eb4","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"repo":{"id":2464908,"name":"joomla-cms","full_name":"joomla/joomla-cms","owner":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla/joomla-cms","description":"Home of the Joomla! Content Management System","fork":false,"url":"https://api.github.com/repos/joomla/joomla-cms","forks_url":"https://api.github.com/repos/joomla/joomla-cms/forks","keys_url":"https://api.github.com/repos/joomla/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla/joomla-cms/teams","hooks_url":"https://api.github.com/repos/joomla/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/joomla/joomla-cms/events","assignees_url":"https://api.github.com/repos/joomla/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/joomla/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/joomla/joomla-cms/tags","blobs_url":"https://api.github.com/repos/joomla/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/joomla/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/joomla/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/joomla/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/joomla/joomla-cms/subscription","commits_url":"https://api.github.com/repos/joomla/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/{number}","contents_url":"https://api.github.com/repos/joomla/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/joomla/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla/joomla-cms/merges","archive_url":"https://api.github.com/repos/joomla/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla/joomla-cms/downloads","issues_url":"https://api.github.com/repos/joomla/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/joomla/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/joomla/joomla-cms/releases{/id}","created_at":"2011-09-27T02:07:38Z","updated_at":"2015-02-12T16:47:34Z","pushed_at":"2015-02-12T17:20:18Z","git_url":"git://github.com/joomla/joomla-cms.git","ssh_url":"git@github.com:joomla/joomla-cms.git","clone_url":"https://github.com/joomla/joomla-cms.git","svn_url":"https://github.com/joomla/joomla-cms","homepage":"http://joomla.org","size":304447,"stargazers_count":1434,"watchers_count":1434,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1592,"mirror_url":null,"open_issues_count":531,"forks":1592,"open_issues":531,"watchers":1434,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/6072"},"issue":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/6072"},"comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/6072/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6072/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/joomla-cms/statuses/4306b6b27909820a7b508675e3987e3f48cbfbf8"}}}}