@@ -48,11 +48,11 @@ |
||
| 48 | 48 | $request = $request->withParsedBody($requestData); |
| 49 | 49 | } |
| 50 | 50 | $response = new Response(); |
| 51 | - $settings = require __DIR__ . '/../src/settings.php'; |
|
| 51 | + $settings = require __DIR__.'/../src/settings.php'; |
|
| 52 | 52 | $app = new App($settings); |
| 53 | - require __DIR__ . '/../src/dependencies.php'; |
|
| 54 | - require __DIR__ . '/../src/middleware.php'; |
|
| 55 | - require __DIR__ . '/../src/routes.php'; |
|
| 53 | + require __DIR__.'/../src/dependencies.php'; |
|
| 54 | + require __DIR__.'/../src/middleware.php'; |
|
| 55 | + require __DIR__.'/../src/routes.php'; |
|
| 56 | 56 | $response = $app->process($request, $response); |
| 57 | 57 | return $response; |
| 58 | 58 | } |
@@ -13,15 +13,15 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | ini_set('date.timezone', 'Europe/Istanbul'); |
| 16 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 16 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 17 | 17 | session_start(); |
| 18 | -$settings = require __DIR__ . '/../src/settings.php'; |
|
| 18 | +$settings = require __DIR__.'/../src/settings.php'; |
|
| 19 | 19 | $app = new \Slim\App($settings); |
| 20 | -require __DIR__ . '/../src/dependencies.php'; |
|
| 21 | -require __DIR__ . '/../src/middleware.php'; |
|
| 22 | -require __DIR__ . '/../src/routes.php'; |
|
| 20 | +require __DIR__.'/../src/dependencies.php'; |
|
| 21 | +require __DIR__.'/../src/middleware.php'; |
|
| 22 | +require __DIR__.'/../src/routes.php'; |
|
| 23 | 23 | |
| 24 | -Sentry\init(['dsn' => 'https://[email protected]/1491710' ]); |
|
| 24 | +Sentry\init(['dsn' => 'https://[email protected]/1491710']); |
|
| 25 | 25 | |
| 26 | 26 | $app->run(); |
| 27 | 27 | |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | public function __construct() |
| 38 | 38 | { |
| 39 | 39 | defined('DS') ?: define('DS', DIRECTORY_SEPARATOR); |
| 40 | - defined('ENVROOT') ?: define('ENVROOT', dirname(__DIR__) . DS); |
|
| 41 | - if (file_exists(ENVROOT . '.env')) { |
|
| 40 | + defined('ENVROOT') ?: define('ENVROOT', dirname(__DIR__).DS); |
|
| 41 | + if (file_exists(ENVROOT.'.env')) { |
|
| 42 | 42 | $dotenv = new Dotenv(ENVROOT); |
| 43 | 43 | try { |
| 44 | 44 | $dotenv->load(); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if ($_SERVER['REQUEST_URI'] == '/comment/list') { |
| 74 | - $post = json_decode(file_get_contents('php://input'),true); |
|
| 74 | + $post = json_decode(file_get_contents('php://input'), true); |
|
| 75 | 75 | $product_id = $post['product_id']; |
| 76 | 76 | $comments = $this->db->prepare('SELECT * FROM comments where product_id=:product_id'); |
| 77 | 77 | $comments->execute(['product_id'=>$product_id]); |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | if ($_SERVER['REQUEST_URI'] == '/comment/add') { |
| 83 | 83 | |
| 84 | 84 | $token = $this->getToken(); |
| 85 | - if(!$token) { |
|
| 85 | + if (!$token) { |
|
| 86 | 86 | die(json_encode(['error'=>'authentication error!'])); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $client = new Client(); |
| 90 | 90 | $headers = [ |
| 91 | - 'Authorization' => 'Bearer ' . $token, |
|
| 91 | + 'Authorization' => 'Bearer '.$token, |
|
| 92 | 92 | 'Accept' => 'application/json', |
| 93 | 93 | ]; |
| 94 | 94 | $res = $client->request('GET', 'http://user_management_nginx_1/user/checkToken', |
@@ -98,16 +98,16 @@ discard block |
||
| 98 | 98 | ] |
| 99 | 99 | ); |
| 100 | 100 | $httpCode = $res->getStatusCode(); |
| 101 | - if($httpCode!=200) |
|
| 101 | + if ($httpCode != 200) |
|
| 102 | 102 | { |
| 103 | 103 | die(json_encode(['error'=>'authentication error!'])); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $response = json_decode($res->getBody(),1); |
|
| 106 | + $response = json_decode($res->getBody(), 1); |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | |
| 110 | - $post = json_decode(file_get_contents('php://input'),true); |
|
| 110 | + $post = json_decode(file_get_contents('php://input'), true); |
|
| 111 | 111 | |
| 112 | 112 | $data = [ |
| 113 | 113 | 'product_id' => $post['product_id'], |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ]; |
| 119 | 119 | $sql = "INSERT INTO comments (product_id, comment, user_id, user_name, comment_date) VALUES |
| 120 | 120 | (:product_id, :comment, :user_id, :user_name, :comment_date)"; |
| 121 | - $stmt= $this->db->prepare($sql); |
|
| 121 | + $stmt = $this->db->prepare($sql); |
|
| 122 | 122 | $stmt->execute($data); |
| 123 | 123 | |
| 124 | 124 | die(json_encode(['id'=>$this->db->lastInsertId()], JSON_UNESCAPED_UNICODE)); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | require_once __DIR__.'/../vendor/autoload.php'; |
| 17 | 17 | |
| 18 | 18 | |
| 19 | -Sentry\init(['dsn' => 'https://[email protected]/1491710' ]); |
|
| 19 | +Sentry\init(['dsn' => 'https://[email protected]/1491710']); |
|
| 20 | 20 | |
| 21 | 21 | $app = new CommentManagement\Application(); |
| 22 | 22 | $app->run(); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $this->queue->isAutoDelete() |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | - $message = new AMQPMessage(json_encode(['product_id'=>1,'product_name'=>'deneme'], JSON_UNESCAPED_SLASHES), array('delivery_mode' => 2)); |
|
| 35 | + $message = new AMQPMessage(json_encode(['product_id'=>1, 'product_name'=>'deneme'], JSON_UNESCAPED_SLASHES), array('delivery_mode' => 2)); |
|
| 36 | 36 | $channel->basic_publish($message, '', $this->queue->getName()); |
| 37 | 37 | |
| 38 | 38 | // $channel->queue_declare( |
@@ -31,8 +31,8 @@ |
||
| 31 | 31 | public function __construct() |
| 32 | 32 | { |
| 33 | 33 | defined('DS') ?: define('DS', DIRECTORY_SEPARATOR); |
| 34 | - defined('ENVROOT') ?: define('ENVROOT', dirname(__DIR__) . DS); |
|
| 35 | - if (file_exists(ENVROOT . '.env')) { |
|
| 34 | + defined('ENVROOT') ?: define('ENVROOT', dirname(__DIR__).DS); |
|
| 35 | + if (file_exists(ENVROOT.'.env')) { |
|
| 36 | 36 | $dotenv = new Dotenv(ENVROOT); |
| 37 | 37 | try { |
| 38 | 38 | $dotenv->load(); |
@@ -31,11 +31,11 @@ |
||
| 31 | 31 | { |
| 32 | 32 | $consumer = new Consumer(new OrderQueue()); |
| 33 | 33 | |
| 34 | - $consumer->addCallback(function (AMQPMessage $message) { |
|
| 34 | + $consumer->addCallback(function(AMQPMessage $message) { |
|
| 35 | 35 | //echo (':::'.$message); |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - $consumer->work(function (string $output) { |
|
| 38 | + $consumer->work(function(string $output) { |
|
| 39 | 39 | //echo $output."\n"; |
| 40 | 40 | }); |
| 41 | 41 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | require_once __DIR__.'/../vendor/autoload.php'; |
| 18 | 18 | |
| 19 | -Sentry\init(['dsn' => 'https://[email protected]/1491710' ]); |
|
| 19 | +Sentry\init(['dsn' => 'https://[email protected]/1491710']); |
|
| 20 | 20 | |
| 21 | 21 | $app = new OrderManagement\Application(); |
| 22 | 22 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | public function __construct() |
| 37 | 37 | { |
| 38 | 38 | defined('DS') ?: define('DS', DIRECTORY_SEPARATOR); |
| 39 | - defined('ENVROOT') ?: define('ENVROOT', dirname(__DIR__) . DS); |
|
| 40 | - if (file_exists(ENVROOT . '.env')) { |
|
| 39 | + defined('ENVROOT') ?: define('ENVROOT', dirname(__DIR__).DS); |
|
| 40 | + if (file_exists(ENVROOT.'.env')) { |
|
| 41 | 41 | $dotenv = new Dotenv(ENVROOT); |
| 42 | 42 | try { |
| 43 | 43 | $dotenv->load(); |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | if ($_SERVER['REQUEST_URI'] == '/category/add') { |
| 80 | 80 | |
| 81 | 81 | $token = $this->getToken(); |
| 82 | - if(!$token) { |
|
| 82 | + if (!$token) { |
|
| 83 | 83 | die(json_encode(['error'=>'authentication error!'])); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $client = new Client(); |
| 87 | 87 | $headers = [ |
| 88 | - 'Authorization' => 'Bearer ' . $token, |
|
| 88 | + 'Authorization' => 'Bearer '.$token, |
|
| 89 | 89 | 'Accept' => 'application/json', |
| 90 | 90 | ]; |
| 91 | 91 | $res = $client->request('GET', 'http://user_management_nginx_1/user/checkToken', |
@@ -95,26 +95,26 @@ discard block |
||
| 95 | 95 | ] |
| 96 | 96 | ); |
| 97 | 97 | $httpCode = $res->getStatusCode(); |
| 98 | - if($httpCode!=200) |
|
| 98 | + if ($httpCode != 200) |
|
| 99 | 99 | { |
| 100 | 100 | die(json_encode(['error'=>'authentication error!'])); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| 104 | - $response = json_decode($res->getBody(),1); |
|
| 104 | + $response = json_decode($res->getBody(), 1); |
|
| 105 | 105 | $isAdmin = $response['user']['is_admin']; |
| 106 | 106 | |
| 107 | - if(!$isAdmin) { |
|
| 107 | + if (!$isAdmin) { |
|
| 108 | 108 | die(json_encode(['error'=>'admin only!'])); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $post = json_decode(file_get_contents('php://input'),true); |
|
| 111 | + $post = json_decode(file_get_contents('php://input'), true); |
|
| 112 | 112 | |
| 113 | 113 | $data = [ |
| 114 | 114 | 'category_name' => $post['category_name'] |
| 115 | 115 | ]; |
| 116 | 116 | $sql = "INSERT INTO categories (category_name) VALUES (:category_name)"; |
| 117 | - $stmt= $this->db->prepare($sql); |
|
| 117 | + $stmt = $this->db->prepare($sql); |
|
| 118 | 118 | $stmt->execute($data); |
| 119 | 119 | |
| 120 | 120 | die(json_encode(['id'=>$this->db->lastInsertId()])); |