Skip to content

Commit 72585de

Browse files
committed
space edit
1 parent faa57db commit 72585de

11 files changed

+664
-665
lines changed

Controller/WeatherController.php

+26-26
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@
88

99
class WeatherController extends Controller
1010
{
11-
/**
12-
* Downloads Weather List of City as CSV
13-
*
14-
* @param mixed (integer|string) $city
15-
* @param integer $days
16-
*/
17-
public function generateCsvAction($city, $days){
18-
19-
if($this->getParameter('pianosolo.weather.options.download_csv') === TRUE){
20-
21-
$weatherHandler = $this->get('pianosolo.weather');
22-
$weathers = $weatherHandler->getForecastObject($city, $days);
23-
24-
if(!empty($weathers)){
25-
26-
// Creating CSV Response
27-
$csvResponse = new WeatherCsvResponse($weathers, $city);
28-
return $csvResponse->createCsvResponse();
29-
30-
}else{
31-
throw $this->createNotFoundException('City Not Found!');
32-
}
33-
}else{
34-
throw $this->createNotFoundException('Page Not Found!');
35-
}
36-
}
11+
/**
12+
* Downloads Weather List of City as CSV
13+
*
14+
* @param mixed (integer|string) $city
15+
* @param integer $days
16+
*/
17+
public function generateCsvAction($city, $days){
18+
19+
if($this->getParameter('pianosolo.weather.options.download_csv') === TRUE){
20+
21+
$weatherHandler = $this->get('pianosolo.weather');
22+
$weathers = $weatherHandler->getForecastObject($city, $days);
23+
24+
if(!empty($weathers)){
25+
26+
// Creating CSV Response
27+
$csvResponse = new WeatherCsvResponse($weathers, $city);
28+
return $csvResponse->createCsvResponse();
29+
30+
}else{
31+
throw $this->createNotFoundException('City Not Found!');
32+
}
33+
}else{
34+
throw $this->createNotFoundException('Page Not Found!');
35+
}
36+
}
3737
}

DependencyInjection/Configuration.php

+21-22
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,27 @@
1010
*/
1111
class Configuration implements ConfigurationInterface
1212
{
13-
/**
14-
* {@inheritdoc}
15-
*/
16-
public function getConfigTreeBuilder()
17-
{
18-
$treeBuilder = new TreeBuilder();
19-
$rootNode = $treeBuilder->root('pianosolo_weather');
13+
/**
14+
* {@inheritdoc}
15+
*/
16+
public function getConfigTreeBuilder()
17+
{
18+
$treeBuilder = new TreeBuilder();
19+
$rootNode = $treeBuilder->root('pianosolo_weather');
2020

21-
$rootNode
22-
->children()
23-
->scalarNode('api_key')->isRequired()->cannotBeEmpty()->end()
24-
->arrayNode('options')
25-
->addDefaultsIfNotSet()
26-
->children()
27-
->scalarNode('download_csv')->defaultTrue()->end()
28-
->scalarNode('cache')->defaultFalse()->end()
29-
->end()
30-
->end()
31-
->end()
32-
;
21+
$rootNode
22+
->children()
23+
->scalarNode('api_key')->isRequired()->cannotBeEmpty()->end()
24+
->arrayNode('options')
25+
->addDefaultsIfNotSet()
26+
->children()
27+
->scalarNode('download_csv')->defaultTrue()->end()
28+
->scalarNode('cache')->defaultFalse()->end()
29+
->end()
30+
->end()
31+
->end()
32+
;
3333

34-
35-
return $treeBuilder;
36-
}
34+
return $treeBuilder;
35+
}
3736
}

DependencyInjection/PianoSoloWeatherExtension.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
*/
1313
class PianoSoloWeatherExtension extends Extension
1414
{
15-
/**
16-
* {@inheritdoc}
17-
*/
18-
public function load(array $configs, ContainerBuilder $container)
19-
{
20-
$configuration = new Configuration();
21-
$config = $this->processConfiguration($configuration, $configs);
15+
/**
16+
* {@inheritdoc}
17+
*/
18+
public function load(array $configs, ContainerBuilder $container)
19+
{
20+
$configuration = new Configuration();
21+
$config = $this->processConfiguration($configuration, $configs);
2222

23-
$container->setParameter('pianosolo.weather.api_key', $config['api_key']);
24-
$container->setParameter('pianosolo.weather.options.download_csv', $config['options']['download_csv']);
25-
$container->setParameter('pianosolo.weather.options.cache', $config['options']['cache']);
23+
$container->setParameter('pianosolo.weather.api_key', $config['api_key']);
24+
$container->setParameter('pianosolo.weather.options.download_csv', $config['options']['download_csv']);
25+
$container->setParameter('pianosolo.weather.options.cache', $config['options']['cache']);
2626

27-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
28-
$loader->load('services.yml');
29-
}
27+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
28+
$loader->load('services.yml');
29+
}
3030
}

