1010use Magento \Framework \App \Config \ScopeConfigInterface ;
1111use Magento \Store \Model \ScopeInterface ;
1212
13- class Snowflake
13+ /**
14+ * @api
15+ */
16+ final class Snowflake
1417{
15- public const AJAX_URL = 'opengento_snowflake/api/meteo ' ;
16-
1718 private const CONFIG_PATH_SNOWFLAKE_ENABLE = 'snowflake/general/enable ' ;
1819 private const CONFIG_PATH_SNOWFLAKE_CHAR = 'snowflake/general/icon ' ;
1920 private const CONFIG_PATH_SNOWFLAKE_V_SPEED = 'snowflake/general/vspeed ' ;
2021 private const CONFIG_PATH_SNOWFLAKE_H_SPEED = 'snowflake/general/hspeed ' ;
2122 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 ' ;
2423 private const CONFIG_PATH_SNOWFLAKE_MIN_SIZE = 'snowflake/general/max_size ' ;
2524 private const CONFIG_PATH_SNOWFLAKE_MAX_SIZE = 'snowflake/general/min_size ' ;
2625 private const CONFIG_PATH_SNOWFLAKE_QTY = 'snowflake/general/qty ' ;
@@ -40,64 +39,69 @@ public function isEnabled(?int $scopeId = null): bool
4039
4140 public function getSnowflakeChar (?int $ scopeId = null ): string
4241 {
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+ );
5947 }
6048
61- public function getSnowflakeQty (?int $ scopeId = null ): string
49+ public function getSnowflakeVSpeed (?int $ scopeId = null ): float
6250 {
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+ );
6456 }
6557
66- public function getSnowflakeMinSize (?int $ scopeId = null ): string
58+ public function getSnowflakeHSpeed (?int $ scopeId = null ): float
6759 {
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+ );
6965 }
7066
71- public function getSnowflakeMaxSize (?int $ scopeId = null ): string
67+ public function getSnowflakeRotSpeed (?int $ scopeId = null ): int
7268 {
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+ );
7474 }
7575
76- public function isForceSnow (?int $ scopeId = null ): bool
76+ public function getSnowflakeQty (?int $ scopeId = null ): int
7777 {
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+ );
7983 }
8084
81- public function isApiEnable (?int $ scopeId = null ): bool
85+ public function getSnowflakeMinSize (?int $ scopeId = null ): int
8286 {
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 ,
8589 ScopeInterface::SCOPE_STORE ,
8690 $ scopeId
8791 );
8892 }
8993
90- public function getApiKey (?int $ scopeId = null ): string
94+ public function getSnowflakeMaxSize (?int $ scopeId = null ): int
9195 {
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 ,
9498 ScopeInterface::SCOPE_STORE ,
9599 $ scopeId
96100 );
97101 }
98102
99- public function getAjaxUrl ( ): string
103+ public function isForceSnow (? int $ scopeId = null ): bool
100104 {
101- return static :: AJAX_URL ;
105+ return $ this -> scopeConfig -> isSetFlag ( self :: CONFIG_PATH_SNOWFLAKE_FORCE , ScopeInterface:: SCOPE_STORE , $ scopeId ) ;
102106 }
103107}
0 commit comments