10
10
use Magento \Framework \App \Config \ScopeConfigInterface ;
11
11
use Magento \Store \Model \ScopeInterface ;
12
12
13
- class Snowflake
13
+ /**
14
+ * @api
15
+ */
16
+ final class Snowflake
14
17
{
15
- public const AJAX_URL = 'opengento_snowflake/api/meteo ' ;
16
-
17
18
private const CONFIG_PATH_SNOWFLAKE_ENABLE = 'snowflake/general/enable ' ;
18
19
private const CONFIG_PATH_SNOWFLAKE_CHAR = 'snowflake/general/icon ' ;
19
20
private const CONFIG_PATH_SNOWFLAKE_V_SPEED = 'snowflake/general/vspeed ' ;
20
21
private const CONFIG_PATH_SNOWFLAKE_H_SPEED = 'snowflake/general/hspeed ' ;
21
22
private const CONFIG_PATH_SNOWFLAKE_ROT_SPEED = 'snowflake/general/rotspeed ' ;
22
- private const CONFIG_PATH_SNOWFLAKE_OPENWEATHERMAP_ENABLE = 'snowflake/general/enable_api ' ;
23
- private const CONFIG_PATH_SNOWFLAKE_OPENWEATHERMAP_API_KEY = 'snowflake/general/api_key ' ;
24
23
private const CONFIG_PATH_SNOWFLAKE_MIN_SIZE = 'snowflake/general/max_size ' ;
25
24
private const CONFIG_PATH_SNOWFLAKE_MAX_SIZE = 'snowflake/general/min_size ' ;
26
25
private const CONFIG_PATH_SNOWFLAKE_QTY = 'snowflake/general/qty ' ;
@@ -40,64 +39,69 @@ public function isEnabled(?int $scopeId = null): bool
40
39
41
40
public function getSnowflakeChar (?int $ scopeId = null ): string
42
41
{
43
- return $ this ->scopeConfig ->getValue (self ::CONFIG_PATH_SNOWFLAKE_CHAR , ScopeInterface::SCOPE_STORE , $ scopeId ) ?? '' ;
44
- }
45
-
46
- public function getSnowflakeVSpeed (?int $ scopeId = null ): string
47
- {
48
- return $ this ->scopeConfig ->getValue (self ::CONFIG_PATH_SNOWFLAKE_V_SPEED , ScopeInterface::SCOPE_STORE , $ scopeId ) ?? '' ;
49
- }
50
-
51
- public function getSnowflakeHSpeed (?int $ scopeId = null ): string
52
- {
53
- return $ this ->scopeConfig ->getValue (self ::CONFIG_PATH_SNOWFLAKE_H_SPEED , ScopeInterface::SCOPE_STORE , $ scopeId ) ?? '' ;
54
- }
55
-
56
- public function getSnowflakeRotSpeed (?int $ scopeId = null ): string
57
- {
58
- return $ this ->scopeConfig ->getValue (self ::CONFIG_PATH_SNOWFLAKE_ROT_SPEED , ScopeInterface::SCOPE_STORE , $ scopeId ) ?? '' ;
42
+ return (string )$ this ->scopeConfig ->getValue (
43
+ self ::CONFIG_PATH_SNOWFLAKE_CHAR ,
44
+ ScopeInterface::SCOPE_STORE ,
45
+ $ scopeId
46
+ );
59
47
}
60
48
61
- public function getSnowflakeQty (?int $ scopeId = null ): string
49
+ public function getSnowflakeVSpeed (?int $ scopeId = null ): float
62
50
{
63
- return $ this ->scopeConfig ->getValue (self ::CONFIG_PATH_SNOWFLAKE_QTY , ScopeInterface::SCOPE_STORE , $ scopeId ) ?? '' ;
51
+ return (float )$ this ->scopeConfig ->getValue (
52
+ self ::CONFIG_PATH_SNOWFLAKE_V_SPEED ,
53
+ ScopeInterface::SCOPE_STORE ,
54
+ $ scopeId
55
+ );
64
56
}
65
57
66
- public function getSnowflakeMinSize (?int $ scopeId = null ): string
58
+ public function getSnowflakeHSpeed (?int $ scopeId = null ): float
67
59
{
68
- return $ this ->scopeConfig ->getValue (self ::CONFIG_PATH_SNOWFLAKE_MIN_SIZE , ScopeInterface::SCOPE_STORE , $ scopeId ) ?? '' ;
60
+ return (float )$ this ->scopeConfig ->getValue (
61
+ self ::CONFIG_PATH_SNOWFLAKE_H_SPEED ,
62
+ ScopeInterface::SCOPE_STORE ,
63
+ $ scopeId
64
+ );
69
65
}
70
66
71
- public function getSnowflakeMaxSize (?int $ scopeId = null ): string
67
+ public function getSnowflakeRotSpeed (?int $ scopeId = null ): int
72
68
{
73
- return $ this ->scopeConfig ->getValue (self ::CONFIG_PATH_SNOWFLAKE_MAX_SIZE , ScopeInterface::SCOPE_STORE , $ scopeId ) ?? '' ;
69
+ return (int )$ this ->scopeConfig ->getValue (
70
+ self ::CONFIG_PATH_SNOWFLAKE_ROT_SPEED ,
71
+ ScopeInterface::SCOPE_STORE ,
72
+ $ scopeId
73
+ );
74
74
}
75
75
76
- public function isForceSnow (?int $ scopeId = null ): bool
76
+ public function getSnowflakeQty (?int $ scopeId = null ): int
77
77
{
78
- return $ this ->scopeConfig ->isSetFlag (self ::CONFIG_PATH_SNOWFLAKE_FORCE , ScopeInterface::SCOPE_STORE , $ scopeId );
78
+ return (int )$ this ->scopeConfig ->getValue (
79
+ self ::CONFIG_PATH_SNOWFLAKE_QTY ,
80
+ ScopeInterface::SCOPE_STORE ,
81
+ $ scopeId
82
+ );
79
83
}
80
84
81
- public function isApiEnable (?int $ scopeId = null ): bool
85
+ public function getSnowflakeMinSize (?int $ scopeId = null ): int
82
86
{
83
- return $ this ->scopeConfig ->isSetFlag (
84
- self ::CONFIG_PATH_SNOWFLAKE_OPENWEATHERMAP_ENABLE ,
87
+ return ( int ) $ this ->scopeConfig ->getValue (
88
+ self ::CONFIG_PATH_SNOWFLAKE_MIN_SIZE ,
85
89
ScopeInterface::SCOPE_STORE ,
86
90
$ scopeId
87
91
);
88
92
}
89
93
90
- public function getApiKey (?int $ scopeId = null ): string
94
+ public function getSnowflakeMaxSize (?int $ scopeId = null ): int
91
95
{
92
- return $ this ->scopeConfig ->getValue (
93
- self ::CONFIG_PATH_SNOWFLAKE_OPENWEATHERMAP_API_KEY ,
96
+ return ( int ) $ this ->scopeConfig ->getValue (
97
+ self ::CONFIG_PATH_SNOWFLAKE_MAX_SIZE ,
94
98
ScopeInterface::SCOPE_STORE ,
95
99
$ scopeId
96
100
);
97
101
}
98
102
99
- public function getAjaxUrl ( ): string
103
+ public function isForceSnow (? int $ scopeId = null ): bool
100
104
{
101
- return static :: AJAX_URL ;
105
+ return $ this -> scopeConfig -> isSetFlag ( self :: CONFIG_PATH_SNOWFLAKE_FORCE , ScopeInterface:: SCOPE_STORE , $ scopeId ) ;
102
106
}
103
107
}
0 commit comments