{"action":"created","comment":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/22447142","id":22447142,"diff_hunk":"@@ -0,0 +1,89 @@\n+<?php\n+/**\n+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)\n+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)\n+ *\n+ * Licensed under The MIT License\n+ * For full copyright and license information, please see the LICENSE.txt\n+ * Redistributions of files must retain the above copyright notice.\n+ *\n+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)\n+ * @link          http://cakephp.org CakePHP(tm) Project\n+ * @since         3.0.0\n+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License\n+ */\n+namespace Cake\\Core\\Configure\\Engine;\n+\n+use Cake\\Core\\Configure\\ConfigEngineInterface;\n+use Cake\\Core\\Configure\\FileConfigTrait;\n+use Cake\\Core\\Exception\\Exception;\n+use Cake\\Core\\Plugin;\n+\n+/**\n+ * JSON engine allows Configure to load configuration values from\n+ * files containing JSON strings.\n+ */\n+class JsonConfig implements ConfigEngineInterface\n+{\n+\n+    use FileConfigTrait;\n+\n+    /**\n+     * File extension.\n+     *\n+     * @var string\n+     */\n+    protected $_extension = '.json';\n+\n+    /**\n+     * Constructor for JSON Config file reading.\n+     *\n+     * @param string|null $path The path to read config files from. Defaults to CONFIG.\n+     */\n+    public function __construct($path = null)\n+    {\n+        if ($path === null) {\n+            $path = CONFIG;\n+        }\n+        $this->_path = $path;\n+    }\n+\n+    /**\n+     * Read a config file and return its contents.\n+     *\n+     * Files with `.` in the name will be treated as values in plugins. Instead of\n+     * reading from the initialized path, plugin keys will be located using Plugin::path().\n+     *\n+     * @param string $key The identifier to read from. If the key has a . it will be treated\n+     *   as a plugin prefix.\n+     * @return array Parsed configuration values.\n+     * @throws \\Cake\\Core\\Exception\\Exception When files don't exist or when\n+     *   files contain '..' (as this could lead to abusive reads) or when there\n+     *   is an error parsing the JSON string.\n+     */\n+    public function read($key)\n+    {\n+        $file = $this->_getFilePath($key, true);\n+\n+        $values = json_decode(file_get_contents($file), true);\n+        if (json_last_error() !== JSON_ERROR_NONE) {","path":"src/Core/Configure/Engine/JsonConfig.php","position":null,"original_position":69,"commit_id":"c3fd5ab1c9bf4413c2ccb24f6df4cd11bd91e5db","original_commit_id":"cc36f19c766dfeca49fb74d6f6f571d237235c24","user":{"login":"ADmad","id":142658,"avatar_url":"https://avatars.githubusercontent.com/u/142658?v=3","gravatar_id":"","url":"https://api.github.com/users/ADmad","html_url":"https://github.com/ADmad","followers_url":"https://api.github.com/users/ADmad/followers","following_url":"https://api.github.com/users/ADmad/following{/other_user}","gists_url":"https://api.github.com/users/ADmad/gists{/gist_id}","starred_url":"https://api.github.com/users/ADmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ADmad/subscriptions","organizations_url":"https://api.github.com/users/ADmad/orgs","repos_url":"https://api.github.com/users/ADmad/repos","events_url":"https://api.github.com/users/ADmad/events{/privacy}","received_events_url":"https://api.github.com/users/ADmad/received_events","type":"User","site_admin":false},"body":"@lorenzo Done\r\n\r\n@markstory `json_last_error_msg()` is only available since PHP 5.5. Should I add a function to basics.php like shown here http://php.net/manual/en/function.json-last-error-msg.php#113243 ?  It would be useful in showing specific error in JsonView too.","created_at":"2015-01-05T04:08:05Z","updated_at":"2015-01-05T04:08:05Z","html_url":"https://github.com/cakephp/cakephp/pull/5564#discussion_r22447142","pull_request_url":"https://api.github.com/repos/cakephp/cakephp/pulls/5564","_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/22447142"},"html":{"href":"https://github.com/cakephp/cakephp/pull/5564#discussion_r22447142"},"pull_request":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5564"}}},"pull_request":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/5564","id":26792494,"html_url":"https://github.com/cakephp/cakephp/pull/5564","diff_url":"https://github.com/cakephp/cakephp/pull/5564.diff","patch_url":"https://github.com/cakephp/cakephp/pull/5564.patch","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/5564","number":5564,"state":"open","locked":false,"title":"3.0 config engine","user":{"login":"ADmad","id":142658,"avatar_url":"https://avatars.githubusercontent.com/u/142658?v=3","gravatar_id":"","url":"https://api.github.com/users/ADmad","html_url":"https://github.com/ADmad","followers_url":"https://api.github.com/users/ADmad/followers","following_url":"https://api.github.com/users/ADmad/following{/other_user}","gists_url":"https://api.github.com/users/ADmad/gists{/gist_id}","starred_url":"https://api.github.com/users/ADmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ADmad/subscriptions","organizations_url":"https://api.github.com/users/ADmad/orgs","repos_url":"https://api.github.com/users/ADmad/repos","events_url":"https://api.github.com/users/ADmad/events{/privacy}","received_events_url":"https://api.github.com/users/ADmad/received_events","type":"User","site_admin":false},"body":"I extracted the common code required for file based config engines into a trait for DRYness.\r\n\r\nAlso the `$key` passed to `read()` / `dump() `should no longer contain file extension. Keys should be engine agnostic and the support for keys with extension was only kept for backwards compatibility with 1.x when config engines were introduced in 2.x.","created_at":"2015-01-04T08:26:40Z","updated_at":"2015-01-05T04:08:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8fe061c9a0b74c8b3f2db87efaf0c85bf046b9d2","assignee":null,"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/7","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/7/labels","id":453043,"number":7,"title":"3.0.0","description":"New major release that breaks compatibility with 2.x\r\n\r\n- PHP5.4.19+\r\n- New ORM & behaviors.\r\n- Improved Routing\r\n- PSR-0 and composer support.\r\n- Simpler configuration and bootstrapping.\r\n- Improved configuration handling.\r\n- Improved bake.\r\n\r\nSee [the roadmap](http://github.com/cakephp/cakephp/wiki/3.0-roadmap) for more details.","creator":{"login":"lh-import","id":5175817,"avatar_url":"https://avatars.githubusercontent.com/u/5175817?v=3","gravatar_id":"","url":"https://api.github.com/users/lh-import","html_url":"https://github.com/lh-import","followers_url":"https://api.github.com/users/lh-import/followers","following_url":"https://api.github.com/users/lh-import/following{/other_user}","gists_url":"https://api.github.com/users/lh-import/gists{/gist_id}","starred_url":"https://api.github.com/users/lh-import/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lh-import/subscriptions","organizations_url":"https://api.github.com/users/lh-import/orgs","repos_url":"https://api.github.com/users/lh-import/repos","events_url":"https://api.github.com/users/lh-import/events{/privacy}","received_events_url":"https://api.github.com/users/lh-import/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":2082,"state":"open","created_at":"2013-10-11T20:56:23Z","updated_at":"2015-01-04T23:08:52Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/cakephp/cakephp/pulls/5564/commits","review_comments_url":"https://api.github.com/repos/cakephp/cakephp/pulls/5564/comments","review_comment_url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/{number}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/5564/comments","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/c3fd5ab1c9bf4413c2ccb24f6df4cd11bd91e5db","head":{"label":"cakephp:3.0-config-engine","ref":"3.0-config-engine","sha":"c3fd5ab1c9bf4413c2ccb24f6df4cd11bd91e5db","user":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"repo":{"id":656494,"name":"cakephp","full_name":"cakephp/cakephp","owner":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cakephp/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":false,"url":"https://api.github.com/repos/cakephp/cakephp","forks_url":"https://api.github.com/repos/cakephp/cakephp/forks","keys_url":"https://api.github.com/repos/cakephp/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cakephp/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cakephp/cakephp/teams","hooks_url":"https://api.github.com/repos/cakephp/cakephp/hooks","issue_events_url":"https://api.github.com/repos/cakephp/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/cakephp/cakephp/events","assignees_url":"https://api.github.com/repos/cakephp/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/cakephp/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/cakephp/cakephp/tags","blobs_url":"https://api.github.com/repos/cakephp/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cakephp/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cakephp/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cakephp/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/cakephp/cakephp/languages","stargazers_url":"https://api.github.com/repos/cakephp/cakephp/stargazers","contributors_url":"https://api.github.com/repos/cakephp/cakephp/contributors","subscribers_url":"https://api.github.com/repos/cakephp/cakephp/subscribers","subscription_url":"https://api.github.com/repos/cakephp/cakephp/subscription","commits_url":"https://api.github.com/repos/cakephp/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cakephp/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cakephp/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/{number}","contents_url":"https://api.github.com/repos/cakephp/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/cakephp/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cakephp/cakephp/merges","archive_url":"https://api.github.com/repos/cakephp/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cakephp/cakephp/downloads","issues_url":"https://api.github.com/repos/cakephp/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/cakephp/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/cakephp/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/cakephp/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cakephp/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/cakephp/cakephp/releases{/id}","created_at":"2010-05-08T14:38:22Z","updated_at":"2015-01-05T00:52:29Z","pushed_at":"2015-01-05T03:59:57Z","git_url":"git://github.com/cakephp/cakephp.git","ssh_url":"git@github.com:cakephp/cakephp.git","clone_url":"https://github.com/cakephp/cakephp.git","svn_url":"https://github.com/cakephp/cakephp","homepage":"http://cakephp.org","size":147369,"stargazers_count":5413,"watchers_count":5413,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2388,"mirror_url":null,"open_issues_count":111,"forks":2388,"open_issues":111,"watchers":5413,"default_branch":"master"}},"base":{"label":"cakephp:3.0","ref":"3.0","sha":"774f2555674ae4427465a5e4e2af3d16b2dbcf8d","user":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"repo":{"id":656494,"name":"cakephp","full_name":"cakephp/cakephp","owner":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cakephp/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":false,"url":"https://api.github.com/repos/cakephp/cakephp","forks_url":"https://api.github.com/repos/cakephp/cakephp/forks","keys_url":"https://api.github.com/repos/cakephp/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cakephp/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cakephp/cakephp/teams","hooks_url":"https://api.github.com/repos/cakephp/cakephp/hooks","issue_events_url":"https://api.github.com/repos/cakephp/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/cakephp/cakephp/events","assignees_url":"https://api.github.com/repos/cakephp/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/cakephp/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/cakephp/cakephp/tags","blobs_url":"https://api.github.com/repos/cakephp/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cakephp/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cakephp/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cakephp/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/cakephp/cakephp/languages","stargazers_url":"https://api.github.com/repos/cakephp/cakephp/stargazers","contributors_url":"https://api.github.com/repos/cakephp/cakephp/contributors","subscribers_url":"https://api.github.com/repos/cakephp/cakephp/subscribers","subscription_url":"https://api.github.com/repos/cakephp/cakephp/subscription","commits_url":"https://api.github.com/repos/cakephp/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cakephp/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cakephp/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/{number}","contents_url":"https://api.github.com/repos/cakephp/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/cakephp/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cakephp/cakephp/merges","archive_url":"https://api.github.com/repos/cakephp/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cakephp/cakephp/downloads","issues_url":"https://api.github.com/repos/cakephp/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/cakephp/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/cakephp/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/cakephp/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cakephp/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/cakephp/cakephp/releases{/id}","created_at":"2010-05-08T14:38:22Z","updated_at":"2015-01-05T00:52:29Z","pushed_at":"2015-01-05T03:59:57Z","git_url":"git://github.com/cakephp/cakephp.git","ssh_url":"git@github.com:cakephp/cakephp.git","clone_url":"https://github.com/cakephp/cakephp.git","svn_url":"https://github.com/cakephp/cakephp","homepage":"http://cakephp.org","size":147369,"stargazers_count":5413,"watchers_count":5413,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2388,"mirror_url":null,"open_issues_count":111,"forks":2388,"open_issues":111,"watchers":5413,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5564"},"html":{"href":"https://github.com/cakephp/cakephp/pull/5564"},"issue":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/5564"},"comments":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/5564/comments"},"review_comments":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5564/comments"},"review_comment":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/5564/commits"},"statuses":{"href":"https://api.github.com/repos/cakephp/cakephp/statuses/c3fd5ab1c9bf4413c2ccb24f6df4cd11bd91e5db"}}}}