@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
| 17 | 17 | $err = curl_errno($curl); |
| 18 | -$errmsg = curl_error($curl) ; |
|
| 18 | +$errmsg = curl_error($curl); |
|
| 19 | 19 | |
| 20 | 20 | curl_close($curl); |
| 21 | 21 | |
@@ -3,17 +3,17 @@ |
||
| 3 | 3 | $curl = curl_init(); |
| 4 | 4 | |
| 5 | 5 | curl_setopt_array($curl, array( |
| 6 | - CURLOPT_URL => 'https://localhost/v1/restaurants', |
|
| 7 | - CURLOPT_RETURNTRANSFER => true, |
|
| 8 | - CURLOPT_ENCODING => '', |
|
| 9 | - CURLOPT_MAXREDIRS => 10, |
|
| 10 | - CURLOPT_TIMEOUT => 0, |
|
| 11 | - CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | - CURLOPT_CUSTOMREQUEST => 'GET', |
|
| 14 | - CURLOPT_HTTPHEADER => array( |
|
| 6 | + CURLOPT_URL => 'https://localhost/v1/restaurants', |
|
| 7 | + CURLOPT_RETURNTRANSFER => true, |
|
| 8 | + CURLOPT_ENCODING => '', |
|
| 9 | + CURLOPT_MAXREDIRS => 10, |
|
| 10 | + CURLOPT_TIMEOUT => 0, |
|
| 11 | + CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | + CURLOPT_CUSTOMREQUEST => 'GET', |
|
| 14 | + CURLOPT_HTTPHEADER => array( |
|
| 15 | 15 | 'page: 1' |
| 16 | - ), |
|
| 16 | + ), |
|
| 17 | 17 | )); |
| 18 | 18 | |
| 19 | 19 | $response = curl_exec($curl); |
@@ -11,12 +11,12 @@ |
||
| 11 | 11 | CURLOPT_FOLLOWLOCATION => true, |
| 12 | 12 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
| 13 | 13 | CURLOPT_CUSTOMREQUEST => 'POST', |
| 14 | - CURLOPT_POSTFIELDS => array('name' => 'Goomer','image' => 'image/img.jpg','address' => 'Rua Sorocaba, 000, Sorocaba-SP','is_active' => '1','is_accepted' => '1','is_schedulable' => '1','schedule_data' => '{"wednesday":[{"open" :"21:20","close" :"23:48"}]}'), |
|
| 14 | + CURLOPT_POSTFIELDS => array('name' => 'Goomer', 'image' => 'image/img.jpg', 'address' => 'Rua Sorocaba, 000, Sorocaba-SP', 'is_active' => '1', 'is_accepted' => '1', 'is_schedulable' => '1', 'schedule_data' => '{"wednesday":[{"open" :"21:20","close" :"23:48"}]}'), |
|
| 15 | 15 | )); |
| 16 | 16 | |
| 17 | 17 | $response = curl_exec($curl); |
| 18 | 18 | $err = curl_errno($curl); |
| 19 | -$errmsg = curl_error($curl) ; |
|
| 19 | +$errmsg = curl_error($curl); |
|
| 20 | 20 | |
| 21 | 21 | curl_close($curl); |
| 22 | 22 | |
@@ -3,15 +3,15 @@ |
||
| 3 | 3 | $curl = curl_init(); |
| 4 | 4 | |
| 5 | 5 | curl_setopt_array($curl, array( |
| 6 | - CURLOPT_URL => 'https://localhost/v1/restaurants', |
|
| 7 | - CURLOPT_RETURNTRANSFER => true, |
|
| 8 | - CURLOPT_ENCODING => '', |
|
| 9 | - CURLOPT_MAXREDIRS => 10, |
|
| 10 | - CURLOPT_TIMEOUT => 0, |
|
| 11 | - CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | - CURLOPT_CUSTOMREQUEST => 'POST', |
|
| 14 | - CURLOPT_POSTFIELDS => array('name' => 'Goomer','image' => 'image/img.jpg','address' => 'Rua Sorocaba, 000, Sorocaba-SP','is_active' => '1','is_accepted' => '1','is_schedulable' => '1','schedule_data' => '{"wednesday":[{"open" :"21:20","close" :"23:48"}]}'), |
|
| 6 | + CURLOPT_URL => 'https://localhost/v1/restaurants', |
|
| 7 | + CURLOPT_RETURNTRANSFER => true, |
|
| 8 | + CURLOPT_ENCODING => '', |
|
| 9 | + CURLOPT_MAXREDIRS => 10, |
|
| 10 | + CURLOPT_TIMEOUT => 0, |
|
| 11 | + CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | + CURLOPT_CUSTOMREQUEST => 'POST', |
|
| 14 | + CURLOPT_POSTFIELDS => array('name' => 'Goomer','image' => 'image/img.jpg','address' => 'Rua Sorocaba, 000, Sorocaba-SP','is_active' => '1','is_accepted' => '1','is_schedulable' => '1','schedule_data' => '{"wednesday":[{"open" :"21:20","close" :"23:48"}]}'), |
|
| 15 | 15 | )); |
| 16 | 16 | |
| 17 | 17 | $response = curl_exec($curl); |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if ( empty($data["name"]) || empty($data["address"]) ) { |
|
| 67 | + if (empty($data["name"]) || empty($data["address"])) { |
|
| 68 | 68 | $this->call( |
| 69 | 69 | 400, |
| 70 | 70 | "empty_data", |
| 71 | 71 | "Para criar informe o nome da empresa e o endereço" |
| 72 | 72 | )->back(); |
| 73 | - return ; |
|
| 73 | + return; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $restaurant = new Restaurant(); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $restaurant->schedule_data = (!empty($data["schedule_data"])) ? $data["schedule_data"] : null; |
| 84 | 84 | $restaurant->save(); |
| 85 | 85 | |
| 86 | - if($restaurant->fail()){ |
|
| 86 | + if ($restaurant->fail()) { |
|
| 87 | 87 | $this->call( |
| 88 | 88 | 400, |
| 89 | 89 | "empty_data", |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function update(array $data): void |
| 133 | 133 | { |
| 134 | - if ( empty($data["restaurant_id"]) || !$restaurant_id = filter_var($data["restaurant_id"], FILTER_VALIDATE_INT)) { |
|
| 134 | + if (empty($data["restaurant_id"]) || !$restaurant_id = filter_var($data["restaurant_id"], FILTER_VALIDATE_INT)) { |
|
| 135 | 135 | $this->call( |
| 136 | 136 | 400, |
| 137 | 137 | "invalid_data", |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $restaurant->schedule_data = (!empty($data["schedule_data"])) ? $data["schedule_data"] : $restaurant->schedule_data; |
| 161 | 161 | $restaurant->save(); |
| 162 | 162 | |
| 163 | - if($restaurant->fail()){ |
|
| 163 | + if ($restaurant->fail()) { |
|
| 164 | 164 | $this->call( |
| 165 | 165 | 400, |
| 166 | 166 | "empty_data", |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | $userCache = json_decode(file_get_contents($cacheFile)); |
| 100 | 100 | $cache = (array)$userCache; |
| 101 | 101 | |
| 102 | - $save = function ($cacheFile, $cache) { |
|
| 102 | + $save = function($cacheFile, $cache) { |
|
| 103 | 103 | $saveCache = fopen($cacheFile, "w"); |
| 104 | 104 | fwrite($saveCache, json_encode($cache, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); |
| 105 | 105 | fclose($saveCache); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
| 17 | 17 | $err = curl_errno($curl); |
| 18 | -$errmsg = curl_error($curl) ; |
|
| 18 | +$errmsg = curl_error($curl); |
|
| 19 | 19 | |
| 20 | 20 | curl_close($curl); |
| 21 | 21 | |
@@ -3,14 +3,14 @@ |
||
| 3 | 3 | $curl = curl_init(); |
| 4 | 4 | |
| 5 | 5 | curl_setopt_array($curl, array( |
| 6 | - CURLOPT_URL => 'https://localhost/v1/restaurants/1', |
|
| 7 | - CURLOPT_RETURNTRANSFER => true, |
|
| 8 | - CURLOPT_ENCODING => '', |
|
| 9 | - CURLOPT_MAXREDIRS => 10, |
|
| 10 | - CURLOPT_TIMEOUT => 0, |
|
| 11 | - CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | - CURLOPT_CUSTOMREQUEST => 'DELETE', |
|
| 6 | + CURLOPT_URL => 'https://localhost/v1/restaurants/1', |
|
| 7 | + CURLOPT_RETURNTRANSFER => true, |
|
| 8 | + CURLOPT_ENCODING => '', |
|
| 9 | + CURLOPT_MAXREDIRS => 10, |
|
| 10 | + CURLOPT_TIMEOUT => 0, |
|
| 11 | + CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | + CURLOPT_CUSTOMREQUEST => 'DELETE', |
|
| 14 | 14 | )); |
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
| 17 | 17 | $err = curl_errno($curl); |
| 18 | -$errmsg = curl_error($curl) ; |
|
| 18 | +$errmsg = curl_error($curl); |
|
| 19 | 19 | |
| 20 | 20 | curl_close($curl); |
| 21 | 21 | |
@@ -3,14 +3,14 @@ |
||
| 3 | 3 | $curl = curl_init(); |
| 4 | 4 | |
| 5 | 5 | curl_setopt_array($curl, array( |
| 6 | - CURLOPT_URL => 'https://localhost/v1/restaurants/1', |
|
| 7 | - CURLOPT_RETURNTRANSFER => true, |
|
| 8 | - CURLOPT_ENCODING => '', |
|
| 9 | - CURLOPT_MAXREDIRS => 10, |
|
| 10 | - CURLOPT_TIMEOUT => 0, |
|
| 11 | - CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | - CURLOPT_CUSTOMREQUEST => 'GET', |
|
| 6 | + CURLOPT_URL => 'https://localhost/v1/restaurants/1', |
|
| 7 | + CURLOPT_RETURNTRANSFER => true, |
|
| 8 | + CURLOPT_ENCODING => '', |
|
| 9 | + CURLOPT_MAXREDIRS => 10, |
|
| 10 | + CURLOPT_TIMEOUT => 0, |
|
| 11 | + CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | + CURLOPT_CUSTOMREQUEST => 'GET', |
|
| 14 | 14 | )); |
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
| 17 | 17 | $err = curl_errno($curl); |
| 18 | -$errmsg = curl_error($curl) ; |
|
| 18 | +$errmsg = curl_error($curl); |
|
| 19 | 19 | |
| 20 | 20 | curl_close($curl); |
| 21 | 21 | |
@@ -3,15 +3,15 @@ |
||
| 3 | 3 | $curl = curl_init(); |
| 4 | 4 | |
| 5 | 5 | curl_setopt_array($curl, array( |
| 6 | - CURLOPT_URL => 'https://localhost/v1/restaurants/1', |
|
| 7 | - CURLOPT_RETURNTRANSFER => true, |
|
| 8 | - CURLOPT_ENCODING => '', |
|
| 9 | - CURLOPT_MAXREDIRS => 10, |
|
| 10 | - CURLOPT_TIMEOUT => 0, |
|
| 11 | - CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | - CURLOPT_CUSTOMREQUEST => 'PUT', |
|
| 14 | - CURLOPT_POSTFIELDS => 'name=Goomer&address=Rua%20Sorocaba%2C%20000%2C%20Sorocaba%2CS%C3%A3o%20Paulo&image=imagem%2Fimg.jpg&is_active=1&is_accepted=0&is_schedulable=1&schedule_data=%7B%22wednesday%22%3A%5B%7B%22open%22%20%3A%2219%3A00%22%2C%22close%22%20%3A%2223%3A59%22%7D%5D%7D', |
|
| 6 | + CURLOPT_URL => 'https://localhost/v1/restaurants/1', |
|
| 7 | + CURLOPT_RETURNTRANSFER => true, |
|
| 8 | + CURLOPT_ENCODING => '', |
|
| 9 | + CURLOPT_MAXREDIRS => 10, |
|
| 10 | + CURLOPT_TIMEOUT => 0, |
|
| 11 | + CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | + CURLOPT_CUSTOMREQUEST => 'PUT', |
|
| 14 | + CURLOPT_POSTFIELDS => 'name=Goomer&address=Rua%20Sorocaba%2C%20000%2C%20Sorocaba%2CS%C3%A3o%20Paulo&image=imagem%2Fimg.jpg&is_active=1&is_accepted=0&is_schedulable=1&schedule_data=%7B%22wednesday%22%3A%5B%7B%22open%22%20%3A%2219%3A00%22%2C%22close%22%20%3A%2223%3A59%22%7D%5D%7D', |
|
| 15 | 15 | )); |
| 16 | 16 | |
| 17 | 17 | $response = curl_exec($curl); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
| 17 | 17 | $err = curl_errno($curl); |
| 18 | -$errmsg = curl_error($curl) ; |
|
| 18 | +$errmsg = curl_error($curl); |
|
| 19 | 19 | |
| 20 | 20 | curl_close($curl); |
| 21 | 21 | |
@@ -3,14 +3,14 @@ |
||
| 3 | 3 | $curl = curl_init(); |
| 4 | 4 | |
| 5 | 5 | curl_setopt_array($curl, array( |
| 6 | - CURLOPT_URL => 'https://localhost/v1/restaurants/1/products/1', |
|
| 7 | - CURLOPT_RETURNTRANSFER => true, |
|
| 8 | - CURLOPT_ENCODING => '', |
|
| 9 | - CURLOPT_MAXREDIRS => 10, |
|
| 10 | - CURLOPT_TIMEOUT => 0, |
|
| 11 | - CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | - CURLOPT_CUSTOMREQUEST => 'DELETE', |
|
| 6 | + CURLOPT_URL => 'https://localhost/v1/restaurants/1/products/1', |
|
| 7 | + CURLOPT_RETURNTRANSFER => true, |
|
| 8 | + CURLOPT_ENCODING => '', |
|
| 9 | + CURLOPT_MAXREDIRS => 10, |
|
| 10 | + CURLOPT_TIMEOUT => 0, |
|
| 11 | + CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | + CURLOPT_CUSTOMREQUEST => 'DELETE', |
|
| 14 | 14 | )); |
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $response = curl_exec($curl); |
| 17 | 17 | $err = curl_errno($curl); |
| 18 | -$errmsg = curl_error($curl) ; |
|
| 18 | +$errmsg = curl_error($curl); |
|
| 19 | 19 | |
| 20 | 20 | curl_close($curl); |
| 21 | 21 | |
@@ -3,17 +3,17 @@ |
||
| 3 | 3 | $curl = curl_init(); |
| 4 | 4 | |
| 5 | 5 | curl_setopt_array($curl, array( |
| 6 | - CURLOPT_URL => 'https://localhost/v1/restaurants/1/products', |
|
| 7 | - CURLOPT_RETURNTRANSFER => true, |
|
| 8 | - CURLOPT_ENCODING => '', |
|
| 9 | - CURLOPT_MAXREDIRS => 10, |
|
| 10 | - CURLOPT_TIMEOUT => 0, |
|
| 11 | - CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | - CURLOPT_CUSTOMREQUEST => 'GET', |
|
| 14 | - CURLOPT_HTTPHEADER => array( |
|
| 6 | + CURLOPT_URL => 'https://localhost/v1/restaurants/1/products', |
|
| 7 | + CURLOPT_RETURNTRANSFER => true, |
|
| 8 | + CURLOPT_ENCODING => '', |
|
| 9 | + CURLOPT_MAXREDIRS => 10, |
|
| 10 | + CURLOPT_TIMEOUT => 0, |
|
| 11 | + CURLOPT_FOLLOWLOCATION => true, |
|
| 12 | + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, |
|
| 13 | + CURLOPT_CUSTOMREQUEST => 'GET', |
|
| 14 | + CURLOPT_HTTPHEADER => array( |
|
| 15 | 15 | 'page: 1' |
| 16 | - ), |
|
| 16 | + ), |
|
| 17 | 17 | )); |
| 18 | 18 | |
| 19 | 19 | $response = curl_exec($curl); |