Skip to content

Commit f107795

Browse files
committed
Formatting / Code Smells
1 parent 130322f commit f107795

File tree

6 files changed

+22
-20
lines changed

6 files changed

+22
-20
lines changed

src/Drivers/CurrencyDriverContract.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@ interface CurrencyDriverContract
1515
*
1616
* @return self
1717
*/
18-
function source(string $baseCurrency): CurrencyDriverContract;
19-
function from(string $baseCurrency): CurrencyDriverContract; // Alias
18+
public function source(string $baseCurrency): CurrencyDriverContract;
19+
public function from(string $baseCurrency): CurrencyDriverContract; // Alias
2020

2121
/**
2222
* @param string|array $symbols
2323
*
2424
* @return self
2525
*/
26-
function currencies($symbols = []): CurrencyDriverContract;
27-
function to($symbols = []): CurrencyDriverContract; // Alias
26+
public function currencies($symbols = []): CurrencyDriverContract;
27+
public function to($symbols = []): CurrencyDriverContract; // Alias
2828

2929
/**
3030
* @param double|integer|float $amount
3131
*
3232
* @return self
3333
*/
34-
function amount($amount): CurrencyDriverContract;
34+
public function amount($amount): CurrencyDriverContract;
3535

3636
/**
3737
* @param int|string|DateTime $date
3838
*
3939
* @return self
4040
*/
41-
function date($date): CurrencyDriverContract;
41+
public function date($date): CurrencyDriverContract;
4242

4343
/**
4444
* Returns the date in 'YYYY-mm-dd' format or null if not set.
@@ -50,14 +50,14 @@ public function getDate(): ?string;
5050
/**
5151
* @return array
5252
*/
53-
function getSymbols(): array;
53+
public function getSymbols(): array;
5454

5555
/**
5656
* @param string|array $forCurrency
5757
*
5858
* @return ConversionResult
5959
*/
60-
function get($forCurrency = []): ConversionResult;
60+
public function get($forCurrency = []): ConversionResult;
6161

6262
/**
6363
* Converts any amount in a given currency to another currency.
@@ -77,12 +77,12 @@ public function convert(float $amount = null, string $fromCurrency = null, strin
7777
*
7878
* @return ConversionResult
7979
*/
80-
function historical($date = null, $forCurrency = []): ConversionResult;
80+
public function historical($date = null, $forCurrency = []): ConversionResult;
8181

8282
/**
8383
* @return string
8484
*/
85-
function getBaseCurrency(): string;
85+
public function getBaseCurrency(): string;
8686

8787
/**
8888
* Set a config parameter.
@@ -92,7 +92,7 @@ function getBaseCurrency(): string;
9292
*
9393
* @return self
9494
*/
95-
function config(string $key, string $value): CurrencyDriverContract;
95+
public function config(string $key, string $value): CurrencyDriverContract;
9696

9797
/**
9898
* Sets the API key to use.
@@ -105,7 +105,7 @@ function config(string $key, string $value): CurrencyDriverContract;
105105
* @see CurrencyDriverContract::config()
106106
*
107107
*/
108-
function accessKey(string $accessKey): CurrencyDriverContract;
108+
public function accessKey(string $accessKey): CurrencyDriverContract;
109109

110110
/**
111111
* Secures all HTTP requests by switching to HTTPS.
@@ -114,14 +114,14 @@ function accessKey(string $accessKey): CurrencyDriverContract;
114114
*
115115
* @return self
116116
*/
117-
function secure(): CurrencyDriverContract;
117+
public function secure(): CurrencyDriverContract;
118118

119119
/**
120120
* Returns the protocol that is currently being used.
121121
*
122122
* @return string
123123
*/
124-
function getProtocol(): string;
124+
public function getProtocol(): string;
125125

126126
/**
127127
* Performs an HTTP request.
@@ -132,5 +132,5 @@ function getProtocol(): string;
132132
*
133133
* @return array|bool The response as decoded JSON.
134134
*/
135-
function apiRequest(string $endpoint, array $params = [], string $method = 'GET');
135+
public function apiRequest(string $endpoint, array $params = [], string $method = 'GET');
136136
}

src/Drivers/CurrencyLayer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function historical($date = null, $forCurrency = []): ConversionResult
6868
$this->currencies((array)$forCurrency);
6969
}
7070

71-
if(null === $this->getDate() ) {
71+
if (null === $this->getDate()) {
7272
throw new ApiException('Date needs to be set!');
7373
}
7474

src/Drivers/FixerIo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function historical($date = null, $forCurrency = []): ConversionResult
5959
$this->currencies((array)$forCurrency);
6060
}
6161

62-
if(null === $this->getDate() ) {
62+
if (null === $this->getDate()) {
6363
throw new ApiException('Date needs to be set!');
6464
}
6565

@@ -108,7 +108,7 @@ public function convert(float $amount = null, string $fromCurrency = null, strin
108108
'amount' => $this->amount,
109109
];
110110

111-
if(null !== $this->getDate()) {
111+
if (null !== $this->getDate()) {
112112
$params['date'] = $this->getDate();
113113
}
114114

src/Drivers/MockCurrencyDriver.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php namespace Otherguy\Currency\Drivers;
22

33
use DateTime;
4+
use Exception;
45
use Otherguy\Currency\Results\ConversionResult;
56

67
/**
@@ -16,6 +17,8 @@ class MockCurrencyDriver extends BaseCurrencyDriver implements CurrencyDriverCon
1617
* @param string|array $forCurrency
1718
*
1819
* @return ConversionResult
20+
*
21+
* @throws Exception
1922
*/
2023
function get($forCurrency = []): ConversionResult
2124
{

src/Helpers/DateHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DateHelper
2323
*/
2424
public static function parse(string $string, string $format): DateTime
2525
{
26-
return DateTime::createFromFormat($format, $string);
26+
return new DateTime::createFromFormat($format, $string);
2727
}
2828

2929
/**

src/Results/ConversionResult.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public function __construct(string $baseCurrency, $date, array $rates)
4242
$this->conversionRates = $rates;
4343
}
4444

45-
4645
/**
4746
* Get base currency.
4847
*

0 commit comments

Comments
 (0)