{"action":"created","comment":{"url":"https://api.github.com/repos/cocoonprojects/ora/pulls/comments/50218009","id":50218009,"diff_hunk":"@@ -0,0 +1,203 @@\n+<?php\n+\n+namespace Kanbanize\\Controller;\n+\n+use Application\\Controller\\OrganizationAwareController;\n+use Application\\InvalidArgumentException;\n+use Application\\View\\ErrorJsonModel;\n+use People\\Service\\OrganizationService;\n+use People\\Organization;\n+use Kanbanize\\Service\\KanbanizeAPI;\n+use Kanbanize\\Service\\KanbanizeApiException;\n+use Kanbanize\\Service\\Importer;\n+use TaskManagement\\Service\\StreamService;\n+use TaskManagement\\Task;\n+use Zend\\Filter\\FilterChain;\n+use Zend\\Filter\\StringTrim;\n+use Zend\\Filter\\StripNewlines;\n+use Zend\\Filter\\StripTags;\n+use Zend\\View\\Model\\JsonModel;\n+use Zend\\Validator\\InArray;\n+use Zend\\Validator\\NotEmpty;\n+use Kanbanize\\KanbanizeStream;\n+use Kanbanize\\Service\\KanbanizeService;\n+\n+\n+class BoardsController extends OrganizationAwareController{\n+\n+\tprotected static $resourceOptions = ['POST', 'GET'];\n+\tprotected static $collectionOptions= [];\n+\t/**\n+\t * @var StreamService\n+\t */\n+\tprivate $streamService;\n+\t/**\n+\t * @var KanbanizeAPI\n+\t */\n+\tprivate $client;\n+\t/**\n+\t * @var KanbanizeService\n+\t */\n+\tprivate $kanbanizeService;\n+\n+\tpublic function __construct(OrganizationService $organizationService, StreamService $streamService, KanbanizeAPI $client, KanbanizeService $kanbanizeService){\n+\t\tparent::__construct($organizationService);\n+\t\t$this->streamService = $streamService;\n+\t\t$this->client = $client;\n+\t\t$this->kanbanizeService = $kanbanizeService;\n+\t}\n+\n+\tpublic function invoke($id, $data){\n+\t\tif(is_null($this->identity())) {\n+\t\t\t$this->response->setStatusCode(401);\n+\t\t\treturn $this->response;\n+\t\t}\n+\t\tif(!$this->isAllowed($this->identity(), $this->organization, 'Kanbanize.BoardSettings.create')) {\n+\t\t\t$this->response->setStatusCode(403);\n+\t\t\treturn $this->response;\n+\t\t}\n+\t\t$notEmptyValidator = new NotEmpty();\n+\t\t$error = new ErrorJsonModel();\n+\t\tif(!isset($data['projectId']) || !$notEmptyValidator->isValid($data['projectId'])){\n+\t\t\t$error->addSecondaryErrors(\"projectId\", [\"Missing project id\"]);\n+\t\t}\n+\t\tif(!isset($data['streamName']) || !$notEmptyValidator->isValid($data['streamName'])){\n+\t\t\t$error->addSecondaryErrors(\"streamName\", [\"Stream name cannot be empty\"]);\n+\t\t}\n+\t\tif($error->hasErrors()){\n+\t\t\t$error->setCode(400);\n+\t\t\t$error->setDescription('Some parameters are not valid');\n+\t\t\t$this->response->setStatusCode(400);\n+\t\t\treturn $error;\n+\t\t}\n+\t\t$filters = new FilterChain();\n+\t\t$filters->attach(new StringTrim())\n+\t\t\t->attach(new StripNewlines())\n+\t\t\t->attach(new StripTags());\n+\t\t$streamName = $filters->filter($data['streamName']);\n+\t\t$projectId = $data['projectId'];\n+\n+\t\t$statusValidator = new InArray([\n+\t\t\t'haystack' => [\n+\t\t\t\t\tTask::STATUS_IDEA,\n+\t\t\t\t\tTask::STATUS_OPEN,\n+\t\t\t\t\tTask::STATUS_ONGOING,\n+\t\t\t\t\tTask::STATUS_COMPLETED,\n+\t\t\t\t\tTask::STATUS_ACCEPTED,\n+\t\t\t\t\tTask::STATUS_CLOSED\n+\t\t\t]\n+\t\t]);\n+\t\tforeach($data['mapping'] as $column=>$status){","path":"module/Kanbanize/src/Kanbanize/Controller/BoardsController.php","position":90,"original_position":90,"commit_id":"ae359753326a2568ec5fac3042da5000f5f5e19a","original_commit_id":"ae359753326a2568ec5fac3042da5000f5f5e19a","user":{"login":"dottorbabba","id":7878449,"avatar_url":"https://avatars.githubusercontent.com/u/7878449?v=3","gravatar_id":"","url":"https://api.github.com/users/dottorbabba","html_url":"https://github.com/dottorbabba","followers_url":"https://api.github.com/users/dottorbabba/followers","following_url":"https://api.github.com/users/dottorbabba/following{/other_user}","gists_url":"https://api.github.com/users/dottorbabba/gists{/gist_id}","starred_url":"https://api.github.com/users/dottorbabba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dottorbabba/subscriptions","organizations_url":"https://api.github.com/users/dottorbabba/orgs","repos_url":"https://api.github.com/users/dottorbabba/repos","events_url":"https://api.github.com/users/dottorbabba/events{/privacy}","received_events_url":"https://api.github.com/users/dottorbabba/received_events","type":"User","site_admin":false},"body":"Utilizzando una `array_walk` avresti uno stile più dichiarativo, che è apprezzabile (nice to have)","created_at":"2016-01-20T06:09:28Z","updated_at":"2016-01-20T06:09:28Z","html_url":"https://github.com/cocoonprojects/ora/pull/147#discussion_r50218009","pull_request_url":"https://api.github.com/repos/cocoonprojects/ora/pulls/147","_links":{"self":{"href":"https://api.github.com/repos/cocoonprojects/ora/pulls/comments/50218009"},"html":{"href":"https://github.com/cocoonprojects/ora/pull/147#discussion_r50218009"},"pull_request":{"href":"https://api.github.com/repos/cocoonprojects/ora/pulls/147"}}},"pull_request":{"url":"https://api.github.com/repos/cocoonprojects/ora/pulls/147","id":55918952,"html_url":"https://github.com/cocoonprojects/ora/pull/147","diff_url":"https://github.com/cocoonprojects/ora/pull/147.diff","patch_url":"https://github.com/cocoonprojects/ora/pull/147.patch","issue_url":"https://api.github.com/repos/cocoonprojects/ora/issues/147","number":147,"state":"open","locked":false,"title":"Kanbanize settings","user":{"login":"mario7102","id":7972621,"avatar_url":"https://avatars.githubusercontent.com/u/7972621?v=3","gravatar_id":"","url":"https://api.github.com/users/mario7102","html_url":"https://github.com/mario7102","followers_url":"https://api.github.com/users/mario7102/followers","following_url":"https://api.github.com/users/mario7102/following{/other_user}","gists_url":"https://api.github.com/users/mario7102/gists{/gist_id}","starred_url":"https://api.github.com/users/mario7102/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mario7102/subscriptions","organizations_url":"https://api.github.com/users/mario7102/orgs","repos_url":"https://api.github.com/users/mario7102/repos","events_url":"https://api.github.com/users/mario7102/events{/privacy}","received_events_url":"https://api.github.com/users/mario7102/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-13T16:18:08Z","updated_at":"2016-01-20T06:09:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49a9a099d6f0302a023644099575847aefad2ce8","assignee":{"login":"dottorbabba","id":7878449,"avatar_url":"https://avatars.githubusercontent.com/u/7878449?v=3","gravatar_id":"","url":"https://api.github.com/users/dottorbabba","html_url":"https://github.com/dottorbabba","followers_url":"https://api.github.com/users/dottorbabba/followers","following_url":"https://api.github.com/users/dottorbabba/following{/other_user}","gists_url":"https://api.github.com/users/dottorbabba/gists{/gist_id}","starred_url":"https://api.github.com/users/dottorbabba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dottorbabba/subscriptions","organizations_url":"https://api.github.com/users/dottorbabba/orgs","repos_url":"https://api.github.com/users/dottorbabba/repos","events_url":"https://api.github.com/users/dottorbabba/events{/privacy}","received_events_url":"https://api.github.com/users/dottorbabba/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cocoonprojects/ora/pulls/147/commits","review_comments_url":"https://api.github.com/repos/cocoonprojects/ora/pulls/147/comments","review_comment_url":"https://api.github.com/repos/cocoonprojects/ora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cocoonprojects/ora/issues/147/comments","statuses_url":"https://api.github.com/repos/cocoonprojects/ora/statuses/ae359753326a2568ec5fac3042da5000f5f5e19a","head":{"label":"cocoonprojects:kanbanize_settings","ref":"kanbanize_settings","sha":"ae359753326a2568ec5fac3042da5000f5f5e19a","user":{"login":"cocoonprojects","id":7962104,"avatar_url":"https://avatars.githubusercontent.com/u/7962104?v=3","gravatar_id":"","url":"https://api.github.com/users/cocoonprojects","html_url":"https://github.com/cocoonprojects","followers_url":"https://api.github.com/users/cocoonprojects/followers","following_url":"https://api.github.com/users/cocoonprojects/following{/other_user}","gists_url":"https://api.github.com/users/cocoonprojects/gists{/gist_id}","starred_url":"https://api.github.com/users/cocoonprojects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocoonprojects/subscriptions","organizations_url":"https://api.github.com/users/cocoonprojects/orgs","repos_url":"https://api.github.com/users/cocoonprojects/repos","events_url":"https://api.github.com/users/cocoonprojects/events{/privacy}","received_events_url":"https://api.github.com/users/cocoonprojects/received_events","type":"Organization","site_admin":false},"repo":{"id":21118274,"name":"ora","full_name":"cocoonprojects/ora","owner":{"login":"cocoonprojects","id":7962104,"avatar_url":"https://avatars.githubusercontent.com/u/7962104?v=3","gravatar_id":"","url":"https://api.github.com/users/cocoonprojects","html_url":"https://github.com/cocoonprojects","followers_url":"https://api.github.com/users/cocoonprojects/followers","following_url":"https://api.github.com/users/cocoonprojects/following{/other_user}","gists_url":"https://api.github.com/users/cocoonprojects/gists{/gist_id}","starred_url":"https://api.github.com/users/cocoonprojects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocoonprojects/subscriptions","organizations_url":"https://api.github.com/users/cocoonprojects/orgs","repos_url":"https://api.github.com/users/cocoonprojects/repos","events_url":"https://api.github.com/users/cocoonprojects/events{/privacy}","received_events_url":"https://api.github.com/users/cocoonprojects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cocoonprojects/ora","description":"Non-hierarchical clustering technology platform","fork":false,"url":"https://api.github.com/repos/cocoonprojects/ora","forks_url":"https://api.github.com/repos/cocoonprojects/ora/forks","keys_url":"https://api.github.com/repos/cocoonprojects/ora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cocoonprojects/ora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cocoonprojects/ora/teams","hooks_url":"https://api.github.com/repos/cocoonprojects/ora/hooks","issue_events_url":"https://api.github.com/repos/cocoonprojects/ora/issues/events{/number}","events_url":"https://api.github.com/repos/cocoonprojects/ora/events","assignees_url":"https://api.github.com/repos/cocoonprojects/ora/assignees{/user}","branches_url":"https://api.github.com/repos/cocoonprojects/ora/branches{/branch}","tags_url":"https://api.github.com/repos/cocoonprojects/ora/tags","blobs_url":"https://api.github.com/repos/cocoonprojects/ora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cocoonprojects/ora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cocoonprojects/ora/git/refs{/sha}","trees_url":"https://api.github.com/repos/cocoonprojects/ora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cocoonprojects/ora/statuses/{sha}","languages_url":"https://api.github.com/repos/cocoonprojects/ora/languages","stargazers_url":"https://api.github.com/repos/cocoonprojects/ora/stargazers","contributors_url":"https://api.github.com/repos/cocoonprojects/ora/contributors","subscribers_url":"https://api.github.com/repos/cocoonprojects/ora/subscribers","subscription_url":"https://api.github.com/repos/cocoonprojects/ora/subscription","commits_url":"https://api.github.com/repos/cocoonprojects/ora/commits{/sha}","git_commits_url":"https://api.github.com/repos/cocoonprojects/ora/git/commits{/sha}","comments_url":"https://api.github.com/repos/cocoonprojects/ora/comments{/number}","issue_comment_url":"https://api.github.com/repos/cocoonprojects/ora/issues/comments{/number}","contents_url":"https://api.github.com/repos/cocoonprojects/ora/contents/{+path}","compare_url":"https://api.github.com/repos/cocoonprojects/ora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cocoonprojects/ora/merges","archive_url":"https://api.github.com/repos/cocoonprojects/ora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cocoonprojects/ora/downloads","issues_url":"https://api.github.com/repos/cocoonprojects/ora/issues{/number}","pulls_url":"https://api.github.com/repos/cocoonprojects/ora/pulls{/number}","milestones_url":"https://api.github.com/repos/cocoonprojects/ora/milestones{/number}","notifications_url":"https://api.github.com/repos/cocoonprojects/ora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cocoonprojects/ora/labels{/name}","releases_url":"https://api.github.com/repos/cocoonprojects/ora/releases{/id}","created_at":"2014-06-23T07:56:28Z","updated_at":"2015-04-24T15:18:21Z","pushed_at":"2016-01-15T16:11:15Z","git_url":"git://github.com/cocoonprojects/ora.git","ssh_url":"git@github.com:cocoonprojects/ora.git","clone_url":"https://github.com/cocoonprojects/ora.git","svn_url":"https://github.com/cocoonprojects/ora","homepage":"","size":7203,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"cocoonprojects:develop","ref":"develop","sha":"ed70d0d33106aef4074e837c810b7d2edde51872","user":{"login":"cocoonprojects","id":7962104,"avatar_url":"https://avatars.githubusercontent.com/u/7962104?v=3","gravatar_id":"","url":"https://api.github.com/users/cocoonprojects","html_url":"https://github.com/cocoonprojects","followers_url":"https://api.github.com/users/cocoonprojects/followers","following_url":"https://api.github.com/users/cocoonprojects/following{/other_user}","gists_url":"https://api.github.com/users/cocoonprojects/gists{/gist_id}","starred_url":"https://api.github.com/users/cocoonprojects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocoonprojects/subscriptions","organizations_url":"https://api.github.com/users/cocoonprojects/orgs","repos_url":"https://api.github.com/users/cocoonprojects/repos","events_url":"https://api.github.com/users/cocoonprojects/events{/privacy}","received_events_url":"https://api.github.com/users/cocoonprojects/received_events","type":"Organization","site_admin":false},"repo":{"id":21118274,"name":"ora","full_name":"cocoonprojects/ora","owner":{"login":"cocoonprojects","id":7962104,"avatar_url":"https://avatars.githubusercontent.com/u/7962104?v=3","gravatar_id":"","url":"https://api.github.com/users/cocoonprojects","html_url":"https://github.com/cocoonprojects","followers_url":"https://api.github.com/users/cocoonprojects/followers","following_url":"https://api.github.com/users/cocoonprojects/following{/other_user}","gists_url":"https://api.github.com/users/cocoonprojects/gists{/gist_id}","starred_url":"https://api.github.com/users/cocoonprojects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocoonprojects/subscriptions","organizations_url":"https://api.github.com/users/cocoonprojects/orgs","repos_url":"https://api.github.com/users/cocoonprojects/repos","events_url":"https://api.github.com/users/cocoonprojects/events{/privacy}","received_events_url":"https://api.github.com/users/cocoonprojects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cocoonprojects/ora","description":"Non-hierarchical clustering technology platform","fork":false,"url":"https://api.github.com/repos/cocoonprojects/ora","forks_url":"https://api.github.com/repos/cocoonprojects/ora/forks","keys_url":"https://api.github.com/repos/cocoonprojects/ora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cocoonprojects/ora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cocoonprojects/ora/teams","hooks_url":"https://api.github.com/repos/cocoonprojects/ora/hooks","issue_events_url":"https://api.github.com/repos/cocoonprojects/ora/issues/events{/number}","events_url":"https://api.github.com/repos/cocoonprojects/ora/events","assignees_url":"https://api.github.com/repos/cocoonprojects/ora/assignees{/user}","branches_url":"https://api.github.com/repos/cocoonprojects/ora/branches{/branch}","tags_url":"https://api.github.com/repos/cocoonprojects/ora/tags","blobs_url":"https://api.github.com/repos/cocoonprojects/ora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cocoonprojects/ora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cocoonprojects/ora/git/refs{/sha}","trees_url":"https://api.github.com/repos/cocoonprojects/ora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cocoonprojects/ora/statuses/{sha}","languages_url":"https://api.github.com/repos/cocoonprojects/ora/languages","stargazers_url":"https://api.github.com/repos/cocoonprojects/ora/stargazers","contributors_url":"https://api.github.com/repos/cocoonprojects/ora/contributors","subscribers_url":"https://api.github.com/repos/cocoonprojects/ora/subscribers","subscription_url":"https://api.github.com/repos/cocoonprojects/ora/subscription","commits_url":"https://api.github.com/repos/cocoonprojects/ora/commits{/sha}","git_commits_url":"https://api.github.com/repos/cocoonprojects/ora/git/commits{/sha}","comments_url":"https://api.github.com/repos/cocoonprojects/ora/comments{/number}","issue_comment_url":"https://api.github.com/repos/cocoonprojects/ora/issues/comments{/number}","contents_url":"https://api.github.com/repos/cocoonprojects/ora/contents/{+path}","compare_url":"https://api.github.com/repos/cocoonprojects/ora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cocoonprojects/ora/merges","archive_url":"https://api.github.com/repos/cocoonprojects/ora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cocoonprojects/ora/downloads","issues_url":"https://api.github.com/repos/cocoonprojects/ora/issues{/number}","pulls_url":"https://api.github.com/repos/cocoonprojects/ora/pulls{/number}","milestones_url":"https://api.github.com/repos/cocoonprojects/ora/milestones{/number}","notifications_url":"https://api.github.com/repos/cocoonprojects/ora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cocoonprojects/ora/labels{/name}","releases_url":"https://api.github.com/repos/cocoonprojects/ora/releases{/id}","created_at":"2014-06-23T07:56:28Z","updated_at":"2015-04-24T15:18:21Z","pushed_at":"2016-01-15T16:11:15Z","git_url":"git://github.com/cocoonprojects/ora.git","ssh_url":"git@github.com:cocoonprojects/ora.git","clone_url":"https://github.com/cocoonprojects/ora.git","svn_url":"https://github.com/cocoonprojects/ora","homepage":"","size":7203,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cocoonprojects/ora/pulls/147"},"html":{"href":"https://github.com/cocoonprojects/ora/pull/147"},"issue":{"href":"https://api.github.com/repos/cocoonprojects/ora/issues/147"},"comments":{"href":"https://api.github.com/repos/cocoonprojects/ora/issues/147/comments"},"review_comments":{"href":"https://api.github.com/repos/cocoonprojects/ora/pulls/147/comments"},"review_comment":{"href":"https://api.github.com/repos/cocoonprojects/ora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cocoonprojects/ora/pulls/147/commits"},"statuses":{"href":"https://api.github.com/repos/cocoonprojects/ora/statuses/ae359753326a2568ec5fac3042da5000f5f5e19a"}}}}