| @@ -328,6 +328,7 @@ | ||
| 328 | 328 | |
| 329 | 329 | /** | 
| 330 | 330 | * HTTP POST | 
| 331 | + * @param string $uri | |
| 331 | 332 | */ | 
| 332 | 333 |  	public function _post( $uri, $options = array() ) { | 
| 333 | 334 |  		return $this->_http($uri, $options + array('method' => 'POST')); | 
| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 | /** | 
| 28 | 28 | * Dependency constructor | 
| 29 | 29 | */ | 
| 30 | -	public function __construct( WebAuth $auth, InputConversion $input ) { | |
| 30 | +	public function __construct(WebAuth $auth, InputConversion $input) { | |
| 31 | 31 | $this->auth = $auth; | 
| 32 | 32 | $this->input = $input; | 
| 33 | 33 | } | 
| @@ -43,16 +43,16 @@ discard block | ||
| 43 | 43 | /** | 
| 44 | 44 | * | 
| 45 | 45 | */ | 
| 46 | -	public function getFuelUp( $id ) { | |
| 46 | +	public function getFuelUp($id) { | |
| 47 | 47 |  		$fuelup = compact('id'); | 
| 48 | 48 | |
| 49 | -		$response = $this->_get('fuelups/' . $id . '/edit'); | |
| 49 | +		$response = $this->_get('fuelups/'.$id.'/edit'); | |
| 50 | 50 | |
| 51 | 51 |  		preg_match_all('#<input[\s\S]+?name="([^"]+)"[\s\S]+?>#', $response->body, $matches, PREG_SET_ORDER); | 
| 52 | 52 |  		foreach ($matches as $match) { | 
| 53 | -			if ( in_array($match[1], array('_token', 'miles_last_fuelup', 'price_per_unit', 'amount', 'fuelup_date')) ) { | |
| 53 | +			if (in_array($match[1], array('_token', 'miles_last_fuelup', 'price_per_unit', 'amount', 'fuelup_date'))) { | |
| 54 | 54 |  				preg_match('#value="([^"]+)"#', $match[0], $match2); | 
| 55 | - $fuelup[ $match[1] ] = $match2[1]; | |
| 55 | + $fuelup[$match[1]] = $match2[1]; | |
| 56 | 56 | } | 
| 57 | 57 | } | 
| 58 | 58 | |
| @@ -65,17 +65,17 @@ discard block | ||
| 65 | 65 | /** | 
| 66 | 66 | * | 
| 67 | 67 | */ | 
| 68 | -	public function updateFuelUp( $id, $data ) { | |
| 68 | +	public function updateFuelUp($id, $data) { | |
| 69 | 69 | $data = $this->_validateFuelUpData($data); | 
| 70 | 70 | unset($data['id']); | 
| 71 | 71 | |
| 72 | -		if ( !isset($data['_token']) ) { | |
| 73 | -			$response = $this->_get('fuelups/' . $id . '/edit'); | |
| 72 | +		if (!isset($data['_token'])) { | |
| 73 | +			$response = $this->_get('fuelups/'.$id.'/edit'); | |
| 74 | 74 | $token = $this->extractFormToken($response->body); | 
| 75 | 75 | } | 
| 76 | 76 | |
| 77 | 77 | $data['_method'] = 'PUT'; | 
| 78 | -		$response = $this->_post('fuelups/' . $id, array( | |
| 78 | +		$response = $this->_post('fuelups/'.$id, array( | |
| 79 | 79 | 'data' => $data, | 
| 80 | 80 | )); | 
| 81 | 81 | return $response->code == 302; | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | /** | 
| 85 | 85 | * | 
| 86 | 86 | */ | 
| 87 | -	public function _validateFuelUpData( $data ) { | |
| 87 | +	public function _validateFuelUpData($data) { | |
| 88 | 88 | $data += array( | 
| 89 | 89 | 'errorlevel' => 2, | 
| 90 | 90 | 'price_per_unit' => '', | 
| @@ -101,8 +101,8 @@ discard block | ||
| 101 | 101 | |
| 102 | 102 |  		$required = array('usercar_id', 'miles_last_fuelup', 'amount'); | 
| 103 | 103 | $missing = array_diff($required, array_keys(array_filter($data))); | 
| 104 | -		if ( $missing ) { | |
| 105 | -			throw new InvalidArgumentException('Missing params: ' . implode(', ', $missing)); | |
| 104 | +		if ($missing) { | |
| 105 | +			throw new InvalidArgumentException('Missing params: '.implode(', ', $missing)); | |
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | 108 | return $data; | 
| @@ -111,19 +111,19 @@ discard block | ||
| 111 | 111 | /** | 
| 112 | 112 | * | 
| 113 | 113 | */ | 
| 114 | -	public function getFuelUpsWithIds( Vehicle $vehicle, $limit = 15 ) { | |
| 114 | +	public function getFuelUpsWithIds(Vehicle $vehicle, $limit = 15) { | |
| 115 | 115 | $query = http_build_query(array( | 
| 116 | 116 | 'iDisplayStart' => 0, | 
| 117 | 117 | 'iDisplayLength' => $limit, | 
| 118 | 118 | 'sSortDir_0' => 'desc', | 
| 119 | 119 | 'usercar_id' => $vehicle->id, | 
| 120 | 120 | )); | 
| 121 | -		$response = $this->_get('ajax/fuelup-log?' . $query); | |
| 122 | -		if ( $response->code == 200 ) { | |
| 123 | -			if ( $response->response ) { | |
| 121 | +		$response = $this->_get('ajax/fuelup-log?'.$query); | |
| 122 | +		if ($response->code == 200) { | |
| 123 | +			if ($response->response) { | |
| 124 | 124 | $fuelups = array(); | 
| 125 | -				foreach ( $response->response['aaData'] as $fuelup ) { | |
| 126 | -					if ( preg_match('#fuelups/(\d+)/edit#', $fuelup[0], $match) ) { | |
| 125 | +				foreach ($response->response['aaData'] as $fuelup) { | |
| 126 | +					if (preg_match('#fuelups/(\d+)/edit#', $fuelup[0], $match)) { | |
| 127 | 127 | $fuelup = array( | 
| 128 | 128 | 'id' => $match[1], | 
| 129 | 129 | 'usercar_id' => $vehicle->id, | 
| @@ -132,7 +132,7 @@ discard block | ||
| 132 | 132 | 'amount' => $fuelup[4][0], | 
| 133 | 133 | ); | 
| 134 | 134 | |
| 135 | - $fuelups[ $fuelup['id'] ] = FuelUp::createFromDetail($vehicle, $fuelup); | |
| 135 | + $fuelups[$fuelup['id']] = FuelUp::createFromDetail($vehicle, $fuelup); | |
| 136 | 136 | } | 
| 137 | 137 | } | 
| 138 | 138 | |
| @@ -149,21 +149,21 @@ discard block | ||
| 149 | 149 | /** | 
| 150 | 150 | * | 
| 151 | 151 | */ | 
| 152 | -	public function getAllFuelups( Vehicle $vehicle ) { | |
| 153 | -		$response = $this->_get('car/make/model/2001/username/' . $vehicle->id . '/export'); | |
| 154 | -		if ( $token = $this->extractFormToken($response->body) ) { | |
| 152 | +	public function getAllFuelups(Vehicle $vehicle) { | |
| 153 | +		$response = $this->_get('car/make/model/2001/username/'.$vehicle->id.'/export'); | |
| 154 | +		if ($token = $this->extractFormToken($response->body)) { | |
| 155 | 155 |  			$response = $this->_post('exportfuelups', array( | 
| 156 | 156 | 'data' => array( | 
| 157 | 157 | '_token' => $token, | 
| 158 | 158 | 'usercar_id' => $vehicle->id, | 
| 159 | 159 | ), | 
| 160 | 160 | )); | 
| 161 | -			if ( $response->code == 200 ) { | |
| 161 | +			if ($response->code == 200) { | |
| 162 | 162 |  				$lines = array_filter(preg_split('#[\r\n]+#', $response->body)); | 
| 163 | 163 | $header = $rows = array(); | 
| 164 | 164 |  				foreach ($lines as $line) { | 
| 165 | 165 |  					$row = array_map('trim', str_getcsv($line)); | 
| 166 | -					if ( !$header ) { | |
| 166 | +					if (!$header) { | |
| 167 | 167 | $header = $row; | 
| 168 | 168 | } | 
| 169 | 169 |  					else { | 
| @@ -179,26 +179,26 @@ discard block | ||
| 179 | 179 | /** | 
| 180 | 180 | * | 
| 181 | 181 | */ | 
| 182 | -	public function addFuelUp( $data ) { | |
| 182 | +	public function addFuelUp($data) { | |
| 183 | 183 | $data = $this->_validateFuelUpData($data); | 
| 184 | 184 | |
| 185 | 185 | // GET /fuelups/create | 
| 186 | 186 |  		$response = $this->_get('fuelups/create'); | 
| 187 | 187 | |
| 188 | -		if ( $token = $this->extractFormToken($response->body) ) { | |
| 188 | +		if ($token = $this->extractFormToken($response->body)) { | |
| 189 | 189 | $data['_token'] = $token; | 
| 190 | 190 | |
| 191 | 191 | // POST /fuelups/create | 
| 192 | 192 |  			$response = $this->_post('fuelups', array( | 
| 193 | 193 | 'data' => $data, | 
| 194 | 194 | )); | 
| 195 | -			if ( $response->code == 302 ) { | |
| 195 | +			if ($response->code == 302) { | |
| 196 | 196 | $response = $this->_get($response->headers['location'][0]); | 
| 197 | 197 | |
| 198 | 198 | // Take new fuelup ID from response and add it | 
| 199 | -				if ( $response->code == 200 ) { | |
| 200 | - $regex = '#' . preg_quote($this->base, '#') . 'fuelups/(\d+)/edit#'; | |
| 201 | -					if ( preg_match($regex, $response->body, $match) ) { | |
| 199 | +				if ($response->code == 200) { | |
| 200 | + $regex = '#'.preg_quote($this->base, '#').'fuelups/(\d+)/edit#'; | |
| 201 | +					if (preg_match($regex, $response->body, $match)) { | |
| 202 | 202 | $response->fuelup_id = $match[1]; | 
| 203 | 203 | } | 
| 204 | 204 | } | 
| @@ -211,7 +211,7 @@ discard block | ||
| 211 | 211 | /** | 
| 212 | 212 | * | 
| 213 | 213 | */ | 
| 214 | -	public function getVehicle( $id ) { | |
| 214 | +	public function getVehicle($id) { | |
| 215 | 215 | $vehicles = $this->getVehicles(); | 
| 216 | 216 | return @$vehicles[$id]; | 
| 217 | 217 | } | 
| @@ -227,11 +227,11 @@ discard block | ||
| 227 | 227 | /** | 
| 228 | 228 | * | 
| 229 | 229 | */ | 
| 230 | -	protected function extractVehicles( $html ) { | |
| 230 | +	protected function extractVehicles($html) { | |
| 231 | 231 | $regex = '#<ul class="dashboard-vehicle" data-clickable="([^"]+)">[\w\W]+?</ul>#'; | 
| 232 | 232 | $vehicles = array(); | 
| 233 | -		if ( preg_match_all($regex, $html, $matches) ) { | |
| 234 | -			foreach ( $matches[0] as $i => $html ) { | |
| 233 | +		if (preg_match_all($regex, $html, $matches)) { | |
| 234 | +			foreach ($matches[0] as $i => $html) { | |
| 235 | 235 | $url = $matches[1][$i]; | 
| 236 | 236 | |
| 237 | 237 |  				preg_match('#/(\d+)$#', $url, $match); | 
| @@ -241,7 +241,7 @@ discard block | ||
| 241 | 241 | $name = htmlspecialchars_decode($match[1]); | 
| 242 | 242 | |
| 243 | 243 |  				preg_match("#:\s*url\('/([^']+)'\)#", $html, $match); | 
| 244 | - $image = $this->base . $match[1]; | |
| 244 | + $image = $this->base.$match[1]; | |
| 245 | 245 | |
| 246 | 246 |  				preg_match("#data-trend='([^']+)'#", $html, $match); | 
| 247 | 247 | $trend = @json_decode($match[1], true) ?: false; | 
| @@ -257,14 +257,14 @@ discard block | ||
| 257 | 257 | * | 
| 258 | 258 | */ | 
| 259 | 259 |  	public function logIn() { | 
| 260 | -		if ( !$this->auth->mail || !$this->auth->pass ) { | |
| 260 | +		if (!$this->auth->mail || !$this->auth->pass) { | |
| 261 | 261 | return false; | 
| 262 | 262 | } | 
| 263 | 263 | |
| 264 | 264 | // GET /login | 
| 265 | 265 |  		$response = $this->_get('login', array('login' => true)); | 
| 266 | 266 | |
| 267 | -		if ( $token = $this->extractFormToken($response->body) ) { | |
| 267 | +		if ($token = $this->extractFormToken($response->body)) { | |
| 268 | 268 | // POST /login | 
| 269 | 269 |  			$response = $this->_post('login', array( | 
| 270 | 270 | 'login' => true, | 
| @@ -286,14 +286,14 @@ discard block | ||
| 286 | 286 | * | 
| 287 | 287 | */ | 
| 288 | 288 |  	public function checkSession() { | 
| 289 | -		if ( !$this->auth->session ) { | |
| 289 | +		if (!$this->auth->session) { | |
| 290 | 290 | return false; | 
| 291 | 291 | } | 
| 292 | 292 | |
| 293 | 293 |  		$response = $this->_get('dashboard'); | 
| 294 | -		if ( $response->code == 200 ) { | |
| 295 | - $regex = '#<a href="' . preg_quote($this->base, '#') . 'driver/([\w\d]+)/edit">Settings</a>#'; | |
| 296 | -			if ( preg_match($regex, $response->body, $match) ) { | |
| 294 | +		if ($response->code == 200) { | |
| 295 | + $regex = '#<a href="'.preg_quote($this->base, '#').'driver/([\w\d]+)/edit">Settings</a>#'; | |
| 296 | +			if (preg_match($regex, $response->body, $match)) { | |
| 297 | 297 | $this->username = $match[1]; | 
| 298 | 298 | |
| 299 | 299 | // Since we're downloading /dashboard anyway, let's extract our vehicles from it | 
| @@ -310,7 +310,7 @@ discard block | ||
| 310 | 310 | * | 
| 311 | 311 | */ | 
| 312 | 312 |  	public function ensureSession() { | 
| 313 | -		if ( !$this->checkSession() ) { | |
| 313 | +		if (!$this->checkSession()) { | |
| 314 | 314 | return $this->logIn(); | 
| 315 | 315 | } | 
| 316 | 316 | |
| @@ -320,9 +320,9 @@ discard block | ||
| 320 | 320 | /** | 
| 321 | 321 | * | 
| 322 | 322 | */ | 
| 323 | -	protected function extractFormToken( $html ) { | |
| 324 | -		if ( preg_match('#<input.+?name="_token".+?>#i', $html, $match) ) { | |
| 325 | -			if ( preg_match('#value="([^"]+)"#', $match[0], $match) ) { | |
| 323 | +	protected function extractFormToken($html) { | |
| 324 | +		if (preg_match('#<input.+?name="_token".+?>#i', $html, $match)) { | |
| 325 | +			if (preg_match('#value="([^"]+)"#', $match[0], $match)) { | |
| 326 | 326 | return $match[1]; | 
| 327 | 327 | } | 
| 328 | 328 | } | 
| @@ -333,37 +333,37 @@ discard block | ||
| 333 | 333 | /** | 
| 334 | 334 | * HTTP GET | 
| 335 | 335 | */ | 
| 336 | -	public function _get( $uri, $options = array() ) { | |
| 336 | +	public function _get($uri, $options = array()) { | |
| 337 | 337 |  		return $this->_http($uri, $options + array('method' => 'GET')); | 
| 338 | 338 | } | 
| 339 | 339 | |
| 340 | 340 | /** | 
| 341 | 341 | * HTTP POST | 
| 342 | 342 | */ | 
| 343 | -	public function _post( $uri, $options = array() ) { | |
| 343 | +	public function _post($uri, $options = array()) { | |
| 344 | 344 |  		return $this->_http($uri, $options + array('method' => 'POST')); | 
| 345 | 345 | } | 
| 346 | 346 | |
| 347 | 347 | /** | 
| 348 | 348 | * HTTP URL | 
| 349 | 349 | */ | 
| 350 | -	public function _url( $uri, $options = array() ) { | |
| 350 | +	public function _url($uri, $options = array()) { | |
| 351 | 351 | $base = !empty($options['login']) ? $this->loginBase : $this->base; | 
| 352 | - $url = strpos($uri, '://') ? $uri : $base . $uri; | |
| 352 | + $url = strpos($uri, '://') ? $uri : $base.$uri; | |
| 353 | 353 | return $url; | 
| 354 | 354 | } | 
| 355 | 355 | |
| 356 | 356 | /** | 
| 357 | 357 | * HTTP REQUEST | 
| 358 | 358 | */ | 
| 359 | -	public function _http( $uri, $options = array() ) { | |
| 359 | +	public function _http($uri, $options = array()) { | |
| 360 | 360 |  		if ($this->auth->session) { | 
| 361 | 361 |  			$options['cookies'][] = array('fuelly_session', $this->auth->session); | 
| 362 | 362 | } | 
| 363 | 363 | |
| 364 | 364 | $url = $this->_url($uri, $options); | 
| 365 | 365 | |
| 366 | - $log['req'] = $options['method'] . ' ' . $url; | |
| 366 | + $log['req'] = $options['method'].' '.$url; | |
| 367 | 367 | $this->log[] = &$log; | 
| 368 | 368 | |
| 369 | 369 | $_start = microtime(1); | 
| @@ -372,7 +372,7 @@ discard block | ||
| 372 | 372 | $response = $request->request(); | 
| 373 | 373 | $_time = microtime(1) - $_start; | 
| 374 | 374 | |
| 375 | - $log['rsp'] = $response->code . ' ' . $response->status; | |
| 375 | + $log['rsp'] = $response->code.' '.$response->status; | |
| 376 | 376 | $log['time'] = $_time; | 
| 377 | 377 | |
| 378 | 378 | return $response; | 
| @@ -11,7 +11,7 @@ | ||
| 11 | 11 | /** | 
| 12 | 12 | * Dependency constructor | 
| 13 | 13 | */ | 
| 14 | -	public function __construct( $mail, $pass, $session = '' ) { | |
| 14 | +	public function __construct($mail, $pass, $session = '') { | |
| 15 | 15 | $this->mail = $mail; | 
| 16 | 16 | $this->pass = $pass; | 
| 17 | 17 | $this->session = $session; | 
| @@ -17,4 +17,4 @@ | ||
| 17 | 17 | echo "\n\n"; | 
| 18 | 18 | |
| 19 | 19 | echo "\n\n"; | 
| 20 | -echo "To save this session, go to\n\n" . basename(__FILE__) . '?session=' . $client->auth->session; | |
| 20 | +echo "To save this session, go to\n\n".basename(__FILE__).'?session='.$client->auth->session; | |
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -require __DIR__ . '/env.php'; | |
| 3 | +require __DIR__.'/env.php'; | |
| 4 | 4 | |
| 5 | -require __DIR__ . '/vendor/autoload.php'; | |
| 5 | +require __DIR__.'/vendor/autoload.php'; | |
| 6 | 6 | |
| 7 | 7 |  header('Content-type: text/plain; charset=utf-8'); | 
| 8 | 8 | |
| @@ -5,11 +5,11 @@ discard block | ||
| 5 | 5 | $client = getTestClient(FUELLY_TEST_MAIL, FUELLY_TEST_PASS, @$_GET['session']); | 
| 6 | 6 | |
| 7 | 7 | $client->ensureSession(); | 
| 8 | -echo $client->auth->session . "\n\n\n"; | |
| 8 | +echo $client->auth->session."\n\n\n"; | |
| 9 | 9 | |
| 10 | 10 | echo "Vehicle:\n"; | 
| 11 | 11 | $vehicles = $client->vehicles; | 
| 12 | -$vehicle = $vehicles[ array_rand($vehicles) ]; | |
| 12 | +$vehicle = $vehicles[array_rand($vehicles)]; | |
| 13 | 13 | print_r($vehicle); | 
| 14 | 14 | echo "\n\n"; | 
| 15 | 15 | |
| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 | 'amount' => 10, | 
| 21 | 21 | 'note' => 'TEST TEST TEST', | 
| 22 | 22 | )); | 
| 23 | -if ( !empty($response->fuelup_id) ) { | |
| 23 | +if (!empty($response->fuelup_id)) { | |
| 24 | 24 | var_dump($response->fuelup_id); | 
| 25 | 25 | } | 
| 26 | 26 |  else { | 
| @@ -5,11 +5,11 @@ | ||
| 5 | 5 | $client = getTestClient(FUELLY_TEST_MAIL, FUELLY_TEST_PASS, @$_GET['session']); | 
| 6 | 6 | |
| 7 | 7 | $client->ensureSession(); | 
| 8 | -echo $client->auth->session . "\n\n\n"; | |
| 8 | +echo $client->auth->session."\n\n\n"; | |
| 9 | 9 | |
| 10 | 10 | echo "Vehicle:\n"; | 
| 11 | 11 | $vehicles = $client->vehicles; | 
| 12 | -$vehicle = $vehicles[ array_rand($vehicles) ]; | |
| 12 | +$vehicle = $vehicles[array_rand($vehicles)]; | |
| 13 | 13 | print_r($vehicle); | 
| 14 | 14 | echo "\n\n"; | 
| 15 | 15 | |
| @@ -5,11 +5,11 @@ | ||
| 5 | 5 | $client = getTestClient(FUELLY_TEST_MAIL, FUELLY_TEST_PASS, @$_GET['session']); | 
| 6 | 6 | |
| 7 | 7 | $client->ensureSession(); | 
| 8 | -echo $client->auth->session . "\n\n\n"; | |
| 8 | +echo $client->auth->session."\n\n\n"; | |
| 9 | 9 | |
| 10 | 10 | echo "Vehicle:\n"; | 
| 11 | 11 | $vehicles = $client->vehicles; | 
| 12 | -$vehicle = $vehicles[ array_rand($vehicles) ]; | |
| 12 | +$vehicle = $vehicles[array_rand($vehicles)]; | |
| 13 | 13 | print_r($vehicle); | 
| 14 | 14 | echo "\n\n"; | 
| 15 | 15 | |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | $client = getTestClient(FUELLY_TEST_MAIL, FUELLY_TEST_PASS, @$_GET['session']); | 
| 6 | 6 | |
| 7 | 7 | $client->ensureSession(); | 
| 8 | -echo $client->auth->session . "\n\n\n"; | |
| 8 | +echo $client->auth->session."\n\n\n"; | |
| 9 | 9 | |
| 10 | 10 | echo "Vehicles:\n"; | 
| 11 | 11 | $vehicles = $client->vehicles; | 
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | /** | 
| 18 | 18 | * | 
| 19 | 19 | */ | 
| 20 | -	public static function createFromTrend( Vehicle $vehicle, array $fuelup, InputConversion $input = null ) { | |
| 20 | +	public static function createFromTrend(Vehicle $vehicle, array $fuelup, InputConversion $input = null) { | |
| 21 | 21 | // Trend is always in real numbers, and only its natives are reliable so use those | 
| 22 | 22 | $input or $input = $client->createTrendInputConversion(); | 
| 23 | 23 | |
| @@ -29,7 +29,7 @@ discard block | ||
| 29 | 29 | /** | 
| 30 | 30 | * | 
| 31 | 31 | */ | 
| 32 | -	public static function createFromDetail( Vehicle $vehicle, array $fuelup, InputConversion $input = null ) { | |
| 32 | +	public static function createFromDetail(Vehicle $vehicle, array $fuelup, InputConversion $input = null) { | |
| 33 | 33 | // @todo Parse date correctly | 
| 34 | 34 |  		$date = DateTime::createFromFormat('d-m-y', $fuelup['fuelup_date']); | 
| 35 | 35 | return new static($vehicle, $date, $fuelup['miles_last_fuelup'], $fuelup['amount']); | 
| @@ -38,7 +38,7 @@ discard block | ||
| 38 | 38 | /** | 
| 39 | 39 | * | 
| 40 | 40 | */ | 
| 41 | -	protected function __construct( Vehicle $vehicle, DateTime $date, $raw_distance, $raw_amount, InputConversion $input = null ) { | |
| 41 | +	protected function __construct(Vehicle $vehicle, DateTime $date, $raw_distance, $raw_amount, InputConversion $input = null) { | |
| 42 | 42 | $this->vehicle = $vehicle; | 
| 43 | 43 | |
| 44 | 44 | $input or $input = $vehicle->client->input; | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | /** | 
| 60 | 60 | * | 
| 61 | 61 | */ | 
| 62 | -	public static function createMileage( Length $distance, Volume $amount ) { | |
| 62 | +	public static function createMileage(Length $distance, Volume $amount) { | |
| 63 | 63 | // Since we don't know the original mileage from here, we'll construct a known unit from known values | 
| 64 | 64 |  		return new Mileage($distance->to('km') / $amount->to('l'), 'kmpl'); | 
| 65 | 65 | } | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | /** | 
| 68 | 68 | * | 
| 69 | 69 | */ | 
| 70 | -	public static function dateCmp( FuelUp $a, FuelUp $b ) { | |
| 70 | +	public static function dateCmp(FuelUp $a, FuelUp $b) { | |
| 71 | 71 | return $b->date->getTimestamp() - $a->date->getTimestamp(); | 
| 72 | 72 | } | 
| 73 | 73 | |