{"action":"created","comment":{"url":"https://api.github.com/repos/nfephp-org/sped-common/pulls/comments/80225198","id":80225198,"diff_hunk":"@@ -0,0 +1,204 @@\n+<?php\n+\n+namespace NFePHP\\Common\\Soap;\n+\n+/**\n+ * Soap base class\n+ *\n+ * @category  NFePHP\n+ * @package   NFePHP\\Common\\Soap\\SoapBase\n+ * @copyright NFePHP Copyright (c) 2016\n+ * @license   http://www.gnu.org/licenses/lgpl.txt LGPLv3+\n+ * @license   https://opensource.org/licenses/MIT MIT\n+ * @license   http://www.gnu.org/licenses/gpl.txt GPLv3+\n+ * @author    Roberto L. Machado <linux.rlm at gmail dot com>\n+ * @link      http://github.com/nfephp-org/sped-nfse for the canonical source repository\n+ */\n+\n+use NFePHP\\Common\\Certificate;\n+use NFePHP\\Common\\Soap\\SoapInterface;\n+use NFePHP\\Common\\Exception\\SoapException;\n+use Psr\\Log\\LoggerInterface;\n+\n+abstract class SoapBase implements SoapInterface\n+{\n+    //soap parameters\n+    protected $connection;\n+    protected $soapprotocol = self::SSL_DEFAULT;\n+    protected $soaptimeout = 20;\n+    protected $proxyIP = '';\n+    protected $proxyPort = '';\n+    protected $proxyUser = '';\n+    protected $proxyPass = '';\n+    //certificat parameters\n+    protected $certificate;\n+    protected $tempdir = '';\n+    protected $prifile = '';\n+    protected $pubfile = '';\n+    protected $certfile = '';\n+    //log info\n+    protected $responseHead = '';\n+    protected $responseBody = '';\n+    protected $requestHead = '';\n+    protected $requestBody = '';\n+    \n+    /**\n+     * Constructor\n+     * @param Certificate $certificate\n+     * @param LoggerInterface $logger\n+     */\n+    public function __construct(Certificate $certificate = null, LoggerInterface $logger = null)\n+    {\n+        $this->logger = $logger;\n+        $this->certificate = $certificate;\n+        $this->saveTemporarilyKeyFiles();\n+    }\n+    \n+    /**\n+     * Destructor\n+     */\n+    public function __destruct()\n+    {\n+        $this->removeTemporarilyKeyFiles();\n+    }\n+    \n+    /**\n+     * Set certificate class for SSL comunications\n+     * @param Certificate $certificate\n+     */\n+    public function loadCertificate(Certificate $certificate)\n+    {\n+        $this->certificate = $certificate;\n+        $this->saveTemporarilyKeyFiles();\n+    }\n+    \n+    /**\n+     * Set logger class\n+     * @param LoggerInterface $logger\n+     */\n+    public function loadLogger(LoggerInterface $logger)\n+    {\n+        $this->logger = $logger;\n+    }\n+    \n+    /**\n+     * Set timeout for communication\n+     * @param int $timesecs\n+     */\n+    public function timeout($timesecs)\n+    {\n+        $this->soaptimeout = $timesecs;\n+    }\n+    \n+    /**\n+     * Set security protocol\n+     * @param int $protocol\n+     */\n+    public function protocol($protocol = self::SSL_DEFAULT)\n+    {\n+        $this->soapprotocol = $protocol;\n+    }\n+    \n+    /**\n+     * Set proxy parameters\n+     * @param string $ip\n+     * @param int $port\n+     * @param string $user\n+     * @param string $password\n+     */\n+    public function proxy($ip, $port, $user, $password)\n+    {\n+        $this->proxyIP = $ip;\n+        $this->proxyPort = $port;\n+        $this->proxyUser = $user;\n+        $this->proxyPass = $password;\n+    }\n+    \n+    abstract public function send(\n+        $url,\n+        $operation = '',\n+        $action = '',\n+        $soapver = SOAP_1_2,\n+        $parameters = [],\n+        $namespaces = [],\n+        $withcadata = false\n+    );","path":"src/Soap/SoapBase.php","position":125,"original_position":125,"commit_id":"f1f6ccc8c0016217407edde095bc9683c968be23","original_commit_id":"f1f6ccc8c0016217407edde095bc9683c968be23","user":{"login":"robmachado","id":1437008,"avatar_url":"https://avatars.githubusercontent.com/u/1437008?v=3","gravatar_id":"","url":"https://api.github.com/users/robmachado","html_url":"https://github.com/robmachado","followers_url":"https://api.github.com/users/robmachado/followers","following_url":"https://api.github.com/users/robmachado/following{/other_user}","gists_url":"https://api.github.com/users/robmachado/gists{/gist_id}","starred_url":"https://api.github.com/users/robmachado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robmachado/subscriptions","organizations_url":"https://api.github.com/users/robmachado/orgs","repos_url":"https://api.github.com/users/robmachado/repos","events_url":"https://api.github.com/users/robmachado/events{/privacy}","received_events_url":"https://api.github.com/users/robmachado/received_events","type":"User","site_admin":false},"body":"Esses parâmetros podem mudar e mudam a cada envio.\r\nExceto esse ultimo $withcdata que eu vou retirar dai. \r\nO array parameters passa a mensagem SOAP que será construída no momento do envio\r\ne o array namespaces estabelece atributos que devem ser usados no envelope soap.\r\nIsso pode e é diferente para cada sub projeto (nfe, cte, mdfe, nfse - nesse ultimo caso tem mais  variações ainda)\r\n  ","created_at":"2016-09-23T11:12:05Z","updated_at":"2016-09-23T11:12:05Z","html_url":"https://github.com/nfephp-org/sped-common/pull/63#discussion_r80225198","pull_request_url":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/nfephp-org/sped-common/pulls/comments/80225198"},"html":{"href":"https://github.com/nfephp-org/sped-common/pull/63#discussion_r80225198"},"pull_request":{"href":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63","id":86418861,"html_url":"https://github.com/nfephp-org/sped-common/pull/63","diff_url":"https://github.com/nfephp-org/sped-common/pull/63.diff","patch_url":"https://github.com/nfephp-org/sped-common/pull/63.patch","issue_url":"https://api.github.com/repos/nfephp-org/sped-common/issues/63","number":63,"state":"open","locked":false,"title":"Classes para Assinatura do XML e Soap","user":{"login":"robmachado","id":1437008,"avatar_url":"https://avatars.githubusercontent.com/u/1437008?v=3","gravatar_id":"","url":"https://api.github.com/users/robmachado","html_url":"https://github.com/robmachado","followers_url":"https://api.github.com/users/robmachado/followers","following_url":"https://api.github.com/users/robmachado/following{/other_user}","gists_url":"https://api.github.com/users/robmachado/gists{/gist_id}","starred_url":"https://api.github.com/users/robmachado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robmachado/subscriptions","organizations_url":"https://api.github.com/users/robmachado/orgs","repos_url":"https://api.github.com/users/robmachado/repos","events_url":"https://api.github.com/users/robmachado/events{/privacy}","received_events_url":"https://api.github.com/users/robmachado/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-22T21:34:55Z","updated_at":"2016-09-23T11:12:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0d7a706bff4ede6e11ab63dfce93385c5d5d1c0","assignee":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"assignees":[{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63/commits","review_comments_url":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63/comments","review_comment_url":"https://api.github.com/repos/nfephp-org/sped-common/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nfephp-org/sped-common/issues/63/comments","statuses_url":"https://api.github.com/repos/nfephp-org/sped-common/statuses/f1f6ccc8c0016217407edde095bc9683c968be23","head":{"label":"robmachado:develop","ref":"develop","sha":"f1f6ccc8c0016217407edde095bc9683c968be23","user":{"login":"robmachado","id":1437008,"avatar_url":"https://avatars.githubusercontent.com/u/1437008?v=3","gravatar_id":"","url":"https://api.github.com/users/robmachado","html_url":"https://github.com/robmachado","followers_url":"https://api.github.com/users/robmachado/followers","following_url":"https://api.github.com/users/robmachado/following{/other_user}","gists_url":"https://api.github.com/users/robmachado/gists{/gist_id}","starred_url":"https://api.github.com/users/robmachado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robmachado/subscriptions","organizations_url":"https://api.github.com/users/robmachado/orgs","repos_url":"https://api.github.com/users/robmachado/repos","events_url":"https://api.github.com/users/robmachado/events{/privacy}","received_events_url":"https://api.github.com/users/robmachado/received_events","type":"User","site_admin":false},"repo":{"id":39446775,"name":"sped-common","full_name":"robmachado/sped-common","owner":{"login":"robmachado","id":1437008,"avatar_url":"https://avatars.githubusercontent.com/u/1437008?v=3","gravatar_id":"","url":"https://api.github.com/users/robmachado","html_url":"https://github.com/robmachado","followers_url":"https://api.github.com/users/robmachado/followers","following_url":"https://api.github.com/users/robmachado/following{/other_user}","gists_url":"https://api.github.com/users/robmachado/gists{/gist_id}","starred_url":"https://api.github.com/users/robmachado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robmachado/subscriptions","organizations_url":"https://api.github.com/users/robmachado/orgs","repos_url":"https://api.github.com/users/robmachado/repos","events_url":"https://api.github.com/users/robmachado/events{/privacy}","received_events_url":"https://api.github.com/users/robmachado/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robmachado/sped-common","description":"Classes comuns usadas nas atividades e classes das API's de NFe, CTe e MDFe","fork":true,"url":"https://api.github.com/repos/robmachado/sped-common","forks_url":"https://api.github.com/repos/robmachado/sped-common/forks","keys_url":"https://api.github.com/repos/robmachado/sped-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robmachado/sped-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robmachado/sped-common/teams","hooks_url":"https://api.github.com/repos/robmachado/sped-common/hooks","issue_events_url":"https://api.github.com/repos/robmachado/sped-common/issues/events{/number}","events_url":"https://api.github.com/repos/robmachado/sped-common/events","assignees_url":"https://api.github.com/repos/robmachado/sped-common/assignees{/user}","branches_url":"https://api.github.com/repos/robmachado/sped-common/branches{/branch}","tags_url":"https://api.github.com/repos/robmachado/sped-common/tags","blobs_url":"https://api.github.com/repos/robmachado/sped-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robmachado/sped-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robmachado/sped-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/robmachado/sped-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robmachado/sped-common/statuses/{sha}","languages_url":"https://api.github.com/repos/robmachado/sped-common/languages","stargazers_url":"https://api.github.com/repos/robmachado/sped-common/stargazers","contributors_url":"https://api.github.com/repos/robmachado/sped-common/contributors","subscribers_url":"https://api.github.com/repos/robmachado/sped-common/subscribers","subscription_url":"https://api.github.com/repos/robmachado/sped-common/subscription","commits_url":"https://api.github.com/repos/robmachado/sped-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/robmachado/sped-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/robmachado/sped-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/robmachado/sped-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/robmachado/sped-common/contents/{+path}","compare_url":"https://api.github.com/repos/robmachado/sped-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robmachado/sped-common/merges","archive_url":"https://api.github.com/repos/robmachado/sped-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robmachado/sped-common/downloads","issues_url":"https://api.github.com/repos/robmachado/sped-common/issues{/number}","pulls_url":"https://api.github.com/repos/robmachado/sped-common/pulls{/number}","milestones_url":"https://api.github.com/repos/robmachado/sped-common/milestones{/number}","notifications_url":"https://api.github.com/repos/robmachado/sped-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robmachado/sped-common/labels{/name}","releases_url":"https://api.github.com/repos/robmachado/sped-common/releases{/id}","deployments_url":"https://api.github.com/repos/robmachado/sped-common/deployments","created_at":"2015-07-21T13:26:52Z","updated_at":"2016-04-01T11:50:33Z","pushed_at":"2016-09-22T21:34:01Z","git_url":"git://github.com/robmachado/sped-common.git","ssh_url":"git@github.com:robmachado/sped-common.git","clone_url":"https://github.com/robmachado/sped-common.git","svn_url":"https://github.com/robmachado/sped-common","homepage":"","size":260,"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":"master"}},"base":{"label":"nfephp-org:develop","ref":"develop","sha":"9bb644d28979a1e582647c9a4e65fe8b5ab915b1","user":{"login":"nfephp-org","id":1618675,"avatar_url":"https://avatars.githubusercontent.com/u/1618675?v=3","gravatar_id":"","url":"https://api.github.com/users/nfephp-org","html_url":"https://github.com/nfephp-org","followers_url":"https://api.github.com/users/nfephp-org/followers","following_url":"https://api.github.com/users/nfephp-org/following{/other_user}","gists_url":"https://api.github.com/users/nfephp-org/gists{/gist_id}","starred_url":"https://api.github.com/users/nfephp-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfephp-org/subscriptions","organizations_url":"https://api.github.com/users/nfephp-org/orgs","repos_url":"https://api.github.com/users/nfephp-org/repos","events_url":"https://api.github.com/users/nfephp-org/events{/privacy}","received_events_url":"https://api.github.com/users/nfephp-org/received_events","type":"Organization","site_admin":false},"repo":{"id":39446043,"name":"sped-common","full_name":"nfephp-org/sped-common","owner":{"login":"nfephp-org","id":1618675,"avatar_url":"https://avatars.githubusercontent.com/u/1618675?v=3","gravatar_id":"","url":"https://api.github.com/users/nfephp-org","html_url":"https://github.com/nfephp-org","followers_url":"https://api.github.com/users/nfephp-org/followers","following_url":"https://api.github.com/users/nfephp-org/following{/other_user}","gists_url":"https://api.github.com/users/nfephp-org/gists{/gist_id}","starred_url":"https://api.github.com/users/nfephp-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfephp-org/subscriptions","organizations_url":"https://api.github.com/users/nfephp-org/orgs","repos_url":"https://api.github.com/users/nfephp-org/repos","events_url":"https://api.github.com/users/nfephp-org/events{/privacy}","received_events_url":"https://api.github.com/users/nfephp-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nfephp-org/sped-common","description":"Classes comuns usadas nas atividades e classes das API's de NFe, CTe e MDFe","fork":false,"url":"https://api.github.com/repos/nfephp-org/sped-common","forks_url":"https://api.github.com/repos/nfephp-org/sped-common/forks","keys_url":"https://api.github.com/repos/nfephp-org/sped-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nfephp-org/sped-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nfephp-org/sped-common/teams","hooks_url":"https://api.github.com/repos/nfephp-org/sped-common/hooks","issue_events_url":"https://api.github.com/repos/nfephp-org/sped-common/issues/events{/number}","events_url":"https://api.github.com/repos/nfephp-org/sped-common/events","assignees_url":"https://api.github.com/repos/nfephp-org/sped-common/assignees{/user}","branches_url":"https://api.github.com/repos/nfephp-org/sped-common/branches{/branch}","tags_url":"https://api.github.com/repos/nfephp-org/sped-common/tags","blobs_url":"https://api.github.com/repos/nfephp-org/sped-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nfephp-org/sped-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nfephp-org/sped-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/nfephp-org/sped-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nfephp-org/sped-common/statuses/{sha}","languages_url":"https://api.github.com/repos/nfephp-org/sped-common/languages","stargazers_url":"https://api.github.com/repos/nfephp-org/sped-common/stargazers","contributors_url":"https://api.github.com/repos/nfephp-org/sped-common/contributors","subscribers_url":"https://api.github.com/repos/nfephp-org/sped-common/subscribers","subscription_url":"https://api.github.com/repos/nfephp-org/sped-common/subscription","commits_url":"https://api.github.com/repos/nfephp-org/sped-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/nfephp-org/sped-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/nfephp-org/sped-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/nfephp-org/sped-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/nfephp-org/sped-common/contents/{+path}","compare_url":"https://api.github.com/repos/nfephp-org/sped-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nfephp-org/sped-common/merges","archive_url":"https://api.github.com/repos/nfephp-org/sped-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nfephp-org/sped-common/downloads","issues_url":"https://api.github.com/repos/nfephp-org/sped-common/issues{/number}","pulls_url":"https://api.github.com/repos/nfephp-org/sped-common/pulls{/number}","milestones_url":"https://api.github.com/repos/nfephp-org/sped-common/milestones{/number}","notifications_url":"https://api.github.com/repos/nfephp-org/sped-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nfephp-org/sped-common/labels{/name}","releases_url":"https://api.github.com/repos/nfephp-org/sped-common/releases{/id}","deployments_url":"https://api.github.com/repos/nfephp-org/sped-common/deployments","created_at":"2015-07-21T13:11:19Z","updated_at":"2016-08-16T19:29:35Z","pushed_at":"2016-09-22T21:34:55Z","git_url":"git://github.com/nfephp-org/sped-common.git","ssh_url":"git@github.com:nfephp-org/sped-common.git","clone_url":"https://github.com/nfephp-org/sped-common.git","svn_url":"https://github.com/nfephp-org/sped-common","homepage":"","size":283,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":5,"forks":8,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63"},"html":{"href":"https://github.com/nfephp-org/sped-common/pull/63"},"issue":{"href":"https://api.github.com/repos/nfephp-org/sped-common/issues/63"},"comments":{"href":"https://api.github.com/repos/nfephp-org/sped-common/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/nfephp-org/sped-common/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nfephp-org/sped-common/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/nfephp-org/sped-common/statuses/f1f6ccc8c0016217407edde095bc9683c968be23"}}}}
{"actor":{"display_login":"robmachado"}}