@@ -11,6 +11,6 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Route::get('/', function () { |
|
| 14 | +Route::get('/', function() { |
|
| 15 | 15 | return view('welcome'); |
| 16 | 16 | }); |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * @param $to_store |
| 83 | - * @param $extension_file |
|
| 83 | + * @param string $extension_file |
|
| 84 | 84 | * @param $name_file |
| 85 | 85 | */ |
| 86 | 86 | public function createAndStore($to_store, $extension_file, $name_file) |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | parent::__construct(); |
| 41 | 41 | |
| 42 | - $this->db_functions=$db_functions; |
|
| 42 | + $this->db_functions = $db_functions; |
|
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $exchange_history = $this->db_functions->getAllDataFromExchangeHistory(); |
| 54 | 54 | |
| 55 | - for($i=0; $i<count($exchange_history); $i++) |
|
| 55 | + for ($i = 0; $i < count($exchange_history); $i++) |
|
| 56 | 56 | { |
| 57 | - $company_history = $exchange_history[$i]; |
|
| 57 | + $company_history = $exchange_history[ $i ]; |
|
| 58 | 58 | |
| 59 | 59 | $this->transformData($company_history); |
| 60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $this->createAndStore($company_history, "json", $name_file); |
| 74 | 74 | |
| 75 | - $company_history=json_encode($company_history); |
|
| 75 | + $company_history = json_encode($company_history); |
|
| 76 | 76 | |
| 77 | 77 | $formatter = Formatter::make($company_history, Formatter::JSON); |
| 78 | 78 | |
@@ -8,16 +8,16 @@ |
||
| 8 | 8 | public function transform($calcul) |
| 9 | 9 | { |
| 10 | 10 | return [ |
| 11 | - 'user_id' => $calcul['user_id'], |
|
| 12 | - 'name' => $calcul['name'], |
|
| 13 | - 'quantity_to_buy' =>(Float) $calcul['quantity_to_buy'], |
|
| 14 | - 'quote_to_buy' =>(Float) $calcul['quote_to_buy'], |
|
| 15 | - 'price_to_buy' => (Float)$calcul['price_to_buy'], |
|
| 16 | - 'quantity_to_sell' => (Float)$calcul['quantity_to_sell'], |
|
| 17 | - 'quote_to_sell' => (Float)$calcul['quote_to_sell'], |
|
| 18 | - 'tax_percent_to_discount' => (Float)$calcul['tax_percent_to_discount'], |
|
| 19 | - 'price_to_sell' => (Float)$calcul['price_to_sell'], |
|
| 20 | - 'gains_or_losses' => (Float)$calcul['gains_or_losses'], |
|
| 11 | + 'user_id' => $calcul[ 'user_id' ], |
|
| 12 | + 'name' => $calcul[ 'name' ], |
|
| 13 | + 'quantity_to_buy' =>(Float) $calcul[ 'quantity_to_buy' ], |
|
| 14 | + 'quote_to_buy' =>(Float) $calcul[ 'quote_to_buy' ], |
|
| 15 | + 'price_to_buy' => (Float) $calcul[ 'price_to_buy' ], |
|
| 16 | + 'quantity_to_sell' => (Float) $calcul[ 'quantity_to_sell' ], |
|
| 17 | + 'quote_to_sell' => (Float) $calcul[ 'quote_to_sell' ], |
|
| 18 | + 'tax_percent_to_discount' => (Float) $calcul[ 'tax_percent_to_discount' ], |
|
| 19 | + 'price_to_sell' => (Float) $calcul[ 'price_to_sell' ], |
|
| 20 | + 'gains_or_losses' => (Float) $calcul[ 'gains_or_losses' ], |
|
| 21 | 21 | ]; |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function transformCollection(array $items) |
| 8 | 8 | { |
| 9 | - return array_map([$this, 'transform'], $items); |
|
| 9 | + return array_map([ $this, 'transform' ], $items); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | abstract public function transform($item); |
@@ -80,5 +80,5 @@ |
||
| 80 | 80 | $apiKey = ApiKey::make($user->id); |
| 81 | 81 | $apiKey->save(); |
| 82 | 82 | return $apiKey->key; |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function __construct() |
| 40 | 40 | { |
| 41 | - $this->middleware($this->guestMiddleware(), ['except' => 'logout']); |
|
| 41 | + $this->middleware($this->guestMiddleware(), [ 'except' => 'logout' ]); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected function create(array $data) |
| 66 | 66 | { |
| 67 | - $user = User::create([ |
|
| 68 | - 'name' => $data['name'], |
|
| 69 | - 'email' => $data['email'], |
|
| 70 | - 'password' => bcrypt($data['password']), |
|
| 67 | + $user = User::create([ |
|
| 68 | + 'name' => $data[ 'name' ], |
|
| 69 | + 'email' => $data[ 'email' ], |
|
| 70 | + 'password' => bcrypt($data[ 'password' ]), |
|
| 71 | 71 | ]); |
| 72 | 72 | |
| 73 | 73 | $user->apiKey = $this->createUserApiKey($user); |
@@ -7,9 +7,7 @@ |
||
| 7 | 7 | use App\User; |
| 8 | 8 | use Chrisbjr\ApiGuard\Http\Controllers\ApiGuardController; |
| 9 | 9 | use Illuminate\Http\Request; |
| 10 | -use App\Http\Requests; |
|
| 11 | 10 | use Illuminate\Support\Facades\Auth; |
| 12 | -use Illuminate\Support\Facades\Input; |
|
| 13 | 11 | |
| 14 | 12 | /** |
| 15 | 13 | * Class CalculatorApiController |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param User $user |
| 50 | 50 | * @param SimulatorHistory $calculator |
| 51 | 51 | */ |
| 52 | - public function __construct(Alert $alert,CalculatorTransformer $calcul_transformer, User $user, SimulatorHistory $calculator) |
|
| 52 | + public function __construct(Alert $alert, CalculatorTransformer $calcul_transformer, User $user, SimulatorHistory $calculator) |
|
| 53 | 53 | { |
| 54 | 54 | parent::__construct(); |
| 55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->calcul_transformer = $calcul_transformer; |
| 58 | 58 | $this->user = $user; |
| 59 | 59 | $this->calculator = $calculator; |
| 60 | - $this->alert=$alert; |
|
| 60 | + $this->alert = $alert; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $router->group([ |
| 56 | 56 | 'namespace' => $this->namespace, 'middleware' => 'web', |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require app_path('Http/routes.php'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $router->group([ |
| 65 | 65 | 'namespace' => $this->namespace, |
| 66 | - ], function ($router) { |
|
| 66 | + ], function($router) { |
|
| 67 | 67 | require app_path('Http/routes-api.php'); |
| 68 | 68 | }); |
| 69 | 69 | } |
@@ -5,10 +5,7 @@ |
||
| 5 | 5 | use App\Console\AuxiliaryClasses\DataBaseFunctions; |
| 6 | 6 | use App\Console\AuxiliaryClasses\HttpCalls; |
| 7 | 7 | use App\Console\AuxiliaryClasses\ProgressControl; |
| 8 | -use App\InteractionMethodsMOD\GetMethods; |
|
| 9 | -use Carbon\Carbon; |
|
| 10 | 8 | use DB; |
| 11 | -use GuzzleHttp\Client; |
|
| 12 | 9 | use Illuminate\Console\Command; |
| 13 | 10 | use Symfony\Component\Config\Definition\Exception\Exception; |
| 14 | 11 | |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | * @param HttpCalls $http_calls |
| 54 | 54 | * @param ProgressControl $progress_control |
| 55 | 55 | */ |
| 56 | - public function __construct(DataBaseFunctions $db_functions,HttpCalls $http_calls,ProgressControl $progress_control) |
|
| 56 | + public function __construct(DataBaseFunctions $db_functions, HttpCalls $http_calls, ProgressControl $progress_control) |
|
| 57 | 57 | { |
| 58 | 58 | parent::__construct(); |
| 59 | 59 | |
| 60 | - $this->db_functions=$db_functions; |
|
| 61 | - $this->http_calls=$http_calls; |
|
| 62 | - $this->progress_control=$progress_control; |
|
| 60 | + $this->db_functions = $db_functions; |
|
| 61 | + $this->http_calls = $http_calls; |
|
| 62 | + $this->progress_control = $progress_control; |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -71,19 +71,19 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function handle() |
| 73 | 73 | { |
| 74 | - $table='exchange_history'; |
|
| 74 | + $table = 'exchange_history'; |
|
| 75 | 75 | |
| 76 | - $symbols=$this->db_functions->truncateBDValuesAndGetNew($table); |
|
| 76 | + $symbols = $this->db_functions->truncateBDValuesAndGetNew($table); |
|
| 77 | 77 | |
| 78 | - for($i=0; $i<count($symbols); $i++){ |
|
| 79 | - try{ |
|
| 78 | + for ($i = 0; $i < count($symbols); $i++) { |
|
| 79 | + try { |
|
| 80 | 80 | |
| 81 | - $symbol=$symbols[$i]->symbol; |
|
| 82 | - $data=$this->http_calls->getExchangeHistory($symbol); |
|
| 83 | - $this->db_functions->storeExchangeHistory($data,$table); |
|
| 81 | + $symbol = $symbols[ $i ]->symbol; |
|
| 82 | + $data = $this->http_calls->getExchangeHistory($symbol); |
|
| 83 | + $this->db_functions->storeExchangeHistory($data, $table); |
|
| 84 | 84 | $this->progress_control->progressControl($i); |
| 85 | 85 | |
| 86 | - }catch(Exception $e){ |
|
| 86 | + } catch (Exception $e) { |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | $this->db_functions->storeExchangeHistory($data,$table); |
| 84 | 84 | $this->progress_control->progressControl($i); |
| 85 | 85 | |
| 86 | - }catch(Exception $e){ |
|
| 86 | + } catch(Exception $e){ |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct(Client $client) |
| 24 | 24 | { |
| 25 | - $this->client=$client; |
|
| 25 | + $this->client = $client; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | $response = $this->client->get("http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input=".$to_search); |
| 35 | 35 | |
| 36 | - $response =json_decode($response->getBody()); |
|
| 36 | + $response = json_decode($response->getBody()); |
|
| 37 | 37 | |
| 38 | 38 | return $response; |
| 39 | 39 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $response = $this->client->get("http://dev.markitondemand.com/MODApis/Api/v2/Quote/json?symbol=".$company_symbol); |
| 48 | 48 | |
| 49 | - $response =json_decode($response->getBody()); |
|
| 49 | + $response = json_decode($response->getBody()); |
|
| 50 | 50 | |
| 51 | 51 | return $response; |
| 52 | 52 | } |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | * @param $company_symbol |
| 56 | 56 | * @return mixed|\Psr\Http\Message\ResponseInterface |
| 57 | 57 | */ |
| 58 | - public function interactiveChart ($company_symbol) |
|
| 58 | + public function interactiveChart($company_symbol) |
|
| 59 | 59 | { |
| 60 | - $request_params="%7B%22Normalized%22%3Afalse%2C%22NumberOfDays%22%3A730%2C%22DataPeriod%22%3A%22Month%22%2C%22Elements%22%3A%5B%7B%22Symbol%22%3A%22".$company_symbol."%22%2C%22Type%22%3A%22price%22%2C%22Params%22%3A%5B%22c%22%5D%7D%5D%7D"; |
|
| 60 | + $request_params = "%7B%22Normalized%22%3Afalse%2C%22NumberOfDays%22%3A730%2C%22DataPeriod%22%3A%22Month%22%2C%22Elements%22%3A%5B%7B%22Symbol%22%3A%22".$company_symbol."%22%2C%22Type%22%3A%22price%22%2C%22Params%22%3A%5B%22c%22%5D%7D%5D%7D"; |
|
| 61 | 61 | |
| 62 | 62 | $response = $this->client->get("http://dev.markitondemand.com/MODApis/Api/v2/InteractiveChart/json?parameters=".$request_params); |
| 63 | 63 | |
| 64 | - $response =json_decode($response->getBody()); |
|
| 64 | + $response = json_decode($response->getBody()); |
|
| 65 | 65 | |
| 66 | 66 | return $response; |
| 67 | 67 | } |