@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use yii\base\Model; |
9 | 9 | use coderius\hitCounter\Module; |
10 | 10 | |
11 | -class HitCounterModel extends Model{ |
|
11 | +class HitCounterModel extends Model { |
|
12 | 12 | // const SCENARIO_CREATE = 'create'; |
13 | 13 | // const SCENARIO_UPDATE = 'update'; |
14 | 14 | |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | return [ |
63 | 63 | [['counter_id'], 'required'], |
64 | 64 | [['js_cookei_enabled', 'js_java_enabled', 'js_timezone_offset', 'js_screen_width', 'js_screen_height', 'js_color_depth', 'js_history_length', 'js_is_toutch_device', 'js_processor_ram', 'serv_auth_user_id', 'serv_is_proxy_or_vpn', 'serv_port'], 'integer'], |
65 | - [['serv_cookies','js_current_url', 'js_referer_url','serv_referer_url','serv_user_agent'], 'string'], |
|
66 | - [['counter_id', 'js_timezone', 'js_connection', 'js_browser_language', 'serv_server_name', 'serv_os', 'serv_client', 'serv_device', 'serv_brand', 'serv_model', 'serv_bot', 'serv_host_by_ip'], 'string', 'max' => 255], |
|
65 | + [['serv_cookies', 'js_current_url', 'js_referer_url', 'serv_referer_url', 'serv_user_agent'], 'string'], |
|
66 | + [['counter_id', 'js_timezone', 'js_connection', 'js_browser_language', 'serv_server_name', 'serv_os', 'serv_client', 'serv_device', 'serv_brand', 'serv_model', 'serv_bot', 'serv_host_by_ip'], 'string', 'max' => 255], |
|
67 | 67 | [['cookie_mark'], 'string', 'max' => 32], |
68 | 68 | [['serv_ip'], 'string', 'max' => 20], |
69 | 69 | [['serv_auth_user_id'], 'exist', 'skipOnError' => true, 'targetClass' => Module::getInstance()->userIdentityClass, 'targetAttribute' => ['serv_auth_user_id' => 'id']], |
70 | - [['cookie_mark', 'js_current_url', 'serv_ip', 'js_timezone_offset','js_timezone', 'js_connection','js_referer_url','js_screen_width','js_screen_height','js_color_depth','js_browser_language','js_history_length','js_processor_ram','serv_user_agent','serv_referer_url','serv_server_name','serv_auth_user_id','serv_port','serv_cookies','serv_os','serv_client','serv_device','serv_brand','serv_model','serv_bot','serv_host_by_ip'], 'default', 'value' => null], |
|
70 | + [['cookie_mark', 'js_current_url', 'serv_ip', 'js_timezone_offset', 'js_timezone', 'js_connection', 'js_referer_url', 'js_screen_width', 'js_screen_height', 'js_color_depth', 'js_browser_language', 'js_history_length', 'js_processor_ram', 'serv_user_agent', 'serv_referer_url', 'serv_server_name', 'serv_auth_user_id', 'serv_port', 'serv_cookies', 'serv_os', 'serv_client', 'serv_device', 'serv_brand', 'serv_model', 'serv_bot', 'serv_host_by_ip'], 'default', 'value' => null], |
|
71 | 71 | ]; |
72 | 72 | } |
73 | 73 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ?> |
40 | 40 | |
41 | 41 | <?php //Speed profiling ?> |
42 | -<?php if(YII_DEBUG): ?> |
|
42 | +<?php if (YII_DEBUG): ?> |
|
43 | 43 | <script language="javascript" type="text/javascript">console.time('hitCounter-' + '<?= $counterId; ?>')</script> |
44 | 44 | <?php endif; ?> |
45 | 45 | |
@@ -95,6 +95,6 @@ discard block |
||
95 | 95 | //--></script> |
96 | 96 | |
97 | 97 | <?php //Speed profiling ?> |
98 | -<?php if(YII_DEBUG): ?> |
|
98 | +<?php if (YII_DEBUG): ?> |
|
99 | 99 | <script language="javascript" type="text/javascript">console.timeEnd('hitCounter-' + '<?= $counterId; ?>');</script> |
100 | 100 | <?php endif; ?> |
@@ -186,7 +186,7 @@ |
||
186 | 186 | { |
187 | 187 | $defOpts = []; |
188 | 188 | $defOpts['target'] = '_blank'; |
189 | - if($this->counterOptions['type'] === self::COUNTER_VIEW_INVISIBLE) $defOpts['style'] = 'position:absolute; left:-9999px;'; |
|
189 | + if ($this->counterOptions['type'] === self::COUNTER_VIEW_INVISIBLE) $defOpts['style'] = 'position:absolute; left:-9999px;'; |
|
190 | 190 | $this->clientLinkOptions = array_merge($defOpts, $this->clientLinkOptions); |
191 | 191 | |
192 | 192 | } |
@@ -186,7 +186,9 @@ |
||
186 | 186 | { |
187 | 187 | $defOpts = []; |
188 | 188 | $defOpts['target'] = '_blank'; |
189 | - if($this->counterOptions['type'] === self::COUNTER_VIEW_INVISIBLE) $defOpts['style'] = 'position:absolute; left:-9999px;'; |
|
189 | + if($this->counterOptions['type'] === self::COUNTER_VIEW_INVISIBLE) { |
|
190 | + $defOpts['style'] = 'position:absolute; left:-9999px;'; |
|
191 | + } |
|
190 | 192 | $this->clientLinkOptions = array_merge($defOpts, $this->clientLinkOptions); |
191 | 193 | |
192 | 194 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * Class HitCounterModelAssembler |
10 | 10 | */ |
11 | 11 | |
12 | -final class HitCounterModelDtoAssembler{ |
|
12 | +final class HitCounterModelDtoAssembler { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Return model with attributes loaded by dto |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * Class HitCounterAssembler |
11 | 11 | */ |
12 | 12 | |
13 | -final class HitCounterDtoAssembler{ |
|
13 | +final class HitCounterDtoAssembler { |
|
14 | 14 | |
15 | 15 | public function readDto(HitDto $dto): HitCounter |
16 | 16 | { |
@@ -77,7 +77,7 @@ |
||
77 | 77 | |
78 | 78 | return $data; |
79 | 79 | }else{ |
80 | - throw new BadRequestHttpException('required get param "i" cannot be empty.'); |
|
80 | + throw new BadRequestHttpException('required get param "i" cannot be empty.'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | } |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | use coderius\hitCounter\dto\HitDTO; |
22 | 22 | use yii\web\BadRequestHttpException; |
23 | 23 | |
24 | -class HitCounterService extends Component{ |
|
24 | +class HitCounterService extends Component { |
|
25 | 25 | |
26 | 26 | use RequestTrait; |
27 | 27 | |
28 | 28 | private $deviceDetector; |
29 | 29 | private $repoHitCounter; |
30 | 30 | |
31 | - public function __construct(IDeviceDetect $dd, HitCounterRepository $hcr, $config = []) |
|
31 | + public function __construct(IDeviceDetect $dd, HitCounterRepository $hcr, $config = []) |
|
32 | 32 | { |
33 | 33 | $this->deviceDetector = $dd; |
34 | 34 | $this->repoHitCounter = $hcr; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function create(HitCounterModel $model): HitCounter |
40 | 40 | { |
41 | - $dto = (new HitCounterModelDtoAssembler())->writeDto($model);//dto |
|
41 | + $dto = (new HitCounterModelDtoAssembler())->writeDto($model); //dto |
|
42 | 42 | $hit = (new HitCounterDtoAssembler())->readDto($dto); |
43 | 43 | |
44 | 44 | $this->repoHitCounter->save($hit); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $array = $request->get(); |
59 | 59 | $data = []; |
60 | 60 | |
61 | - if(isset($array['i'])){ |
|
61 | + if (isset($array['i'])) { |
|
62 | 62 | $data['counter_id'] = $array['i']; |
63 | 63 | $data['js_cookei_enabled'] = ArrayHelper::getValue($array, 'c', 0); |
64 | 64 | $data['js_java_enabled'] = ArrayHelper::getValue($array, 'j', 0); |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | $data['js_screen_width'] = ArrayHelper::getValue($array, 'w'); |
71 | 71 | $data['js_screen_height'] = ArrayHelper::getValue($array, 'h'); |
72 | 72 | $data['js_color_depth'] = ArrayHelper::getValue($array, 'd'); |
73 | - $data['js_browser_language']= ArrayHelper::getValue($array, 'lg'); |
|
73 | + $data['js_browser_language'] = ArrayHelper::getValue($array, 'lg'); |
|
74 | 74 | $data['js_history_length'] = ArrayHelper::getValue($array, 'hl'); |
75 | - $data['js_is_toutch_device']= ArrayHelper::getValue($array, 'td', 0); |
|
75 | + $data['js_is_toutch_device'] = ArrayHelper::getValue($array, 'td', 0); |
|
76 | 76 | $data['js_processor_ram'] = ArrayHelper::getValue($array, 'ram'); |
77 | 77 | |
78 | 78 | return $data; |
79 | - }else{ |
|
79 | + }else { |
|
80 | 80 | throw new BadRequestHttpException('required get param "i" cannot be empty.'); |
81 | 81 | } |
82 | 82 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | |
124 | 124 | $name = static::defaultNameCookieMark(); |
125 | 125 | |
126 | - if ($request->cookies->has($name)){ |
|
126 | + if ($request->cookies->has($name)) { |
|
127 | 127 | return $request->cookies->getValue($name); |
128 | - }else{ |
|
128 | + }else { |
|
129 | 129 | $str = Yii::$app->getSecurity()->generateRandomString(); |
130 | 130 | |
131 | 131 | // add to HTTP |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $data['js_processor_ram'] = ArrayHelper::getValue($array, 'ram'); |
77 | 77 | |
78 | 78 | return $data; |
79 | - }else{ |
|
79 | + } else{ |
|
80 | 80 | throw new BadRequestHttpException('required get param "i" cannot be empty.'); |
81 | 81 | } |
82 | 82 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | if ($request->cookies->has($name)){ |
127 | 127 | return $request->cookies->getValue($name); |
128 | - }else{ |
|
128 | + } else{ |
|
129 | 129 | $str = Yii::$app->getSecurity()->generateRandomString(); |
130 | 130 | |
131 | 131 | // add to HTTP |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $this->addDependencies(); |
24 | 24 | } |
25 | 25 | |
26 | - private function addDependencies(){ |
|
26 | + private function addDependencies() { |
|
27 | 27 | $container = \Yii::$container; |
28 | 28 | |
29 | 29 | $container->set( |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace coderius\hitCounter\components\deviceDetect; |
4 | 4 | |
5 | -interface IDeviceDetect{ |
|
5 | +interface IDeviceDetect { |
|
6 | 6 | |
7 | 7 | public function getOs(); |
8 | 8 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | use DeviceDetector\Parser\Device\DeviceParserAbstract; |
11 | 11 | use yii\base\Component; |
12 | 12 | |
13 | -class DeviceDetector extends Component implements IDeviceDetect{ |
|
13 | +class DeviceDetector extends Component implements IDeviceDetect { |
|
14 | 14 | |
15 | 15 | private $detector; |
16 | 16 |