From 87e7c79756660447062a6e8e9da8f8460c4bf38e Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:06:12 +0100 Subject: [PATCH 01/24] =?UTF-8?q?=20Resolu=C3=A7=C3=A3o=20do=20exercio=20#?= =?UTF-8?q?17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ArrayDeInformacoes/controller.php | 38 +++++++ app/ArrayDeInformacoes/index.html | 98 +++++++++++++++++++ .../ArrayInformationsAPI.php | 33 +++++++ .../TestArrayOfInformations.php | 25 +++++ 4 files changed, 194 insertions(+) create mode 100644 app/ArrayDeInformacoes/controller.php create mode 100644 app/ArrayDeInformacoes/index.html create mode 100644 src/ArrayDeInformacoes/ArrayInformationsAPI.php create mode 100644 tests/ArrayDeInformacoes/TestArrayOfInformations.php diff --git a/app/ArrayDeInformacoes/controller.php b/app/ArrayDeInformacoes/controller.php new file mode 100644 index 0000000..a2865a5 --- /dev/null +++ b/app/ArrayDeInformacoes/controller.php @@ -0,0 +1,38 @@ +CreateArrayWithInformation(); + + if(is_array($items)) { + foreach ($items as $key => $value) { + $retorno['msg'] .= '
  • '.''.$key.' - '.$value.'
  • '; + $retorno['status'] = true; + } + } +} + echo json_encode($retorno); + diff --git a/app/ArrayDeInformacoes/index.html b/app/ArrayDeInformacoes/index.html new file mode 100644 index 0000000..ea3ee2f --- /dev/null +++ b/app/ArrayDeInformacoes/index.html @@ -0,0 +1,98 @@ + + + + Retorna Dados No Array + + + + + +
    +
    +
    +

    Retorna dados no Array

    +
    +
    +
    +

    Inserção Dos Dados

    + + + + + + + + +
    +
    +

    Retorno Dos Dados

    +
      +
      +
      + +
      + + + +

      Criado Por Acidiney Dias

      + + + \ No newline at end of file diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php new file mode 100644 index 0000000..e4dae4b --- /dev/null +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -0,0 +1,33 @@ +email = $email; + $this->name = $name; + $this->telephone = $telephone; + } + + public function CreateArrayWithInformation() + { + $this->data = [ 'E-mail' => $this->email, + 'Name' => $this->name, + 'Telefone' => $this->telephone]; + return $this->data; + } +} diff --git a/tests/ArrayDeInformacoes/TestArrayOfInformations.php b/tests/ArrayDeInformacoes/TestArrayOfInformations.php new file mode 100644 index 0000000..d62cb73 --- /dev/null +++ b/tests/ArrayDeInformacoes/TestArrayOfInformations.php @@ -0,0 +1,25 @@ +instance = new ArrayInformationsAPI($email, $name, $telephone); + } + + public function Array() + { + $this->assertNotEmpty($this->instance->CreateArrayWithInformation()); + $this->assertEquals(2, $this->instance->CreateArrayWithInformation()); + $this->assertInternalType('array', $$this->instance->CreateArrayWithInformation()); + } +} From dd3e6768179ff6bf74028dd26363a4e7b81e5a12 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:08:12 +0100 Subject: [PATCH 02/24] =?UTF-8?q?=20Resolu=C3=A7=C3=A3o=20do=20exercio=20#?= =?UTF-8?q?17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index e4dae4b..458e574 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -3,10 +3,10 @@ namespace DojoPHP\ArrayDeInformacoes; /** - * - * - * - * + *@author: Acidiney Dias + *@return array + *@description Converte as informacoes dadas em um array e retorna + *@date 20-10-2017 */ class ArrayInformationsAPI From b186fefb8e41f34ab2c73ce80d5234750d05078c Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:22:40 +0100 Subject: [PATCH 03/24] Fixed StyleCI Error --- app/ArrayDeInformacoes/controller.php | 23 +++++++++---------- .../ArrayInformationsAPI.php | 11 +++++---- .../TestArrayOfInformations.php | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/ArrayDeInformacoes/controller.php b/app/ArrayDeInformacoes/controller.php index a2865a5..fe05ca8 100644 --- a/app/ArrayDeInformacoes/controller.php +++ b/app/ArrayDeInformacoes/controller.php @@ -10,29 +10,28 @@ use DojoPHP\ArrayDeInformacoes\ArrayInformationsAPI; -/** - * @author: Acidiney Dias - * @description: Esse controler faz a conexão entre a view e a API - * @post: cidade - * @git: CodingDojo/dojophp - * @return: json - * @method: get - */ +/* + *@author: Acidiney Dias + * @description: Esse controler faz a conexão entre a view e a AI + *@post: cidade + *@git: CodingDojo/dojophp + *@return: json + *@method: get + */ // Instaciando Classe ArrayInformationsAPI $retorno['msg'] = ''; $retorno['status'] = false; -if($_POST['email'] !== "" && $_POST['name'] !== "" && $_POST['telephone'] !== "") { +if ($_POST['email'] !== "" && $_POST['name'] !== "" && $_POST['telephone'] !== "") { $new = new ArrayInformationsAPI($_POST['email'], $_POST['name'], $_POST['telephone']); $items = $new->CreateArrayWithInformation(); - if(is_array($items)) { + if (is_array($items)) { foreach ($items as $key => $value) { $retorno['msg'] .= '
    • '.''.$key.' - '.$value.'
    • '; $retorno['status'] = true; } } } - echo json_encode($retorno); - + echo json_encode($retorno); \ No newline at end of file diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index 458e574..a43e71d 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -4,6 +4,7 @@ /** *@author: Acidiney Dias + * *@return array *@description Converte as informacoes dadas em um array e retorna *@date 20-10-2017 @@ -14,20 +15,20 @@ class ArrayInformationsAPI public $email; public $name; public $telephone; - public $data = array(); + public $data = []; public function __construct($email, $name, $telephone) { $this->email = $email; - $this->name = $name; + $this->name = $name; $this->telephone = $telephone; } public function CreateArrayWithInformation() { - $this->data = [ 'E-mail' => $this->email, - 'Name' => $this->name, - 'Telefone' => $this->telephone]; + $this->data = [ 'E-mail' => $this->email, + 'Name' => $this->name, + 'Telefone' => $this->telephone]; return $this->data; } } diff --git a/tests/ArrayDeInformacoes/TestArrayOfInformations.php b/tests/ArrayDeInformacoes/TestArrayOfInformations.php index d62cb73..841ff6d 100644 --- a/tests/ArrayDeInformacoes/TestArrayOfInformations.php +++ b/tests/ArrayDeInformacoes/TestArrayOfInformations.php @@ -1,5 +1,5 @@ instance = new ArrayInformationsAPI($email, $name, $telephone); } From 0e36c6bbf47f7f20d9b6c324e36499e99170ae65 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:25:30 +0100 Subject: [PATCH 04/24] Fixed StyleCI Error --- app/ArrayDeInformacoes/controller.php | 4 ++-- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/ArrayDeInformacoes/controller.php b/app/ArrayDeInformacoes/controller.php index fe05ca8..76e65d6 100644 --- a/app/ArrayDeInformacoes/controller.php +++ b/app/ArrayDeInformacoes/controller.php @@ -22,7 +22,7 @@ $retorno['msg'] = ''; $retorno['status'] = false; -if ($_POST['email'] !== "" && $_POST['name'] !== "" && $_POST['telephone'] !== "") { +if ($_POST['email'] !== '' && $_POST['name'] !== '' && $_POST['telephone'] !== '') { $new = new ArrayInformationsAPI($_POST['email'], $_POST['name'], $_POST['telephone']); $items = $new->CreateArrayWithInformation(); @@ -34,4 +34,4 @@ } } } - echo json_encode($retorno); \ No newline at end of file +echo json_encode($retorno); \ No newline at end of file diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index a43e71d..4eb3c8a 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -9,7 +9,6 @@ *@description Converte as informacoes dadas em um array e retorna *@date 20-10-2017 */ - class ArrayInformationsAPI { public $email; @@ -26,7 +25,7 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { - $this->data = [ 'E-mail' => $this->email, + $this->data = [ 'E-mail' => $this->email, 'Name' => $this->name, 'Telefone' => $this->telephone]; return $this->data; From 56a063ef058c6a612610a83769492e69aed2b8db Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:27:32 +0100 Subject: [PATCH 05/24] Fixed StyledCI API --- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index 4eb3c8a..5de0d29 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -27,7 +27,7 @@ public function CreateArrayWithInformation() { $this->data = [ 'E-mail' => $this->email, 'Name' => $this->name, - 'Telefone' => $this->telephone]; + 'Telefone' => $this->telephone, ]; return $this->data; } } From 6dc8534c2ebac85d8bf0ab328e1d4c135cbc933a Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:29:35 +0100 Subject: [PATCH 06/24] Fixed StyledCI API --- app/ArrayDeInformacoes/controller.php | 3 ++- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/ArrayDeInformacoes/controller.php b/app/ArrayDeInformacoes/controller.php index 76e65d6..9763742 100644 --- a/app/ArrayDeInformacoes/controller.php +++ b/app/ArrayDeInformacoes/controller.php @@ -18,7 +18,7 @@ *@return: json *@method: get */ - // Instaciando Classe ArrayInformationsAPI + // Instaciando Classe ArrayInformationsAPI. $retorno['msg'] = ''; $retorno['status'] = false; @@ -34,4 +34,5 @@ } } } + echo json_encode($retorno); \ No newline at end of file diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index 5de0d29..1e10f8f 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -25,7 +25,7 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { - $this->data = [ 'E-mail' => $this->email, + $this->data = ['E-mail' => $this->email, 'Name' => $this->name, 'Telefone' => $this->telephone, ]; return $this->data; From bf9e843bf09dc7ba353b78f4b62a4424ccc088b5 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:31:38 +0100 Subject: [PATCH 07/24] Fixed StyledCI API --- app/ArrayDeInformacoes/controller.php | 2 +- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ArrayDeInformacoes/controller.php b/app/ArrayDeInformacoes/controller.php index 9763742..38f81ca 100644 --- a/app/ArrayDeInformacoes/controller.php +++ b/app/ArrayDeInformacoes/controller.php @@ -35,4 +35,4 @@ } } -echo json_encode($retorno); \ No newline at end of file + echo json_encode($retorno); \ No newline at end of file diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index 1e10f8f..ee3df10 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -26,7 +26,7 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { $this->data = ['E-mail' => $this->email, - 'Name' => $this->name, + 'Name' => $this->name, 'Telefone' => $this->telephone, ]; return $this->data; } From ca1e557f856cfc334a32bea351a6681a041d1278 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:34:25 +0100 Subject: [PATCH 08/24] Clear Bugs in ArrayInformationAPI --- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index ee3df10..fb6eb19 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -28,6 +28,7 @@ public function CreateArrayWithInformation() $this->data = ['E-mail' => $this->email, 'Name' => $this->name, 'Telefone' => $this->telephone, ]; + return $this->data; } } From d8ff9aae9d24a69508b4a8e35edb0dc257bd6fff Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:41:04 +0100 Subject: [PATCH 09/24] TestFix --- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 4 ++-- tests/ArrayDeInformacoes/TestArrayOfInformations.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index fb6eb19..a259c87 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -25,9 +25,9 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { - $this->data = ['E-mail' => $this->email, + $this->data = array('E-mail' => $this->email, 'Name' => $this->name, - 'Telefone' => $this->telephone, ]; + 'Telefone' => $this->telephone); return $this->data; } diff --git a/tests/ArrayDeInformacoes/TestArrayOfInformations.php b/tests/ArrayDeInformacoes/TestArrayOfInformations.php index 841ff6d..5b3e32c 100644 --- a/tests/ArrayDeInformacoes/TestArrayOfInformations.php +++ b/tests/ArrayDeInformacoes/TestArrayOfInformations.php @@ -8,7 +8,7 @@ class TestArrayOfInformations extends TestCase public $instance; public $returnTest; - public function setup() + public function testSetup() { $name = 'Acidiney Dias'; $email = 'acidineydias@gmail.com'; @@ -16,7 +16,7 @@ public function setup() $this->instance = new ArrayInformationsAPI($email, $name, $telephone); } - public function Array() + public function testArray() { $this->assertNotEmpty($this->instance->CreateArrayWithInformation()); $this->assertEquals(2, $this->instance->CreateArrayWithInformation()); From e42eb5691ba8d256639aaaf3f5047ce0c0caaefa Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 20 Oct 2017 22:46:11 +0100 Subject: [PATCH 10/24] Clear Bugs in ArrayInformationAPI --- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index a259c87..fb6eb19 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -25,9 +25,9 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { - $this->data = array('E-mail' => $this->email, + $this->data = ['E-mail' => $this->email, 'Name' => $this->name, - 'Telefone' => $this->telephone); + 'Telefone' => $this->telephone, ]; return $this->data; } From f86a7056703ec1583ad056e5cf1709e3b45518d3 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Sun, 22 Oct 2017 14:50:21 +0100 Subject: [PATCH 11/24] =?UTF-8?q?Resolu=C3=A7=C3=A3o=20do=20exercicio=20#1?= =?UTF-8?q?6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ConvertjsonToArray/atomix_user31.png | Bin 0 -> 7538 bytes app/ConvertjsonToArray/controller.php | 55 ++++++++++++++ app/ConvertjsonToArray/index.html | 70 ++++++++++++++++++ app/DiaDaSemana/.gitkeep | 0 .../ConvertJsonForArrayAPI.php | 25 +++++++ .../ConvertJsonForArrayTest.php | 29 ++++++++ 6 files changed, 179 insertions(+) create mode 100644 app/ConvertjsonToArray/atomix_user31.png create mode 100644 app/ConvertjsonToArray/controller.php create mode 100644 app/ConvertjsonToArray/index.html delete mode 100644 app/DiaDaSemana/.gitkeep create mode 100644 src/ConvertJsonToArray/ConvertJsonForArrayAPI.php create mode 100644 tests/ConvertJsonToArray/ConvertJsonForArrayTest.php diff --git a/app/ConvertjsonToArray/atomix_user31.png b/app/ConvertjsonToArray/atomix_user31.png new file mode 100644 index 0000000000000000000000000000000000000000..47a33a401f865d70402777c8d5deede7702f97ec GIT binary patch literal 7538 zcmV-&9gX6NP)L;_{C$r!uv)?JZ>M6VGDZA<^yXq;s>LQ)QDZA<-ox~!Y z#3{S#BAvu3yXq;s>M6VGBAvwD-Q6J}A^-pXy1KeVL`15ps&{vH?d|Qt!orD(iQL@W z(b3W9=;))Qq{+$2-{0RNoy3BIg4Wj7>gwv9ot-GQ0)bv`~mu&}WD{QM-R z(Y3X;FQCNs_V!l9=X`v8#Ms_6z3Hc?r*5pjK%~T{*5q`&(p9d?aLecY}*7 zPP^VBRAh|M<|Al+u+7$yyU8LzNtVXdjGm*6vAn(M_a>3Eue`xho3qy5;pX`L+~ntT znx`QtEH%g2QUCw|7j#liQve|>jaEiv2oyK;d$6DBf7PPt$;ZIn+slorLWwOuoP^a^X3OH0H|I9|Qm{-bx zOI4oDB$nhV@KKY~(o467LcRv;RnI=5O*@@| zO~^crN-5;4uqn0Vk6}?R!zPvGL~n;F1vW2}*g{EHKnzMEFT;{3@!hB-E<$0ZFPRYv zarXr&iMb1l84yz@8B0yR45BJ$CE?|&AhMd^4-F~Nx`R~_`6`ql3G$Ml(qf-pPff^` zrXXtfE+dQA$2k>}q#;<$2qse6IIJP}AP2FYLw&P4E zqf6i>BSn#b?QcAqIyRZ>=thtJqZuZ-VcF9OrxYveu98#((2b@xxu^H&BEurLW)7DS ztLxpVOJzVdaxCI8H5xP^9(#(Pp_-P~CkMDLr!z9=jUP+1$O30F24oL@m583-$RU0P zU8-l2MfMao!tixQ-1X0kkIgSUK{7**Fg!sqAFnQ%_&Q8}OoASJ0;sYQL+tz}GZH?3 zY=Qv}>JYLkwb1#E9l{vUP(6zT%n*l=O;G6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Bo@^VqJ^R8cJT5QLbG|UPF=A za%O{~)3wAhOxzdQ_?O*C5VV>%Ojr#wOn5dhs9ex0AD#>o1{(elE-8YbRkjOQr+z(k z6|km30{sZt-%t?Dg}6n)j&mgE0g4L~^@HkdmfKVil=-Kv0X8V$F9ukjj5&S{D?x$) z)AE)8Rl13h-MRAwAjy6>LHKLQ`~hkA%Og$M(je)6I6>Ord{Gml0g8jgTvLE!rvlk+!Wl-;pQc+?RbCG$s|`!n zAgqMU|JId%hZgjwXfyry=W1D1` z!7PcZz4JF9Sj>?45{^)9KZXHB`XVDMJ_#rIzN9&uQLx6h>!Ogs7p`DB>(^b07*qo IM6N<$f^CT`iU0rr literal 0 HcmV?d00001 diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php new file mode 100644 index 0000000..52d65f3 --- /dev/null +++ b/app/ConvertjsonToArray/controller.php @@ -0,0 +1,55 @@ +Itera(); + + $membros = $base['membros']; + + + // Criando elementos que serão exibidos(Base) + $elements['app'] = " + + + + + + + + + + + +
      Dados do Aplicativo
      NomeE-mailSite
      ".$base['app']."".$base['email']."Open Site
      "; + + $elements['list'] = "
        "; + // Criando elementos que serão exibidos(Membros) + foreach ($membros as $membro) { + + $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; + $elements['list'] .= '
      • + +
        +
      • '; + } + $elements['list'] .= "
      "; + echo json_encode($elements); diff --git a/app/ConvertjsonToArray/index.html b/app/ConvertjsonToArray/index.html new file mode 100644 index 0000000..1d6095b --- /dev/null +++ b/app/ConvertjsonToArray/index.html @@ -0,0 +1,70 @@ + + + + Retorna Dados do Arquivo CodingDojo.json + + + + + + +
      +
      +
      +

      Caminho do arquivo: data/codingdojo.json

      +
      +
      + +
      +
      +

      Lista de membros

      +
      +
      +
      + + + + +

      Criado Por Acidiney Dias

      + + + \ No newline at end of file diff --git a/app/DiaDaSemana/.gitkeep b/app/DiaDaSemana/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php new file mode 100644 index 0000000..caf009b --- /dev/null +++ b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php @@ -0,0 +1,25 @@ +source = $source; + $this->data = file_get_contents($source); + } + + public function Itera() + { + return json_decode($this->data, true); + } +} \ No newline at end of file diff --git a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php new file mode 100644 index 0000000..7f11fa1 --- /dev/null +++ b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php @@ -0,0 +1,29 @@ +url = "http://localhost/dojophp/data/codingdojo.json"; + $this->instance = new ConvertJsonForArrayAPI($this->url); + + $data = $this->instance->Itera(); + + $this->assertNotEmpty($data); + $this->assertInternalType('array', $data); + $this->assertArrayHasKey('membros', $data); + } +} \ No newline at end of file From ce624e95273378fc3963484d885067abdf721cf9 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Sun, 22 Oct 2017 15:01:44 +0100 Subject: [PATCH 12/24] Corrigindo StyleCI no exercicio #16 --- app/ArrayDeInformacoes/controller.php | 2 +- app/ConvertjsonToArray/controller.php | 17 +++++------ .../ArrayInformationsAPI.php | 4 +-- .../ConvertJsonForArrayAPI.php | 22 +++++++------- .../ConvertJsonForArrayTest.php | 30 +++++++++---------- 5 files changed, 37 insertions(+), 38 deletions(-) diff --git a/app/ArrayDeInformacoes/controller.php b/app/ArrayDeInformacoes/controller.php index 38f81ca..9763742 100644 --- a/app/ArrayDeInformacoes/controller.php +++ b/app/ArrayDeInformacoes/controller.php @@ -35,4 +35,4 @@ } } - echo json_encode($retorno); \ No newline at end of file +echo json_encode($retorno); \ No newline at end of file diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php index 52d65f3..9c3a881 100644 --- a/app/ConvertjsonToArray/controller.php +++ b/app/ConvertjsonToArray/controller.php @@ -23,7 +23,6 @@ $membros = $base['membros']; - // Criando elementos que serão exibidos(Base) $elements['app'] = " @@ -32,24 +31,24 @@ - - - + + + -
      NomeE-mailSite
      ".$base['app']."".$base['email']."Open Site".$base['app'].''.$base['email'].'Open Site
      "; + '; $elements['list'] = "
        "; // Criando elementos que serão exibidos(Membros) foreach ($membros as $membro) { - $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; - $elements['list'] .= '
      • + $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; + $elements['list'] .= '
      • '; - } - $elements['list'] .= "
      "; + } + $elements['list'] .= ''; echo json_encode($elements); diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index fb6eb19..eb78fa1 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -26,8 +26,8 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { $this->data = ['E-mail' => $this->email, - 'Name' => $this->name, - 'Telefone' => $this->telephone, ]; + 'Name' => $this->name, + 'Telefone' => $this->telephone, ]; return $this->data; } diff --git a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php index caf009b..2572e77 100644 --- a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php +++ b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php @@ -9,17 +9,17 @@ class ConvertJsonForArrayAPI { - public $source; - public $data; + public $source; + public $data; - public function __construct($source) - { - $this->source = $source; - $this->data = file_get_contents($source); - } + public function __construct($source) + { + $this->source = $source; + $this->data = file_get_contents($source); + } - public function Itera() - { - return json_decode($this->data, true); - } + public function Itera() + { + return json_decode($this->data, true); + } } \ No newline at end of file diff --git a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php index 7f11fa1..deefbd7 100644 --- a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php +++ b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php @@ -1,29 +1,29 @@ url = "http://localhost/dojophp/data/codingdojo.json"; - $this->instance = new ConvertJsonForArrayAPI($this->url); + public function testGetData() + { + $this->url = 'http://localhost/dojophp/data/codingdojo.json'; + $this->instance = new ConvertJsonForArrayAPI($this->url); - $data = $this->instance->Itera(); + $data = $this->instance->Itera(); - $this->assertNotEmpty($data); - $this->assertInternalType('array', $data); - $this->assertArrayHasKey('membros', $data); - } + $this->assertNotEmpty($data); + $this->assertInternalType('array', $data); + $this->assertArrayHasKey('membros', $data); + } } \ No newline at end of file From 20f458dd8c57e4de70c93f901a6a1e83ec7ec2f0 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Sun, 22 Oct 2017 15:08:17 +0100 Subject: [PATCH 13/24] Resolve StyleCI --- app/ArrayDeInformacoes/controller.php | 2 +- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 4 ++-- tests/ConvertJsonToArray/ConvertJsonForArrayTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/ArrayDeInformacoes/controller.php b/app/ArrayDeInformacoes/controller.php index 9763742..38f81ca 100644 --- a/app/ArrayDeInformacoes/controller.php +++ b/app/ArrayDeInformacoes/controller.php @@ -35,4 +35,4 @@ } } -echo json_encode($retorno); \ No newline at end of file + echo json_encode($retorno); \ No newline at end of file diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index eb78fa1..fb6eb19 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -26,8 +26,8 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { $this->data = ['E-mail' => $this->email, - 'Name' => $this->name, - 'Telefone' => $this->telephone, ]; + 'Name' => $this->name, + 'Telefone' => $this->telephone, ]; return $this->data; } diff --git a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php index deefbd7..bd5de4b 100644 --- a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php +++ b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php @@ -17,7 +17,7 @@ class ConvertJsonForArrayTest extends TestCase public function testGetData() { - $this->url = 'http://localhost/dojophp/data/codingdojo.json'; + $this->url = '..\..\data\codingdojo.json'; $this->instance = new ConvertJsonForArrayAPI($this->url); $data = $this->instance->Itera(); From ffca46fdfb83cbc4decbec69efefaa2e90743283 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Sun, 22 Oct 2017 15:47:34 +0100 Subject: [PATCH 14/24] PHPunit fixed -> Using Github Url --- app/ConvertjsonToArray/controller.php | 6 +-- data/codingdojo.json | 54 ++++++++++++++++++- .../ConvertJsonForArrayAPI.php | 2 +- .../ConvertJsonForArrayTest.php | 8 +-- 4 files changed, 60 insertions(+), 10 deletions(-) diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php index 9c3a881..4475cd0 100644 --- a/app/ConvertjsonToArray/controller.php +++ b/app/ConvertjsonToArray/controller.php @@ -37,18 +37,18 @@ '; - + $elements['list'] = "
        "; // Criando elementos que serão exibidos(Membros) foreach ($membros as $membro) { - $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; + $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; $elements['list'] .= '
      • '; - } + } $elements['list'] .= '
      '; echo json_encode($elements); diff --git a/data/codingdojo.json b/data/codingdojo.json index 7f51c7d..549c423 100644 --- a/data/codingdojo.json +++ b/data/codingdojo.json @@ -1,7 +1,7 @@ { "app": "Coding Dojo Angola", "url": "http://codingdojoangola.com", - "email": "info@codingdojoangola", + "email": "geral@codingdojoangola.com", "membros": [ { "nome": "Lucius Curado", @@ -12,6 +12,56 @@ "nome": "José Cage", "cargo": "Moderador e instrutor", "avatar": "" + }, + { + "nome": "Doriel Fonseca", + "cargo": "Instrutor #dojojavascript", + "avatar": "" + }, + { + "nome": "Pedro Massango", + "cargo": "Desenvolvedor Java", + "avatar": "" + }, + { + "nome": "Eleandro Duzentos", + "cargo": "Desenvolvedor PHP e .Net", + "avatar": "" + }, + { + "nome": "Renato Martins", + "cargo": "Desenvolvedor Java e PHP", + "avatar": "" + }, + { + "nome": "Victor Kiffen", + "cargo": "Desenvolvedor Java", + "avatar": "" + }, + { + "nome": "Jetro Domingos", + "cargo": "Desenvolvedor Java", + "avatar": "" + }, + { + "nome": "Acidiney Dias", + "cargo": "Desenvolvedor PHP", + "avatar": "" + }, + { + "nome": "Nelson Júnior", + "cargo": "Desenvolvedor PHP", + "avatar": "" + }, + { + "nome": "Masiry Link", + "cargo": "Desenvolvedor PHP", + "avatar": "" + }, + { + "nome": "Aleixo Jeronimo", + "cargo": "", + "avatar": "" } ] -} +} \ No newline at end of file diff --git a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php index 2572e77..8b67c3b 100644 --- a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php +++ b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php @@ -1,12 +1,12 @@ url = '..\..\data\codingdojo.json'; + $this->url = 'https://github.com/codingdojoangola/dojophp/raw/desafios/data/codingdojo.json'; $this->instance = new ConvertJsonForArrayAPI($this->url); $data = $this->instance->Itera(); From 21b157c70e6384e0cd704b4f02223d850c405c02 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Sun, 22 Oct 2017 19:48:46 +0100 Subject: [PATCH 15/24] =?UTF-8?q?Enviando=20Corre=C3=A7=C3=B5es=20do=20Con?= =?UTF-8?q?troller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ConvertjsonToArray/controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php index 4475cd0..1a15176 100644 --- a/app/ConvertjsonToArray/controller.php +++ b/app/ConvertjsonToArray/controller.php @@ -14,7 +14,7 @@ */ // Instaciando Classe ConvertJsonForArrayAPI passando o Caminho do arquivo codingdojo.json - $new = new ConvertJsonForArrayAPI('http://localhost/dojophp/data/codingdojo.json'); + $new = new ConvertJsonForArrayAPI('../../data/codingdojo.json'); /* Este aquivo é um arquivo que possui dois array, ou seja, um dentro de outro então a iteração só será no segundo pois no inicial são somentes as informações do Dojo. A chave do segundo array é membros. From eee03db44f27563845f07b7905d3ead834e631ea Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Sun, 22 Oct 2017 20:27:00 +0100 Subject: [PATCH 16/24] initial --- app/ConvertjsonToArray/atomix_user31.png | Bin 0 -> 7538 bytes app/ConvertjsonToArray/controller.php | 54 ++++++++++++++ app/ConvertjsonToArray/index.html | 70 ++++++++++++++++++ .../ConvertJsonForArrayAPI.php | 25 +++++++ .../ConvertJsonForArrayTest.php | 29 ++++++++ 5 files changed, 178 insertions(+) create mode 100644 app/ConvertjsonToArray/atomix_user31.png create mode 100644 app/ConvertjsonToArray/controller.php create mode 100644 app/ConvertjsonToArray/index.html create mode 100644 src/ConvertJsonToArray/ConvertJsonForArrayAPI.php create mode 100644 tests/ConvertJsonToArray/ConvertJsonForArrayTest.php diff --git a/app/ConvertjsonToArray/atomix_user31.png b/app/ConvertjsonToArray/atomix_user31.png new file mode 100644 index 0000000000000000000000000000000000000000..47a33a401f865d70402777c8d5deede7702f97ec GIT binary patch literal 7538 zcmV-&9gX6NP)L;_{C$r!uv)?JZ>M6VGDZA<^yXq;s>LQ)QDZA<-ox~!Y z#3{S#BAvu3yXq;s>M6VGBAvwD-Q6J}A^-pXy1KeVL`15ps&{vH?d|Qt!orD(iQL@W z(b3W9=;))Qq{+$2-{0RNoy3BIg4Wj7>gwv9ot-GQ0)bv`~mu&}WD{QM-R z(Y3X;FQCNs_V!l9=X`v8#Ms_6z3Hc?r*5pjK%~T{*5q`&(p9d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hw}@?;X0gjw-M|heKz(OhaNI zu(lu#or*xgTRRDi)C^v#7kEwEz&Tgo0A?a^0yVG|0xuyXu(i?ZE2m!IrEQRGJA0$D zi!l&5f*NjB1xlXS`!LMfhYAmx1m4u2Ed@^0F%cM*opW0?>8%p@z`_s#D~YE~0-X>9 z181JYDKQY(TZA#$1SfmWYz_m2)rUXpm6|#OBI1C&n#46 zoOb#_v%tMrjXZ}kr6^njbTr&{3D>i{+=Mj|nRe>6hElg1{dYMm~8iTf= z%YUR$!uSt;?ONmC^_Q=8i+Ro-T-%RePB6dL77R8uJ{os0xXWPI)7YkhU);KL) z@#2@Z=kOe8(LW`23-;NyfU*5U*hv4%J5i=%`w|0muK7p$ED7-fM3s+r%4v^+0cq?O z{Eh* z_9z7KOK&+tKmp#8FR(cQ;1CfW{bc z3KGXcato#u07!FYQEd$1QzUmh-3$VhO!N*K-%(USut!0FQkyFvdkIPbfVQ&J5d!`b z2@_NdAD~;SM>lc20BJv*Mfsx-kUhQ8JIxc`W!^^?1k-o{&{6GObU6Z+*h|$1=&il@ z1sE?_h%N|b(+}tnw7+o#{OW8h{eY4QoB3r3GW=$S3Bo@^VqJ^R8cJT5QLbG|UPF=A za%O{~)3wAhOxzdQ_?O*C5VV>%Ojr#wOn5dhs9ex0AD#>o1{(elE-8YbRkjOQr+z(k z6|km30{sZt-%t?Dg}6n)j&mgE0g4L~^@HkdmfKVil=-Kv0X8V$F9ukjj5&S{D?x$) z)AE)8Rl13h-MRAwAjy6>LHKLQ`~hkA%Og$M(je)6I6>Ord{Gml0g8jgTvLE!rvlk+!Wl-;pQc+?RbCG$s|`!n zAgqMU|JId%hZgjwXfyry=W1D1` z!7PcZz4JF9Sj>?45{^)9KZXHB`XVDMJ_#rIzN9&uQLx6h>!Ogs7p`DB>(^b07*qo IM6N<$f^CT`iU0rr literal 0 HcmV?d00001 diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php new file mode 100644 index 0000000..1a15176 --- /dev/null +++ b/app/ConvertjsonToArray/controller.php @@ -0,0 +1,54 @@ +Itera(); + + $membros = $base['membros']; + + // Criando elementos que serão exibidos(Base) + $elements['app'] = " + + + + + + + + + + + +
      Dados do Aplicativo
      NomeE-mailSite
      ".$base['app'].''.$base['email'].'Open Site
      '; + + $elements['list'] = "
        "; + // Criando elementos que serão exibidos(Membros) + foreach ($membros as $membro) { + + $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; + $elements['list'] .= '
      • + +
        +
      • '; + } + $elements['list'] .= '
      '; + echo json_encode($elements); diff --git a/app/ConvertjsonToArray/index.html b/app/ConvertjsonToArray/index.html new file mode 100644 index 0000000..1d6095b --- /dev/null +++ b/app/ConvertjsonToArray/index.html @@ -0,0 +1,70 @@ + + + + Retorna Dados do Arquivo CodingDojo.json + + + + + + +
      +
      +
      +

      Caminho do arquivo: data/codingdojo.json

      +
      +
      + +
      +
      +

      Lista de membros

      +
      +
      +
      + + + + +

      Criado Por Acidiney Dias

      + + + \ No newline at end of file diff --git a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php new file mode 100644 index 0000000..8b67c3b --- /dev/null +++ b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php @@ -0,0 +1,25 @@ +source = $source; + $this->data = file_get_contents($source); + } + + public function Itera() + { + return json_decode($this->data, true); + } +} \ No newline at end of file diff --git a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php new file mode 100644 index 0000000..e6a4196 --- /dev/null +++ b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php @@ -0,0 +1,29 @@ +url = 'https://github.com/codingdojoangola/dojophp/raw/desafios/data/codingdojo.json'; + $this->instance = new ConvertJsonForArrayAPI($this->url); + + $data = $this->instance->Itera(); + + $this->assertNotEmpty($data); + $this->assertInternalType('array', $data); + $this->assertArrayHasKey('membros', $data); + } +} \ No newline at end of file From 54ec617b8bc5994633aa4f8853675defc0c3deb3 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Sat, 28 Oct 2017 11:57:11 +0100 Subject: [PATCH 17/24] =?UTF-8?q?Novas=20altera=C3=A7=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ConvertjsonToArray/controller.php | 2 +- app/ConvertjsonToArray/index.html | 13 ++++++------- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 9 ++++++--- src/ConvertJsonToArray/ConvertJsonForArrayAPI.php | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php index 1a15176..96389df 100644 --- a/app/ConvertjsonToArray/controller.php +++ b/app/ConvertjsonToArray/controller.php @@ -33,7 +33,7 @@ ".$base['app'].' '.$base['email'].' - Open Site + Open Site '; diff --git a/app/ConvertjsonToArray/index.html b/app/ConvertjsonToArray/index.html index 1d6095b..cc6f613 100644 --- a/app/ConvertjsonToArray/index.html +++ b/app/ConvertjsonToArray/index.html @@ -9,8 +9,8 @@ .container { box-sizing: border-box; - padding-top:5%; - + padding-top:5%; + } .panel { @@ -31,14 +31,14 @@ } - -
      + +

      Caminho do arquivo: data/codingdojo.json

      - +

      Lista de membros

      @@ -57,7 +57,6 @@

      Criado Por Acidiney Dias

      $.ajax({ url:"controller.php", type:"POST", - data:{'date': data, 'opt' : 1}, dataType: 'json', success: function(data){ $('#carregamento').html(data.app); @@ -67,4 +66,4 @@

      Criado Por Acidiney Dias

      } - \ No newline at end of file + diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index fb6eb19..00eea3a 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -25,9 +25,12 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { - $this->data = ['E-mail' => $this->email, - 'Name' => $this->name, - 'Telefone' => $this->telephone, ]; + $this->data = + [ + 'E-mail' => $this->email, + 'Name' => $this->name, + 'Telefone' => $this->telephone, + ]; return $this->data; } diff --git a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php index 8b67c3b..15b7b4a 100644 --- a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php +++ b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php @@ -15,11 +15,11 @@ class ConvertJsonForArrayAPI public function __construct($source) { $this->source = $source; - $this->data = file_get_contents($source); } public function Itera() { + $this->data = file_get_contents($this->source); return json_decode($this->data, true); } -} \ No newline at end of file +} From 7c8591a82a31d5073253ade36e05b852e6965e4e Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 17 Nov 2017 08:33:00 +0100 Subject: [PATCH 18/24] Clear Conflites --- app/ConvertjsonToArray/controller.php | 8 +------ app/ConvertjsonToArray/index.html | 24 ------------------- .../ConvertJsonForArrayAPI.php | 16 ------------- src/UpdateFileJson/UpdateFileJsonAPI.php | 20 ++++++++++++++++ .../ConvertJsonForArrayTest.php | 24 ------------------- 5 files changed, 21 insertions(+), 71 deletions(-) create mode 100644 src/UpdateFileJson/UpdateFileJsonAPI.php diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php index 6644204..5b87215 100644 --- a/app/ConvertjsonToArray/controller.php +++ b/app/ConvertjsonToArray/controller.php @@ -33,11 +33,8 @@ ".$base['app'].' '.$base['email'].' -<<<<<<< HEAD Open Site -======= - Open Site ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 + '; @@ -45,10 +42,7 @@ $elements['list'] = "
        "; // Criando elementos que serão exibidos(Membros) foreach ($membros as $membro) { -<<<<<<< HEAD -======= ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; $elements['list'] .= '
      • diff --git a/app/ConvertjsonToArray/index.html b/app/ConvertjsonToArray/index.html index ff767ed..e011dd0 100644 --- a/app/ConvertjsonToArray/index.html +++ b/app/ConvertjsonToArray/index.html @@ -9,13 +9,7 @@ .container { box-sizing: border-box; -<<<<<<< HEAD padding-top:5%; - -======= - padding-top:5%; - ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 } .panel { @@ -36,23 +30,13 @@ } -<<<<<<< HEAD
        -======= - -
        ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2

        Caminho do arquivo: data/codingdojo.json

        -<<<<<<< HEAD - -======= - ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2

        Lista de membros

        @@ -71,10 +55,6 @@

        Criado Por Acidiney Dias

        $.ajax({ url:"controller.php", type:"POST", -<<<<<<< HEAD -======= - data:{'date': data, 'opt' : 1}, ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 dataType: 'json', success: function(data){ $('#carregamento').html(data.app); @@ -84,8 +64,4 @@

        Criado Por Acidiney Dias

        } -<<<<<<< HEAD -======= - ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 diff --git a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php index 27e43c3..15b7b4a 100644 --- a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php +++ b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php @@ -9,7 +9,6 @@ */ class ConvertJsonForArrayAPI { -<<<<<<< HEAD public $source; public $data; @@ -23,19 +22,4 @@ public function Itera() $this->data = file_get_contents($this->source); return json_decode($this->data, true); } -======= - public $source; - public $data; - - public function __construct($source) - { - $this->source = $source; - $this->data = file_get_contents($source); - } - - public function Itera() - { - return json_decode($this->data, true); - } ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 } diff --git a/src/UpdateFileJson/UpdateFileJsonAPI.php b/src/UpdateFileJson/UpdateFileJsonAPI.php new file mode 100644 index 0000000..43fe040 --- /dev/null +++ b/src/UpdateFileJson/UpdateFileJsonAPI.php @@ -0,0 +1,20 @@ +source = $source; + $this->data = $dataInputs; + } + + public function UpdateFile(){ + + } +} + + diff --git a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php index f2a5802..aff93ea 100644 --- a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php +++ b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php @@ -1,16 +1,10 @@ >>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 *@author Acidiney Dias * *@link https://www.github.com/acidiney @@ -19,7 +13,6 @@ */ class ConvertJsonForArrayTest extends TestCase { -<<<<<<< HEAD public $url; public $instance; @@ -35,20 +28,3 @@ public function testGetData() $this->assertArrayHasKey('membros', $data); } } -======= - public $url; - public $instance; - - public function testGetData() - { - $this->url = 'https://github.com/codingdojoangola/dojophp/raw/desafios/data/codingdojo.json'; - $this->instance = new ConvertJsonForArrayAPI($this->url); - - $data = $this->instance->Itera(); - - $this->assertNotEmpty($data); - $this->assertInternalType('array', $data); - $this->assertArrayHasKey('membros', $data); - } -} ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 From 13972918e5d6495b4a096213ebab4e808c393db8 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 17 Nov 2017 11:24:01 +0100 Subject: [PATCH 19/24] Exercicio feito2 --- app/UpdateFileJson/controller.php | 18 +++++ app/UpdateFileJson/index.html | 75 +++++++++++++++++++ data/codingdojo.json | 68 +---------------- src/UpdateFileJson/UpdateFileJsonAPI.php | 34 ++++++++- .../ConvertJsonForArrayTest.php | 2 +- .../UpdateFileJsonTest/UpdateFileJsonTest.php | 37 +++++++++ 6 files changed, 163 insertions(+), 71 deletions(-) create mode 100644 app/UpdateFileJson/controller.php create mode 100644 app/UpdateFileJson/index.html create mode 100644 tests/UpdateFileJsonTest/UpdateFileJsonTest.php diff --git a/app/UpdateFileJson/controller.php b/app/UpdateFileJson/controller.php new file mode 100644 index 0000000..46de558 --- /dev/null +++ b/app/UpdateFileJson/controller.php @@ -0,0 +1,18 @@ + addslashes($_POST['name']), + "cargo" => addslashes($_POST['function']), + "avatar" => "" +]; +$source = "../../data/codingdojo.json"; +$key = "membros"; + +// Instaciando Classe UpdateFileJsonAPI +$new = new UpdateFileJsonAPI($data, $source, $key); +$msg = $new->UpdateFile(); +echo json_encode($msg); \ No newline at end of file diff --git a/app/UpdateFileJson/index.html b/app/UpdateFileJson/index.html new file mode 100644 index 0000000..9ad2762 --- /dev/null +++ b/app/UpdateFileJson/index.html @@ -0,0 +1,75 @@ + + + + + + + Atualizando ficheiro do dojo + + + + + + +
        +

        Adicionando novos dados ao arquivo json

        + +
        +

        * Preencha os campos

        + + + + + +

        Status de retorno

        +
        +
        +

        * PREVIEW

        +
        + +
        + + + + \ No newline at end of file diff --git a/data/codingdojo.json b/data/codingdojo.json index 549c423..5748af2 100644 --- a/data/codingdojo.json +++ b/data/codingdojo.json @@ -1,67 +1 @@ -{ - "app": "Coding Dojo Angola", - "url": "http://codingdojoangola.com", - "email": "geral@codingdojoangola.com", - "membros": [ - { - "nome": "Lucius Curado", - "cargo": "Moderador e Organizador", - "avatar": "" - }, - { - "nome": "José Cage", - "cargo": "Moderador e instrutor", - "avatar": "" - }, - { - "nome": "Doriel Fonseca", - "cargo": "Instrutor #dojojavascript", - "avatar": "" - }, - { - "nome": "Pedro Massango", - "cargo": "Desenvolvedor Java", - "avatar": "" - }, - { - "nome": "Eleandro Duzentos", - "cargo": "Desenvolvedor PHP e .Net", - "avatar": "" - }, - { - "nome": "Renato Martins", - "cargo": "Desenvolvedor Java e PHP", - "avatar": "" - }, - { - "nome": "Victor Kiffen", - "cargo": "Desenvolvedor Java", - "avatar": "" - }, - { - "nome": "Jetro Domingos", - "cargo": "Desenvolvedor Java", - "avatar": "" - }, - { - "nome": "Acidiney Dias", - "cargo": "Desenvolvedor PHP", - "avatar": "" - }, - { - "nome": "Nelson Júnior", - "cargo": "Desenvolvedor PHP", - "avatar": "" - }, - { - "nome": "Masiry Link", - "cargo": "Desenvolvedor PHP", - "avatar": "" - }, - { - "nome": "Aleixo Jeronimo", - "cargo": "", - "avatar": "" - } - ] -} \ No newline at end of file +{"app":"Coding Dojo Angola","url":"http:\/\/codingdojoangola.com","email":"geral@codingdojoangola.com","membros":[{"nome":"Lucius Curado","cargo":"Moderador e Organizador","avatar":""},{"nome":"Jos\u00e9 Cage","cargo":"Moderador e instrutor","avatar":""},{"nome":"Doriel Fonseca","cargo":"Instrutor #dojojavascript","avatar":""},{"nome":"Pedro Massango","cargo":"Desenvolvedor Java","avatar":""},{"nome":"Eleandro Duzentos","cargo":"Desenvolvedor PHP e .Net","avatar":""},{"nome":"Renato Martins","cargo":"Desenvolvedor Java e PHP","avatar":""},{"nome":"Victor Kiffen","cargo":"Desenvolvedor Java","avatar":""},{"nome":"Jetro Domingos","cargo":"Desenvolvedor Java","avatar":""},{"nome":"Acidiney Dias","cargo":"Desenvolvedor PHP","avatar":""},{"nome":"Nelson J\u00fanior","cargo":"Desenvolvedor PHP","avatar":""},{"nome":"Masiry Link","cargo":"Desenvolvedor PHP","avatar":""},{"nome":"Aleixo Jeronimo","cargo":"","avatar":""},{"nome":"Cuz\u00e3o","cargo":"aaa","avatar":""},{"nome":"aa","cargo":"aaa","avatar":""}]} \ No newline at end of file diff --git a/src/UpdateFileJson/UpdateFileJsonAPI.php b/src/UpdateFileJson/UpdateFileJsonAPI.php index 43fe040..023fc99 100644 --- a/src/UpdateFileJson/UpdateFileJsonAPI.php +++ b/src/UpdateFileJson/UpdateFileJsonAPI.php @@ -2,19 +2,47 @@ namespace DojoPHP\UpdateFileJson; +/** + * @author Acidiney Dias + * @desc this class expected three parameters [$dataInput(is Array), $source and a $key] + * @return json with a message with status the return + */ class UpdateFileJsonAPI { public $source; public $data = []; + public $openFile; + public $alterFile; + public $key; - public function __construct($dataInputs = [], $source){ + public function __construct($dataInputs = [], $source, $key){ $this->source = $source; $this->data = $dataInputs; + $this->key = $key; } public function UpdateFile(){ + // var_dump($this->data); echo "
        "; + // I'm open file Json passed + $this->openFile = file_get_contents($this->source); + + // Transform "temporary" he in array for php understand + $this->alterFile = json_decode($this->openFile, true); + + // Now I'm used a method the PHP for add the new data in my collection data, + //using array push + + array_push($this->alterFile["$this->key"], $this->data); + + // So I'm encode again the file for json formatter + $this->alterFile = json_encode($this->alterFile); + + // In the end, I'm add the new data in my file original + if(file_put_contents($this->source, $this->alterFile)): + return json_encode(["message" => "File updated with success!"], 201) ; + else: + return json_encode(["message" => "File not was updated!"], 400); + endif; } } - - diff --git a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php index aff93ea..a3f9023 100644 --- a/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php +++ b/tests/ConvertJsonToArray/ConvertJsonForArrayTest.php @@ -18,7 +18,7 @@ class ConvertJsonForArrayTest extends TestCase public function testGetData() { - $this->url = 'https://github.com/codingdojoangola/dojophp/raw/desafios/data/codingdojo.json'; + $this->url = './data/codingdojo.json'; $this->instance = new ConvertJsonForArrayAPI($this->url); $data = $this->instance->Itera(); diff --git a/tests/UpdateFileJsonTest/UpdateFileJsonTest.php b/tests/UpdateFileJsonTest/UpdateFileJsonTest.php new file mode 100644 index 0000000..6980ce8 --- /dev/null +++ b/tests/UpdateFileJsonTest/UpdateFileJsonTest.php @@ -0,0 +1,37 @@ +source = "./data/codingdojo.json"; + $this->key = "membros"; + $this->data = [ + "nome" => "Test Unit", + "cargo" => "Test Function", + "avatar" => "" + ]; + // New instance the API + $UFJA = new UpdateFileJsonAPI($this->data, $this->source, $this->key); + $result = json_decode($UFJA->UpdateFile(), true); + // Testing result + $this->assertNotEmpty($result); + $this->assertInternalType('array', $result); + $this->assertArrayHasKey('message', $result); + } + } \ No newline at end of file From 911f0d7d23ae232ef074842c4016ac4c71148820 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 17 Nov 2017 11:52:22 +0100 Subject: [PATCH 20/24] styleCI --- app/ConvertjsonToArray/controller.php | 1 - app/UpdateFileJson/controller.php | 11 +++++----- .../ConvertJsonForArrayAPI.php | 1 + src/UpdateFileJson/UpdateFileJsonAPI.php | 20 ++++++++++--------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/ConvertjsonToArray/controller.php b/app/ConvertjsonToArray/controller.php index 96389df..a2a62cb 100644 --- a/app/ConvertjsonToArray/controller.php +++ b/app/ConvertjsonToArray/controller.php @@ -41,7 +41,6 @@ $elements['list'] = "
          "; // Criando elementos que serão exibidos(Membros) foreach ($membros as $membro) { - $img = $membro['avatar'] ? $membro['avatar'] : 'atomix_user31.png'; $elements['list'] .= '
        • diff --git a/app/UpdateFileJson/controller.php b/app/UpdateFileJson/controller.php index 46de558..c9f3a7f 100644 --- a/app/UpdateFileJson/controller.php +++ b/app/UpdateFileJson/controller.php @@ -1,16 +1,17 @@ addslashes($_POST['name']), - "cargo" => addslashes($_POST['function']), - "avatar" => "" + 'nome' => addslashes($_POST['name']), + 'cargo' => addslashes($_POST['function']), + 'avatar' => '', ]; -$source = "../../data/codingdojo.json"; -$key = "membros"; +$source = '../../data/codingdojo.json'; +$key = 'membros'; // Instaciando Classe UpdateFileJsonAPI $new = new UpdateFileJsonAPI($data, $source, $key); diff --git a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php index c4525ea..83b8d88 100644 --- a/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php +++ b/src/ConvertJsonToArray/ConvertJsonForArrayAPI.php @@ -20,6 +20,7 @@ public function __construct($source) public function Itera() { $this->data = file_get_contents($this->source); + return json_decode($this->data, true); } } \ No newline at end of file diff --git a/src/UpdateFileJson/UpdateFileJsonAPI.php b/src/UpdateFileJson/UpdateFileJsonAPI.php index 023fc99..adf7fbd 100644 --- a/src/UpdateFileJson/UpdateFileJsonAPI.php +++ b/src/UpdateFileJson/UpdateFileJsonAPI.php @@ -7,7 +7,8 @@ * @desc this class expected three parameters [$dataInput(is Array), $source and a $key] * @return json with a message with status the return */ -class UpdateFileJsonAPI { +class UpdateFileJsonAPI +{ public $source; public $data = []; @@ -15,13 +16,15 @@ class UpdateFileJsonAPI { public $alterFile; public $key; - public function __construct($dataInputs = [], $source, $key){ + public function __construct($dataInputs = [], $source, $key) + { $this->source = $source; $this->data = $dataInputs; $this->key = $key; } - public function UpdateFile(){ + public function UpdateFile() + { // var_dump($this->data); echo "
          "; // I'm open file Json passed @@ -30,18 +33,17 @@ public function UpdateFile(){ // Transform "temporary" he in array for php understand $this->alterFile = json_decode($this->openFile, true); - // Now I'm used a method the PHP for add the new data in my collection data, + // Now I'm used a method the PHP for add the new data in my collection data, //using array push - + array_push($this->alterFile["$this->key"], $this->data); - + // So I'm encode again the file for json formatter $this->alterFile = json_encode($this->alterFile); - + // In the end, I'm add the new data in my file original if(file_put_contents($this->source, $this->alterFile)): - return json_encode(["message" => "File updated with success!"], 201) ; - else: + return json_encode(["message" => "File updated with success!"], 201); else: return json_encode(["message" => "File not was updated!"], 400); endif; } From 7ed697d8dae9a4500d437116e6302669920264e4 Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 17 Nov 2017 11:56:32 +0100 Subject: [PATCH 21/24] styleCI --- src/ArrayDeInformacoes/ArrayInformationsAPI.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/ArrayDeInformacoes/ArrayInformationsAPI.php b/src/ArrayDeInformacoes/ArrayInformationsAPI.php index d2666e8..00eea3a 100644 --- a/src/ArrayDeInformacoes/ArrayInformationsAPI.php +++ b/src/ArrayDeInformacoes/ArrayInformationsAPI.php @@ -25,28 +25,12 @@ public function __construct($email, $name, $telephone) public function CreateArrayWithInformation() { -<<<<<<< HEAD $this->data = [ -<<<<<<< HEAD 'E-mail' => $this->email, 'Name' => $this->name, 'Telefone' => $this->telephone, ]; -======= - 'E-mail' => $this->email, - 'Name' => $this->name, - 'Telefone' => $this->telephone, - ]; ->>>>>>> 6f5974ba3bdf6b90be4d5f374a80f1ab78d833e2 -======= - $this->data = - [ - 'E-mail' => $this->email, - 'Name' => $this->name, - 'Telefone' => $this->telephone, - ]; ->>>>>>> 121482478c788d821744c6ff358ef8c988eef12c return $this->data; } From b8fbf6e89fcfb453aecc23234bcebe244776d5db Mon Sep 17 00:00:00 2001 From: Acidiney Dias Date: Fri, 17 Nov 2017 12:10:37 +0100 Subject: [PATCH 22/24] Add Link --- app/UpdateFileJson/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/UpdateFileJson/index.html b/app/UpdateFileJson/index.html index 9ad2762..f322969 100644 --- a/app/UpdateFileJson/index.html +++ b/app/UpdateFileJson/index.html @@ -50,7 +50,7 @@

          Adicionando novos dados ao arquivo json


          * PREVIEW

          - +