Entity/Weather.php

+107-107
Original file line numberDiff line numberDiff line change
@@ -9,111 +9,111 @@
99
*/
1010
class Weather
1111
{
12-
/**
13-
* @var string
14-
*/
15-
private $city;
16-
17-
/**
18-
* @var \DateTime
19-
*/
20-
private $wdate;
21-
22-
/**
23-
* @var int
24-
*/
25-
private $temperature;
26-
27-
/**
28-
* @var string
29-
*/
30-
private $description;
31-
32-
/**
33-
* Set City
34-
*
35-
* @param string $city
36-
* @return Weather
37-
*/
38-
public function setCity($city)
39-
{
40-
$this->city = $city;
41-
return $this;
42-
}
43-
44-
/**
45-
* Get City
46-
*
47-
* @return string $city
48-
*/
49-
public function getCity()
50-
{
51-
return $this->city;
52-
}
53-
54-
/**
55-
* Set Weather date
56-
*
57-
* @param \DateTime $wdate
58-
* @return Weather
59-
*/
60-
public function setWdate($wdate)
61-
{
62-
$this->wdate = $wdate;
63-
return $this;
64-
}
65-
66-
/**
67-
* Get Weather date
68-
*
69-
* @return \DateTime $wdate
70-
*/
71-
public function getWdate()
72-
{
73-
return $this->wdate;
74-
}
75-
76-
/**
77-
* Set Temperature
78-
*
79-
* @param int $temperature
80-
* @return Weather
81-
*/
82-
public function setTemperature($temperature)
83-
{
84-
$this->temperature = $temperature;
85-
return $this;
86-
}
87-
88-
/**
89-
* Get Temperature
90-
*
91-
* @return int $temperature
92-
*/
93-
public function getTemperature()
94-
{
95-
return $this->temperature;
96-
}
97-
98-
/**
99-
* Set Description
100-
*
101-
* @param string $description
102-
* @return Weather
103-
*/
104-
public function setDescription($description)
105-
{
106-
$this->description = $description;
107-
return $this;
108-
}
109-
110-
/**
111-
* Get Description
112-
*
113-
* @return string $description
114-
*/
115-
public function getDescription()
116-
{
117-
return $this->description;
118-
}
12+
/**
13+
* @var string
14+
*/
15+
private $city;
16+
17+
/**
18+
* @var \DateTime
19+
*/
20+
private $wdate;
21+
22+
/**
23+
* @var int
24+
*/
25+
private $temperature;
26+
27+
/**
28+
* @var string
29+
*/
30+
private $description;
31+
32+
/**
33+
* Set City
34+
*
35+
* @param string $city
36+
* @return Weather
37+
*/
38+
public function setCity($city)
39+
{
40+
$this->city = $city;
41+
return $this;
42+
}
43+
44+
/**
45+
* Get City
46+
*
47+
* @return string $city
48+
*/
49+
public function getCity()
50+
{
51+
return $this->city;
52+
}
53+
54+
/**
55+
* Set Weather date
56+
*
57+
* @param \DateTime $wdate
58+
* @return Weather
59+
*/
60+
public function setWdate($wdate)
61+
{
62+
$this->wdate = $wdate;
63+
return $this;
64+
}
65+
66+
/**
67+
* Get Weather date
68+
*
69+
* @return \DateTime $wdate
70+
*/
71+
public function getWdate()
72+
{
73+
return $this->wdate;
74+
}
75+
76+
/**
77+
* Set Temperature
78+
*
79+
* @param int $temperature
80+
* @return Weather
81+
*/
82+
public function setTemperature($temperature)
83+
{
84+
$this->temperature = $temperature;
85+
return $this;
86+
}
87+
88+
/**
89+
* Get Temperature
90+
*
91+
* @return int $temperature
92+
*/
93+
public function getTemperature()
94+
{
95+
return $this->temperature;
96+
}
97+
98+
/**
99+
* Set Description
100+
*
101+
* @param string $description
102+
* @return Weather
103+
*/
104+
public function setDescription($description)
105+
{
106+
$this->description = $description;
107+
return $this;
108+
}
109+
110+
/**
111+
* Get Description
112+
*
113+
* @return string $description
114+
*/
115+
public function getDescription()
116+
{
117+
return $this->description;
118+
}
119119
}

0 commit comments

Comments
 (0)